/* Authentication Styles - Matching Mobile App Authentication Flow */

/* Auth Body & Container */
.auth-body {
    background: linear-gradient(135deg, var(--panel-subtle) 0%, white 50%, var(--panel-subtle) 100%);
    min-height: 100vh;
    font-family: var(--font-family);
}

.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Auth Header */
.auth-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: var(--space-m) 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.auth-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-l);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    font-size: var(--text-xl);
    font-weight: var(--fw-bold);
    color: var(--primary);
    text-decoration: none;
}

.logo:hover {
    color: var(--primary-dark);
}

.auth-nav {
    display: flex;
    align-items: center;
    gap: var(--space-s);
}

.auth-nav-text {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.auth-nav-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: var(--fw-medium);
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-s);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    min-height: 44px;
}

.auth-nav-link:hover {
    background: var(--panel-subtle);
    color: var(--primary-dark);
}

/* Auth Main */
.auth-main {
    flex: 1;
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 80px);
}

/* Auth Card */
.auth-card {
    flex: 1;
    max-width: 500px;
    padding: var(--space-2xl) var(--space-xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: white;
    position: relative;
    overflow-y: auto;
}

.forgot-password-card {
    justify-content: flex-start;
    padding-top: var(--space-3xl);
}

/* Auth Welcome */
.auth-welcome {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.auth-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--panel-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-l);
    color: var(--primary);
    font-size: var(--text-2xl);
}

.auth-title {
    font-size: var(--text-3xl);
    font-weight: var(--fw-bold);
    color: var(--text);
    margin-bottom: var(--space-s);
    line-height: 1.2;
}

.auth-subtitle {
    font-size: var(--text-base);
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Auth Form */
.auth-form {
    width: 100%;
    margin-bottom: var(--space-xl);
}

.form-row {
    display: flex;
    gap: var(--space-m);
    margin-bottom: var(--space-l);
}

.form-group {
    margin-bottom: var(--space-l);
}

.form-group-half {
    flex: 1;
}

.form-label {
    display: block;
    font-weight: var(--fw-semibold);
    color: var(--text);
    margin-bottom: var(--space-s);
    font-size: var(--text-sm);
}

.form-input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.form-input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input-container.error {
    border-color: #dc2626;
}

.form-icon {
    position: absolute;
    left: var(--space-m);
    color: var(--text-muted);
    z-index: 2;
    pointer-events: none;
}

.form-control {
    flex: 1;
    border: none;
    padding: var(--space-m) var(--space-m) var(--space-m) var(--space-3xl);
    font-size: var(--text-base);
    color: var(--text);
    background: transparent;
    outline: none;
    min-height: 48px;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.phone-input {
    padding-left: var(--space-m);
    border-left: 1px solid var(--border);
}

.country-code-select {
    border: none;
    padding: var(--space-m);
    background: transparent;
    color: var(--text);
    font-size: var(--text-sm);
    outline: none;
    cursor: pointer;
    max-width: 80px;
}

.form-toggle-password {
    position: absolute;
    right: var(--space-m);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    z-index: 2;
    min-height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-toggle-password:hover {
    background: var(--panel-subtle);
    color: var(--text);
}

.location-detect-btn {
    position: absolute;
    right: var(--space-m);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    z-index: 2;
    min-height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-detect-btn:hover {
    background: var(--panel-subtle);
    color: var(--primary);
}

.form-error {
    color: #dc2626;
    font-size: var(--text-sm);
    margin-top: var(--space-xs);
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.form-hint {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-top: var(--space-xs);
    line-height: 1.4;
}

/* Password Requirements */
.password-requirements {
    margin-top: var(--space-s);
    padding: var(--space-m);
    background: var(--panel-subtle);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.requirement {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.requirement:last-child {
    margin-bottom: 0;
}

.requirement-icon {
    color: #dc2626;
    font-size: var(--text-xs);
}

.requirement.valid {
    color: #16a34a;
}

.requirement.valid .requirement-icon {
    color: #16a34a;
}

.requirement.valid .requirement-icon:before {
    content: '\f00c';
}

/* Password Strength Meter */
.password-strength {
    margin-top: var(--space-s);
    padding: var(--space-m);
    background: var(--panel-subtle);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.strength-label {
    font-size: var(--text-sm);
    color: var(--text);
    margin-bottom: var(--space-xs);
    font-weight: var(--fw-medium);
}

.strength-meter {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-bottom: var(--space-s);
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: all 0.3s ease;
    background: #dc2626;
}

.strength-bar.weak {
    width: 25%;
    background: #dc2626;
}

.strength-bar.fair {
    width: 50%;
    background: #f59e0b;
}

.strength-bar.good {
    width: 75%;
    background: #eab308;
}

.strength-bar.strong {
    width: 100%;
    background: #16a34a;
}

.strength-text {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-s);
}

/* Checkbox Styling */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
}

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

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom:before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
}

.checkbox-text {
    font-size: var(--text-sm);
    color: var(--text);
}

.checkbox-text a {
    color: var(--primary);
    text-decoration: none;
}

.checkbox-text a:hover {
    text-decoration: underline;
}

.terms-checkbox .checkbox-text {
    line-height: 1.4;
}

.forgot-password-link {
    color: var(--primary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    white-space: nowrap;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

/* Submit Button */
.auth-submit {
    width: 100%;
    padding: var(--space-m) var(--space-xl);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: var(--text-base);
    font-weight: var(--fw-semibold);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-s);
    min-height: 52px;
    position: relative;
}

.auth-submit:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

/* Form Messages */
.form-message-container {
    margin-top: var(--space-l);
}

.form-message {
    padding: var(--space-m);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    display: flex;
    align-items: center;
    gap: var(--space-s);
}

.form-message.success {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.form-message.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.form-message.info {
    background: rgba(108, 207, 201, 0.1);
    color: var(--primary);
    border: 1px solid #bfdbfe;
}

/* Social Auth */
.social-auth {
    margin-bottom: var(--space-xl);
}

.social-divider {
    text-align: center;
    position: relative;
    margin-bottom: var(--space-l);
}

.social-divider:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.social-divider span {
    background: white;
    color: var(--text-muted);
    font-size: var(--text-sm);
    padding: 0 var(--space-l);
    position: relative;
    z-index: 1;
}

.social-buttons {
    display: flex;
    gap: var(--space-s);
}

.btn-social {
    flex: 1;
    padding: var(--space-m);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    color: var(--text);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-s);
    min-height: 48px;
}

.btn-social:hover {
    background: var(--panel-subtle);
    border-color: var(--text);
    transform: translateY(-1px);
}

.google-btn:hover {
    border-color: #db4437;
    color: #db4437;
}

.facebook-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    margin-top: auto;
    padding-top: var(--space-xl);
}

.auth-footer p {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-s);
    line-height: 1.4;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: var(--fw-medium);
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-footer-text {
    font-size: var(--text-xs);
    line-height: 1.5;
}

/* Auth Image Section */
.auth-image {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    position: relative;
    overflow: hidden;
}

.auth-image:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.auth-image-content {
    text-align: center;
    max-width: 400px;
    position: relative;
    z-index: 1;
}

.auth-image-content h2 {
    font-size: var(--text-2xl);
    font-weight: var(--fw-bold);
    margin-bottom: var(--space-l);
    line-height: 1.2;
}

.auth-image-content p {
    font-size: var(--text-base);
    line-height: 1.6;
    margin-bottom: var(--space-2xl);
    opacity: 0.9;
}

.auth-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-l);
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    font-size: var(--text-sm);
    opacity: 0.9;
}

.auth-feature i {
    font-size: var(--text-base);
    opacity: 0.8;
}

/* Success/Error Content */
.forgot-password-success,
.success-content,
.error-content {
    text-align: center;
    padding: var(--space-xl);
}

.success-icon-large,
.error-icon-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-xl);
    font-size: var(--text-3xl);
}

.success-icon-large {
    background: #dcfce7;
    color: #16a34a;
}

.error-icon-large {
    background: #fef2f2;
    color: #dc2626;
}

.success-content h2,
.error-content h2 {
    font-size: var(--text-2xl);
    font-weight: var(--fw-bold);
    color: var(--text);
    margin-bottom: var(--space-m);
}

.success-message,
.success-note p,
.error-content p {
    color: var(--text-muted);
    font-size: var(--text-base);
    line-height: 1.5;
    margin-bottom: var(--space-s);
}

.reset-email {
    font-weight: var(--fw-semibold);
    color: var(--text);
    background: var(--panel-subtle);
    padding: var(--space-s) var(--space-m);
    border-radius: var(--radius);
    margin: var(--space-l) 0;
    word-break: break-word;
}

.success-note {
    margin: var(--space-l) 0;
}

.reset-actions,
.success-actions,
.error-actions {
    display: flex;
    gap: var(--space-m);
    justify-content: center;
    margin-top: var(--space-2xl);
    flex-wrap: wrap;
}

.btn-outline {
    padding: var(--space-m) var(--space-xl);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--space-s);
    min-height: 44px;
    justify-content: center;
}

