/*
 * BookzCart — Firebase Auth Styles
 * Heritage Tamil UI Kit — Phone OTP Authentication Page
 *
 * @package BookzCart
 */

/* ============================================
   AUTH PAGE LAYOUT
   ============================================ */
.auth-page {
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    align-items: stretch;
}

.auth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    min-height: calc(100vh - var(--nav-height));
}

/* ============================================
   BRAND PANEL (Left side)
   ============================================ */
.auth-brand {
    background: linear-gradient(160deg, var(--palm-leaf) 0%, var(--palm-leaf-dark) 60%, #0a1f18 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(232, 145, 58, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.auth-brand::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.04) 0%, transparent 60%);
    border-radius: 50%;
    pointer-events: none;
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: white;
    max-width: 400px;
}

.auth-brand-icon {
    font-size: 3.5rem;
    margin-bottom: var(--space-3);
    color: var(--marigold);
    filter: drop-shadow(0 4px 12px rgba(232, 145, 58, 0.3));
}

.auth-brand-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--space-2);
    line-height: 1.2;
}

.auth-brand-content p {
    font-size: 1.1rem;
    opacity: 0.85;
    line-height: 1.6;
    margin-bottom: var(--space-5);
}

.auth-brand-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    align-items: flex-start;
    margin: 0 auto;
    width: fit-content;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 1rem;
    opacity: 0.9;
}

.auth-feature .bz-icon {
    width: 40px;
    height: 40px;
    padding: 10px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--marigold);
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}

/* ============================================
   AUTH FORM PANEL (Right side)
   ============================================ */
.auth-form-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-6) var(--space-6);
    background: var(--rice-white);
    position: relative;
    max-width: 560px;
    margin: 0 auto;
    width: 100%;
}

.auth-step {
    animation: authFadeIn 0.35s ease;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-step[hidden] {
    display: none;
}

/* Step Header */
.auth-step-header {
    margin-bottom: var(--space-4);
}

.auth-step-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--deep-indigo);
    margin-bottom: 6px;
}

.auth-step-header p {
    color: #666;
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* Back Button */
.auth-back-btn {
    background: none;
    border: none;
    color: var(--palm-leaf);
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0;
    margin-bottom: var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color var(--transition-fast);
}

.auth-back-btn:hover {
    color: var(--marigold);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.auth-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--deep-indigo);
    margin-bottom: -4px;
}

.auth-label .required {
    color: var(--error);
}

.auth-label small {
    font-weight: 400;
    color: #888;
}

.auth-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--deep-indigo);
    background: white;
    transition: all var(--transition-fast);
    outline: none;
    font-family: var(--font-tamil);
}

.auth-input:focus {
    border-color: var(--palm-leaf);
    box-shadow: 0 0 0 3px rgba(27, 77, 62, 0.1);
}

.auth-input::placeholder {
    color: #aaa;
}

/* ============================================
   PHONE INPUT GROUP
   ============================================ */
.phone-input-group {
    display: flex;
    gap: 0;
    position: relative;
}

.country-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 12px;
    border: 2px solid #e0e0e0;
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    background: #f5f5f5;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--deep-indigo);
    transition: all var(--transition-fast);
    white-space: nowrap;
    font-family: var(--font-tamil);
}

.country-selector:hover {
    background: #ebebeb;
}

.country-selector .bz-icon {
    width: 10px;
    height: 10px;
    color: #888;
    transition: transform var(--transition-fast);
}

.country-selector.is-open .bz-icon {
    transform: rotate(180deg);
}

.country-flag {
    font-size: 1.25rem;
    line-height: 1;
}

.country-code {
    font-weight: 600;
    font-size: 0.9375rem;
}

.phone-field {
    border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
    flex: 1;
    letter-spacing: 1px;
    font-size: 1.0625rem;
}

/* Country Dropdown */
.country-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    margin-top: 4px;
    max-height: 280px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.country-dropdown[hidden] {
    display: none;
}

.country-search {
    padding: 12px 14px;
    border: none;
    border-bottom: 1px solid #eee;
    font-size: 0.875rem;
    outline: none;
    font-family: var(--font-tamil);
    color: var(--deep-indigo);
}

.country-search::placeholder {
    color: #aaa;
}

.country-list {
    overflow-y: auto;
    flex: 1;
}

.country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 0.875rem;
    color: var(--deep-indigo);
}

.country-option:hover,
.country-option.is-selected {
    background: rgba(27, 77, 62, 0.06);
}

.country-option .country-flag {
    font-size: 1.25rem;
}

.country-option .country-name {
    flex: 1;
}

.country-option .country-dial {
    color: #888;
    font-weight: 500;
    font-size: 0.8125rem;
}

/* ============================================
   OTP INPUT
   ============================================ */
.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: var(--space-2) 0;
}

.otp-digit {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-md);
    background: white;
    color: var(--deep-indigo);
    outline: none;
    transition: all var(--transition-fast);
    caret-color: var(--palm-leaf);
    font-family: var(--font-latin);
}

