/* ═══════════════════════════════════════════════════════
   MyTenantsBook — Auth Pages
   Login, Signup, and form styles
   ═══════════════════════════════════════════════════════ */

.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: var(--space-8);
    background:
        radial-gradient(ellipse 80% 60% at 20% 40%, rgba(52, 120, 246, 0.08), transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(20, 35, 84, 0.05), transparent 60%),
        var(--brand-50);
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    padding: var(--space-10);
}

/* ── Header ── */
.auth-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-header .logo {
    justify-content: center;
    margin-bottom: var(--space-6);
}

.auth-header h1 {
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-2);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

/* ── Form ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-group label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-300);
}

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

.input-wrapper svg {
    position: absolute;
    left: var(--space-4);
    width: 1.125rem;
    height: 1.125rem;
    color: var(--text-muted);
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: var(--space-3) var(--space-4) var(--space-3) var(--space-12);
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
    transition: all var(--duration-fast) var(--ease-in-out);
}

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

.input-wrapper input:focus {
    outline: none;
    border-color: var(--brand-500);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(52, 120, 246, 0.15);
}

/* ── Options Row ── */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-sm);
}

.forgot-link {
    color: var(--brand-400);
    font-weight: 500;
}

.forgot-link:hover {
    color: var(--brand-300);
}

/* ── Footer ── */
.auth-footer {
    margin-top: var(--space-6);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--brand-400);
    font-weight: 600;
}

.auth-footer a:hover {
    color: var(--brand-300);
}

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

.checkbox-container a {
    color: var(--brand-400);
}

/* ── Google Login Button ── */
.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-6);
    background: white;
    color: #1f1f1f;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-in-out);
}

.btn-google:hover {
    background: var(--gray-50);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

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

.btn-google svg {
    flex-shrink: 0;
}

/* ── Auth Divider ── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-6) 0;
}

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

.auth-divider span {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* ── Role Selector Tabs ── */
.role-selector {
    display: flex;
    background: var(--gray-100);
    padding: var(--space-1);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    border: 1px solid var(--border);
}

.role-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2.5) var(--space-4);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-in-out);
}

.role-btn svg {
    width: 1rem;
    height: 1rem;
    color: var(--text-muted);
    transition: color var(--duration-fast) var(--ease-in-out);
}

.role-btn.active {
    background: var(--surface-page);
    color: var(--brand-600);
    box-shadow: var(--shadow-sm);
}

.role-btn.active svg {
    color: var(--brand-600);
}

.role-btn:hover:not(.active) {
    color: var(--text-primary);
}

.role-btn:hover:not(.active) svg {
    color: var(--text-secondary);
}

/* ── Password Toggle ── */
.input-wrapper input.password-input {
    padding-right: 3rem !important;
}

.password-toggle-btn {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 2.75rem;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--duration-fast) var(--ease-in-out);
    z-index: 10;
    outline: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.password-toggle-btn:hover {
    color: var(--brand-500);
}