.btn-outline:hover {
    background: var(--panel-subtle);
    border-color: var(--text);
    transform: translateY(-1px);
}

.btn-primary {
    padding: var(--space-m) var(--space-xl);
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    color: white;
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--space-s);
    min-height: 44px;
    justify-content: center;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

/* Invalid Token Message */
.invalid-token-message {
    text-align: center;
    padding: var(--space-2xl);
}

/* Modal Styles for Auth */
.success-modal {
    max-width: 400px;
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-2xl);
    margin: 0 auto var(--space-l);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner-large {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-l);
    animation: spin 1s linear infinite;
}

.loading-content p {
    font-size: var(--text-base);
    margin: 0;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .auth-main {
        flex-direction: column;
    }

    .auth-card {
        max-width: none;
        padding: var(--space-xl) var(--space-l);
        min-height: auto;
    }

    .auth-image {
        display: none;
    }

    .auth-header-content {
        padding: 0 var(--space-l);
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-m);
    }

    .social-buttons {
        flex-direction: column;
    }

    .auth-features {
        grid-template-columns: 1fr;
    }

    .reset-actions,
    .success-actions,
    .error-actions {
        flex-direction: column;
    }

    .auth-nav {
        flex-direction: column;
        align-items: flex-end;
        gap: var(--space-xs);
        text-align: right;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: var(--space-l) var(--space-m);
    }

    .auth-header-content {
        padding: 0 var(--space-m);
    }

    .auth-title {
        font-size: var(--text-2xl);
    }

    .form-control {
        padding: var(--space-s) var(--space-s) var(--space-s) var(--space-2xl);
        min-height: 44px;
    }

    .country-code-select {
        padding: var(--space-s);
        max-width: 70px;
        font-size: var(--text-xs);
    }

    .phone-input {
        font-size: var(--text-sm);
    }

    .auth-nav {
        flex-direction: row;
        align-items: center;
    }

    .auth-nav-text {
        display: none;
    }
}

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

/* Focus Styles for Accessibility */
.form-control:focus,
.country-code-select:focus,
.checkbox-label input[type="checkbox"]:focus + .checkbox-custom {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-social:focus,
.auth-submit:focus,
.btn-primary:focus,
.btn-outline:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}