/* Auth Page Styles */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - var(--header-height) - 100px);
    padding: 60px 16px;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    position: relative;
}

/* Tabs */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-md);
    font-weight: 500;
    padding: 12px 0;
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
}

.auth-tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: transparent;
    transition: background var(--transition-fast);
}

.auth-tab.active {
    color: var(--accent-teal);
}

.auth-tab.active::after {
    background: var(--accent-teal);
}

.auth-tab:hover:not(.active) {
    color: var(--text-primary);
}

/* Forms */
.auth-form {
    display: none;
    flex-direction: column;
    gap: 20px;
    animation: authFadeIn 0.3s ease;
}

.auth-form.active {
    display: flex;
}

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

/* Input Groups */
.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-input-group label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-wrapper > i:first-child {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: var(--font-size-base);
    pointer-events: none;
}

.auth-input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.auth-input::placeholder {
    color: var(--text-muted);
}

.auth-input:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(57, 219, 191, 0.1);
}

.auth-input.error {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.1);
}

/* Password Toggle */
.auth-password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.auth-password-toggle:hover {
    color: var(--text-primary);
}

/* Error Messages */
.auth-error {
    font-size: var(--font-size-xs);
    color: var(--accent-red);
    min-height: 0;
    transition: all var(--transition-fast);
}

.auth-error:not(:empty) {
    min-height: 16px;
}

/* Error spans placed directly in the form flow (terms checkbox, general error)
   must collapse fully when empty, otherwise the form's flex gap is doubled. */
.auth-form > .auth-error:empty {
    display: none;
}

/* Form-level (server) error — not tied to a single input.
   Rendered below the last field of the form as a themed alert box. */
.auth-error-general {
    display: none;
    padding: 10px 12px;
    background: var(--accent-red-bg);
    border: 1px solid var(--accent-red-border);
    border-radius: 10px;
    color: var(--accent-red);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    text-align: start;
}

.auth-error-general:not(:empty) {
    display: block;
    min-height: 0;
}

/* Terms checkbox error state (the checkbox is not an .auth-input) */
.auth-checkbox input[type="checkbox"].error {
    accent-color: var(--accent-red);
    outline: 2px solid var(--accent-red);
    outline-offset: 1px;
    border-radius: 3px;
}

/* Options Row */
.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Checkbox */
.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.auth-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-teal);
    cursor: pointer;
}

.auth-checkbox .checkmark {
    display: none;
}

.auth-checkbox a {
    color: var(--accent-teal);
    text-decoration: none;
}

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

/* Primary Button */
.auth-btn {
    width: 100%;
    padding: 13px;
    background: var(--accent-teal);
    color: var(--text-on-accent);
    border: none;
    border-radius: 10px;
    font-size: var(--font-size-md);
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.auth-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    white-space: nowrap;
}

/* Social Buttons */
.auth-social {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.auth-social-btn {
    width: 52px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.auth-social-btn:hover {
    border-color: var(--accent-teal);
    background: rgba(57, 219, 191, 0.05);
}

/* Social sign-in block (Google / Apple via Firebase). Wraps the divider, the
   icon buttons and the block-level error; hidden by login.php unless Firebase
   is configured, revealed by social-auth.js. */
.auth-social-block {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-social-block .auth-error-general:empty {
    display: none;
}

/* Links */
.auth-link {
    color: var(--accent-teal);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: opacity var(--transition-fast);
}

.auth-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Switch Text */
.auth-switch {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0;
}

/* Success Message */
.auth-success {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 230, 118, 0.1);
    border: 1px solid rgba(0, 230, 118, 0.3);
    border-radius: 10px;
    color: var(--accent-green);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 480px) {
    .auth-container {
        padding: 30px 12px;
    }

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

    .auth-social-btn {
        width: 48px;
        height: 40px;
    }
}

/* ─── OTP Panels ─────────────────────────────────────── */

.otp-panel {
    text-align: center;
}

.otp-header {
    margin-bottom: 24px;
}

.otp-icon {
    font-size: 40px;
    color: var(--accent-primary);
    display: block;
    margin-bottom: 12px;
}

.otp-header h3 {
    font-size: var(--font-size-lg, 1.25rem);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.otp-subtitle {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-secondary);
    line-height: 1.5;
}

.otp-subtitle strong {
    color: var(--text-primary);
}

.otp-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.otp-input {
    width: 200px !important;
    text-align: center;
    font-size: 24px !important;
    letter-spacing: 12px;
    font-weight: 700;
    padding: 12px 16px !important;
}

.otp-resend {
    margin-top: 16px;
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-secondary);
    min-height: 20px;
}

.otp-resend .auth-link {
    font-weight: 500;
}