.password-toggle-btn:focus-visible {
    outline: 2px solid var(--brand-400);
    outline-offset: -2px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.password-toggle-btn svg {
    position: static !important;
    width: 1.125rem !important;
    height: 1.125rem !important;
    pointer-events: none;
    flex-shrink: 0;
    transition: color var(--duration-fast) var(--ease-in-out);
}

@media (max-width: 768px) {
    /* 1. Make the authentication card use almost the full screen width */
    .auth-container {
        width: calc(100vw - 24px) !important;
        max-width: 420px !important;
        margin: 0 auto !important;
        /* 2. Position the login card closer to the top */
        margin-top: 24px !important;
    }

    /* 1. Reduce empty space above the login card */
    .auth-page {
        padding: 12px 6px !important;
        min-height: auto !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
    }

    /* 4. Reduce card shadow by 25% & 6. Maintain 24px horizontal padding (at least 24px on all sides) */
    .auth-card {
        padding: 28px 24px !important;
        border-radius: var(--radius-lg) !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
    }

    /* 3. Move the theme toggle inside the card header area in top-right corner */
    .auth-header-top {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        margin-bottom: 12px !important;
        position: relative !important;
    }
    
    .auth-header-top #theme-toggle-btn {
        position: absolute !important;
        right: 0 !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    .auth-header .logo {
        justify-content: center !important;
        margin-bottom: 0 !important;
        width: auto !important;
        flex: initial !important;
    }

    /* 4. Reduce logo section height by 30% */
    .auth-header .logo .logo-icon {
        width: 26px !important;
        height: 26px !important;
    }
    .auth-header .logo .logo-icon i,
    .auth-header .logo .logo-icon svg {
        width: 16px !important;
        height: 16px !important;
    }
    .auth-header .logo span {
        font-size: 1.15rem !important;
    }

    /* 5. Reduce heading margin and subtitle spacing */
    .auth-header {
        margin-bottom: 16px !important;
        text-align: center !important;
    }
    
    .auth-header h1 {
        font-size: 1.35rem !important;
        margin-bottom: 4px !important;
        margin-top: 4px !important;
    }
    
    .auth-header p {
        font-size: 0.825rem !important;
        margin-bottom: 6px !important;
    }

    /* 6. Increase input height to 52px */
    .input-wrapper input {
        height: 52px !important;
        min-height: 52px !important;
        font-size: 0.95rem !important;
    }

    /* 7. Increase tap area for Password eye icon & 9. Make eye icon easier to tap */
    .password-toggle-btn {
        width: 52px !important;
        min-width: 52px !important;
        min-height: 52px !important;
    }

    .password-toggle-btn svg {
        width: 1.25rem !important;
        height: 1.25rem !important;
    }

    /* 7. Increase tap area for Checkbox and Remember me option */
    .checkbox-container {
        padding: 8px 0 !important;
        font-size: 0.85rem !important;
        color: var(--text-secondary) !important;
        display: flex !important;
        align-items: flex-start !important;
        gap: 10px !important;
        text-align: left !important;
        line-height: 1.4 !important;
    }
    
    .checkbox-container input {
        width: 20px !important;
        height: 20px !important;
        cursor: pointer !important;
        margin: 2px 0 0 0 !important;
        flex-shrink: 0 !important;
    }

    /* 8. Improve role selector */
    .role-selector {
        margin-bottom: 12px !important;
        height: 52px !important;
        padding: 4px !important;
        gap: 4px !important;
        display: flex !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .role-btn {
        flex: 1 1 0% !important;
        width: 50% !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        padding: 0 8px !important;
        font-size: 0.85rem !important;
        min-height: auto !important;
        border-radius: var(--radius-md) !important;
        transition: all 0.2s ease !important;
    }
    
    .role-btn svg {
        width: 1rem !important;
        height: 1rem !important;
    }

    /* 11. Remove unnecessary vertical whitespace */
    #google-signin-btn {
        margin-bottom: 10px !important;
        min-height: 44px !important;
    }

    .auth-divider {
        margin: 10px 0 !important;
    }

    .auth-form {
        gap: 14px !important;
    }
    
    .form-group {
        gap: 6px !important;
    }

    .form-group label {
        color: var(--gray-800) !important;
        font-weight: 600 !important;
        font-size: 0.825rem !important;
    }

    [data-theme="dark"] .form-group label {
        color: var(--gray-200) !important;
    }

    /* 7. Improve spacing between: Password field, Remember Me, Forgot Password */
    .auth-options {
        margin-top: 6px !important;
        margin-bottom: 6px !important;
        min-height: 44px !important;
    }

    /* 10. Make CTA button fixed width and min-height 52px */
    .auth-form .btn {
        width: 100% !important;
        min-height: 52px !important;
        height: 52px !important;
        font-size: 0.95rem !important;
        font-weight: 600 !important;
    }

    /* Verify page responsiveness */
    .status-container {
        padding: 8px 0 !important;
    }
    .status-icon {
        width: 64px !important;
        height: 64px !important;
        margin-bottom: 12px !important;
    }
    .status-icon svg,
    .status-icon i {
        width: 32px !important;
        height: 32px !important;
    }
    .status-title {
        font-size: 1.25rem !important;
        margin-bottom: 6px !important;
    }
    .status-message {
        font-size: 0.85rem !important;
        margin-bottom: 16px !important;
    }
    .btn-group {
        gap: 8px !important;
    }
    .btn-group .btn {
        min-height: 52px !important;
        height: 52px !important;
    }
}