/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #409A72;
    --primary-dark: #2e7a57;
    --primary-light: #5fb887;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-light: #999999;
    --background: #ffffff;
    --background-light: #f8f9fa;
    --border-color: #e0e0e0;
    --error-color: #e74c3c;
    --success-color: #27ae60;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 480px;
    background: var(--background);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 32px 24px;
    animation: fadeIn 0.4s ease;
}

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

/* Logo Styles */
.logo-container {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    max-width: 180px;
    height: auto;
    object-fit: contain;
}

/* State Container */
.state-container {
    width: 100%;
    animation: fadeIn 0.4s ease;
}

.state-container.hidden {
    display: none;
}

/* Loading State */
.loader {
    width: 48px;
    height: 48px;
    margin: 0 auto 20px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
}

/* Error State */
.error-icon {
    font-size: 64px;
    text-align: center;
    margin-bottom: 20px;
}

.error-title {
    text-align: center;
    color: var(--error-color);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
}

.error-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 8px;
}

.error-code {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
}

/* Success State */
.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

.success-title {
    text-align: center;
    color: var(--primary-color);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 16px;
}

.success-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 16px;
}

.success-note {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 32px;
}

/* Form Styles */
.form-header {
    margin-bottom: 32px;
    text-align: center;
}

.form-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.form-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Form Error Message */
.form-error-message {
    background: #fee;
    border: 2px solid var(--error-color);
    border-radius: var(--border-radius);
    padding: 14px 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

.form-error-message.hidden {
    display: none;
}

.form-error-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.form-error-text {
    color: var(--error-color);
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.auth-form {
    width: 100%;
}

.form-fields {
    margin-bottom: 24px;
}

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

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-label .required {
    color: var(--error-color);
    margin-left: 4px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--background-light);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--background);
    box-shadow: 0 0 0 3px rgba(64, 154, 114, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-light);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-input.error,
.form-textarea.error {
    border-color: var(--error-color);
}

.field-error {
    color: var(--error-color);
    font-size: 13px;
    margin-top: 6px;
    display: block;
}

/* Submit Button */
.submit-button {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.submit-button:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.submit-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.submit-button:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Close Button */
.close-button {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    background: transparent;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.close-button:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.close-button:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 480px) {
    body {
        padding: 16px;
    }

    .container {
        padding: 24px 20px;
        border-radius: 12px;
    }

    .logo {
        max-width: 150px;
    }

    .form-title {
        font-size: 24px;
    }

    .form-description {
        font-size: 15px;
    }

    .form-input,
    .form-textarea {
        padding: 12px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .submit-button,
    .close-button {
        padding: 14px;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 20px 16px;
    }

    .form-title {
        font-size: 22px;
    }

    .error-title,
    .success-title {
        font-size: 22px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

