* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #333);
    min-height: 100vh;
    padding: 16px;
    margin: 0;
}

.container {
    max-width: 400px;
    margin: 0 auto;
    background: var(--tg-theme-secondary-bg-color, #ffffff);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    background: #ffffff;
    color: #333;
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid #e1e8ed;
}

.icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

.form {
    padding: 24px 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.required {
    color: #e74c3c;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: #ffffff;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="tel"]:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.form-group input[readonly] {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.checkbox-group {
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(0, 122, 255, 0.2);
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 15px;
    line-height: 1.5;
    font-weight: 500;
    color: var(--tg-theme-text-color, #333);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 24px;
    height: 24px;
    border: 2px solid #333;
    border-radius: 4px;
    margin-right: 12px;
    margin-top: 0px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s ease;
    background: #ffffff;
    box-shadow: none;
    display: inline-block;
}

.checkmark:hover {
    border-color: #555;
    background: #f8f9fa;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #ffffff;
    border-color: #333;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid #333;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.checkbox-label a {
    color: #007AFF;
    text-decoration: underline;
    cursor: pointer;
}

.checkbox-label a:hover {
    opacity: 0.8;
}

.expandable-text {
    margin-top: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007AFF;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
        padding-top: 16px;
        padding-bottom: 16px;
    }
}

.text-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.text-content h5 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 16px 0 8px 0;
}

.text-content p {
    font-size: 13px;
    line-height: 1.5;
    color: #555;
    margin-bottom: 12px;
}

.text-content p:last-child {
    margin-bottom: 0;
}

.text-content .small-text {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

.error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
    min-height: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.error-message.show {
    opacity: 1;
}

.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.submit-btn.loading {
    color: transparent;
}

.submit-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Адаптивность для маленьких экранов */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .container {
        border-radius: 12px;
    }

    .header {
        padding: 20px 16px;
    }

    .form {
        padding: 20px 16px;
    }

    .header h1 {
        font-size: 22px;
    }

    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="tel"] {
        font-size: 16px; /* Предотвращает зум на iOS */
    }
}

/* Стили для темной темы Telegram */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }

    .container {
        background: #2c2c54;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    }

    .form-group label {
        color: #ffffff;
    }

    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="tel"] {
        background: #40407a;
        border-color: #706fd3;
        color: #ffffff;
    }

    .form-group input[type="text"]:focus,
    .form-group input[type="email"]:focus,
    .form-group input[type="tel"]:focus {
        border-color: #3742fa;
        box-shadow: 0 0 0 3px rgba(55, 66, 250, 0.2);
    }

    .form-group input[readonly] {
        background: #57606f;
        color: #a4b0be;
    }

    .checkbox-group {
        background: rgba(255, 255, 255, 0.1);
        border: 2px solid rgba(55, 66, 250, 0.4);
    }

    .checkmark {
        border-color: #ffffff;
        background: #ffffff;
        box-shadow: none;
        border-width: 2px;
        width: 24px;
        height: 24px;
        border-radius: 4px;
        display: inline-block;
    }

    .checkmark:hover {
        border-color: #cccccc;
        background: #f0f0f0;
    }

    .checkbox-label input[type="checkbox"]:checked + .checkmark {
        background: #ffffff;
        border-color: #ffffff;
        box-shadow: none;
    }

    .checkbox-label input[type="checkbox"]:checked + .checkmark::after {
        border-color: #333;
        left: 5px;
        top: 2px;
        width: 6px;
        height: 10px;
        border-width: 0 3px 3px 0;
    }

    .checkbox-label {
        color: #ffffff;
        font-weight: 600;
    }

    .checkbox-label a {
        color: #64b5f6;
        text-shadow: 0 0 4px rgba(100, 181, 246, 0.3);
    }
}
