/* Custom Styles for Auth Layout */

/* Auth Page Background */
html:has(.auth-body) {
    overflow: hidden;       /* kill scroll at root level */
}

.auth-body {
    background-color: #020617;
    background-image:
        radial-gradient(at 0% 0%, rgba(153, 0, 0, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(15, 23, 42, 1) 0px, transparent 50%);
    height: 100vh;
    height: 100dvh;         /* dynamic viewport for mobile browsers */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;       /* clip bg-shapes and any overflow */
    padding: 1rem 0;
}

/* Toast Notifications (Modernized) */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2147483647;
    /* Max z-index to ensure visibility */
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    background: #1e293b;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    transform: translateY(150%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex !important;
    /* Force display flex */
    visibility: hidden;
    /* Start hidden but layout ready */
    align-items: center;
    gap: 0.75rem;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible !important;
}

.toast-success {
    background: #064e3b;
    /* Darker green */
    border-color: #059669;
    color: #a7f3d0;
}

.toast-danger {
    background: #7f1d1d;
    /* Darker red */
    border-color: #dc2626;
    color: #fca5a5;
}

.toast-primary {
    background: #1e3a8a;
    /* Darker blue */
    border-color: #2563eb;
    color: #bfdbfe;
}

[dir="rtl"] .toast {
    right: auto;
    left: 2rem;
}

/* Fallback Audio Prompt (Refined) */
/* Only shown if silent unlock fails repeatedly - rarely used now but kept for safety */
.audio-prompt {
    position: fixed;
    bottom: 5.5rem;
    /* Stack above toast */
    left: 2rem;
    z-index: 9999;
    max-width: 320px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1rem;
    color: white;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease-out;
}

/* Background Shapes */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.4;
}

.bg-shape-1 {
    top: -100px;
    right: -100px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #990000 0%, transparent 70%);
}

.bg-shape-2 {
    bottom: -100px;
    left: -100px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #6366f1 0%, transparent 70%);
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-container {
    animation: slideUp 0.5s ease-out;
    max-height: 100%;
    overflow-y: auto;       /* scroll inside container only */
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar on main-container but keep scroll functional */
.auth-body .main-container::-webkit-scrollbar {
    display: none;
}
.auth-body .main-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ============================================================
   Auth Pages – Mobile Responsiveness
   ============================================================ */

/* Small phones (≤ 480px) – edge-to-edge card */
@media (max-width: 480px) {
    .auth-body {
        align-items: flex-start;
        padding-top: env(safe-area-inset-top, 1rem);
    }

    .auth-body .main-container {
        max-width: 100% !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    /* Shrink background blobs so they don't cause overflow */
    .bg-shape-1 {
        width: 250px;
        height: 250px;
        top: -60px;
        right: -60px;
    }

    .bg-shape-2 {
        width: 300px;
        height: 300px;
        bottom: -60px;
        left: -60px;
    }
}

/* Medium phones (≤ 640px) */
@media (max-width: 640px) {
    .auth-body .main-container {
        max-width: 100%;
    }

    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        max-width: 100%;
    }

    [dir="rtl"] .toast {
        left: 1rem;
        right: 1rem;
    }
}

/* ============================================================
   Desktop Sidebar – Fixed Position Layout
   ============================================================ */
@media (min-width: 1025px) {
    .left-sidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        z-index: 1001 !important;
    }
    
    html[dir="ltr"] .left-sidebar {
        left: 0 !important;
        right: auto !important;
    }
    html[dir="rtl"] .left-sidebar {
        right: 0 !important;
        left: auto !important;
        border-right: none !important;
        border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .main-container {
        transition: margin 0.3s ease !important;
    }

    html[dir="ltr"] .main-container {
        margin-left: 260px !important;
        margin-right: 0 !important;
    }
    html[dir="ltr"] body.sidebar-collapsed .main-container {
        margin-left: 70px !important;
    }

    html[dir="rtl"] .main-container {
        margin-right: 260px !important;
        margin-left: 0 !important;
    }
    html[dir="rtl"] body.sidebar-collapsed .main-container {
        margin-right: 70px !important;
    }
}