.otp-digit:focus {
    border-color: var(--palm-leaf);
    box-shadow: 0 0 0 3px rgba(27, 77, 62, 0.1);
    transform: scale(1.05);
}

.otp-digit.filled {
    border-color: var(--palm-leaf);
    background: rgba(27, 77, 62, 0.03);
}

.otp-digit.error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(230, 20, 100, 0.1);
    animation: otpShake 0.3s ease;
}

@keyframes otpShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

/* OTP Timer */
.otp-timer {
    text-align: center;
    font-size: 0.875rem;
    color: #666;
    margin-bottom: var(--space-1);
}

.otp-timer strong {
    color: var(--palm-leaf);
    font-weight: 700;
}

/* ============================================
   BUTTONS
   ============================================ */
.auth-btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    margin-top: var(--space-1);
    justify-content: center;
    position: relative;
    overflow: hidden;
    font-family: var(--font-tamil);
}

.auth-btn .btn-text,
.auth-btn .btn-loader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-btn .btn-loader[hidden] {
    display: none;
}

.auth-btn.is-loading .btn-text {
    display: none;
}

.auth-btn.is-loading .btn-loader {
    display: inline-flex !important;
}

.auth-link-btn {
    background: none;
    border: none;
    color: var(--palm-leaf);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: underline;
    padding: 0;
    font-family: var(--font-tamil);
}

.auth-link-btn:hover {
    color: var(--marigold);
}

.auth-link-btn[hidden] {
    display: none;
}

.auth-disclaimer {
    font-size: 0.75rem;
    color: #999;
    text-align: center;
    margin-top: var(--space-1);
    line-height: 1.5;
}

/* ============================================
   AUTH TOAST
   ============================================ */
.auth-toast {
    position: fixed;
    bottom: var(--space-4);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--error);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    animation: toastSlideUp 0.35s ease forwards;
    max-width: 90vw;
}

.auth-toast[hidden] {
    display: none;
}

.auth-toast.success {
    background: var(--success);
}

@keyframes toastSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================================
   reCAPTCHA (invisible — hidden container)
   ============================================ */
#recaptcha-container {
    min-height: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .auth-container {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        display: none;
    }

    .auth-form-wrap {
        padding: var(--space-4) var(--space-3);
        max-width: 100%;
        min-height: calc(100vh - var(--nav-height));
    }

    .auth-step-header h2 {
        font-size: 1.5rem;
    }

    .otp-digit {
        width: 46px;
        height: 54px;
        font-size: 1.25rem;
    }
}

@media (max-width: 400px) {
    .otp-inputs {
        gap: 6px;
    }

    .otp-digit {
        width: 40px;
        height: 48px;
        font-size: 1.125rem;
    }
}

/* ============================================
   DARK MODE
   ============================================ */
[data-theme="dark"] .auth-form-wrap {
    background: #1a1d24;
}

[data-theme="dark"] .auth-step-header h2 {
    color: #f0f0f0;
}

[data-theme="dark"] .auth-step-header p {
    color: #aaa;
}

[data-theme="dark"] .auth-label {
    color: #ddd;
}

[data-theme="dark"] .auth-input {
    background: #22252d;
    border-color: #3a3d45;
    color: #f0f0f0;
}

[data-theme="dark"] .auth-input:focus {
    border-color: var(--palm-leaf-light);
    box-shadow: 0 0 0 3px rgba(45, 106, 86, 0.2);
}

[data-theme="dark"] .auth-input::placeholder {
    color: #666;
}

[data-theme="dark"] .country-selector {
    background: #2a2d35;
    border-color: #3a3d45;
    color: #ddd;
}

[data-theme="dark"] .country-selector:hover {
    background: #32353d;
}

[data-theme="dark"] .country-dropdown {
    background: #22252d;
    border-color: #3a3d45;
}

[data-theme="dark"] .country-search {
    background: #22252d;
    color: #f0f0f0;
    border-bottom-color: #3a3d45;
}

[data-theme="dark"] .country-option {
    color: #ddd;
}

[data-theme="dark"] .country-option:hover,
[data-theme="dark"] .country-option.is-selected {
    background: rgba(45, 106, 86, 0.15);
}

[data-theme="dark"] .otp-digit {
    background: #22252d;
    border-color: #3a3d45;
    color: #f0f0f0;
}

[data-theme="dark"] .otp-digit:focus {
    border-color: var(--palm-leaf-light);
    box-shadow: 0 0 0 3px rgba(45, 106, 86, 0.2);
}

[data-theme="dark"] .otp-digit.filled {
    background: rgba(45, 106, 86, 0.1);
    border-color: var(--palm-leaf-light);
}

[data-theme="dark"] .otp-timer {
    color: #aaa;
}

[data-theme="dark"] .auth-disclaimer {
    color: #666;
}

[data-theme="dark"] .phone-field {
    border-left: 2px solid #3a3d45 !important;
}