/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Animations */
.fade-enter-active,
.fade-leave-active {
    transition: opacity 0.3s;
}

.fade-enter,
.fade-leave-to {
    opacity: 0;
}

/* -------------------------------------------
   AUTH PAGE STYLES (Responsive Sliding Form)
------------------------------------------- */

/* Wrapper to center the auth card */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    padding: 20px;
    position: relative;
    z-index: 10;
}

/* Main Container */
.auth-container {
    background-color: #0f172a;
    /* Slate 950 */
    border-radius: 20px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25),
        0 10px 10px rgba(0, 0, 0, 0.22);
    position: relative;
    overflow: hidden;
    width: 850px;
    max-width: 100%;
    min-height: 600px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Common Form Container Styles */
.form-container {
    position: absolute;
    top: 0;
    height: 100%;
    transition: all 0.6s ease-in-out;
}

/* Form Styling */
.auth-form {
    background-color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 0 50px;
    height: 100%;
    text-align: center;
}

/* Sign In Container (Default Visible on Left) */
.sign-in-container {
    left: 0;
    width: 50%;
    z-index: 2;
}

/* Sign Up Container (Default Hidden on Left) */
.sign-up-container {
    left: 0;
    width: 50%;
    opacity: 0;
    z-index: 1;
}

/* Active State: Sign Up Moves to Right */
.auth-container.right-panel-active .sign-in-container {
    transform: translateX(100%);
}

.auth-container.right-panel-active .sign-up-container {
    transform: translateX(100%);
    opacity: 1;
    z-index: 10;
    /* INCREASED from 5 to 10 for clickability */
    animation: show 0.6s;
}

@keyframes show {

    0%,
    49.99% {
        opacity: 0;
        z-index: 1;
    }

    50%,
    100% {
        opacity: 1;
        z-index: 5;
    }
}

/* Overlay Container (The Sliding Part) */
.overlay-container {
    position: absolute;
    top: 0;
    left: 50%;
    width: 50%;
    height: 100%;
    overflow: hidden;
    transition: transform 0.6s ease-in-out;
    z-index: 100;
}

.auth-container.right-panel-active .overlay-container {
    transform: translateX(-100%);
}

/* The Overlay Background */
.overlay {
    background: #10b981;
    /* Fallback */
    background: -webkit-linear-gradient(to right, #059669, #10b981);
    background: linear-gradient(to right, #059669, #10b981);
    /* Emerald Gradient */
    background-repeat: no-repeat;
    background-size: cover;
    background-position: 0 0;
    color: #ffffff;
    position: relative;
    left: -100%;
    height: 100%;
    width: 200%;
    transform: translateX(0);
    transition: transform 0.6s ease-in-out;
}

.auth-container.right-panel-active .overlay {
    transform: translateX(50%);
}

/* Overlay Panels (Text) */
.overlay-panel {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 0 40px;
    text-align: center;
    top: 0;
    height: 100%;
    width: 50%;
    transform: translateX(0);
    transition: transform 0.6s ease-in-out;
}

.overlay-left {
    transform: translateX(-20%);
}

.auth-container.right-panel-active .overlay-left {
    transform: translateX(0);
}

.overlay-right {
    right: 0;
    transform: translateX(0);
}

.auth-container.right-panel-active .overlay-right {
    transform: translateX(20%);
}

/* Ghost Button (Transparent button on overlay) */
.ghost-btn {
    border-radius: 20px;
    border: 1px solid #ffffff;
    background-color: transparent;
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    padding: 12px 45px;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: transform 80ms ease-in;
    cursor: pointer;
}

.ghost-btn:active {
    transform: scale(0.95);
}

.ghost-btn:focus {
    outline: none;
}

/* Input Focus Styling override */
.input-focus:focus {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.5);
    /* Emerald ring */
}

/* -------------------------------------------
   RESPONSIVE (MOBILE) ADJUSTMENTS
------------------------------------------- */
@media (max-width: 768px) {
    .auth-container {
        width: 100%;
        min-height: auto;
        /* Allow content to dictate height */
        /* min-height: 80vh; */
        /* Optional: if you want it tall */
        height: auto;
        padding-bottom: 2rem;
    }

    /* Hide the sliding overlay on mobile */
    .overlay-container {
        display: none;
    }

    /* Forms take full width */
    .sign-in-container,
    .sign-up-container {
        width: 100%;
        position: relative;
        /* Stack normally or use logic to hide */
        height: auto;
        min-height: 500px;
        left: 0;
        /* Reset positioning */
    }

    .auth-form {
        padding: 40px 20px;
    }

    /* Logic to toggle visibility on mobile 
       Since we hide the overlay, we need to show/hide the forms based on .right-panel-active
       class which is toggled by AlpineJS/JS in index.html */

    /* Default: Show Sign In, Hide Sign Up */
    .sign-in-container {
        display: block;
    }

    .sign-up-container {
        display: none;
        opacity: 1;
        /* Reset opacity */
        z-index: 10;
        /* Ensure visible form is clickable */
    }

    /* Active State (Sign Up Active): Hide Sign In, Show Sign Up */
    .auth-container.right-panel-active .sign-in-container {
        display: none;
    }



    .auth-container.right-panel-active .sign-up-container {
        display: block;
        transform: none;
        /* Reset transform */
        animation: none;
    }
}


/* -------------------------------------------
   APP LAYOUT STYLES (Sidebar, Portfolio, Chat)
   Fixes for Mobile Responsiveness
------------------------------------------- */

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* -----------------------------
   SIDEBAR STYLES
----------------------------- */
.mobile-sidebar {
    /* width: 280px;  <-- REMOVED to let Tailwind handle width on desktop */
    min-height: 100vh;
    /* Changed to min-height for safety */
    background-color: #020617;
    /* Slate 950 */
    border-right: 1px solid rgba(30, 41, 59, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: width 0.3s ease, transform 0.3s ease-in-out;
}

/* Tablet/Desktop Minimized State */
@media (min-width: 768px) {
    .mobile-sidebar.md\:w-20 {
        width: 5rem;
        /* 80px */
    }

    .mobile-sidebar.md\:w-72 {
        width: 18rem;
        /* 288px */
    }
}

/* Mobile Sidebar (Drawer Mode) */
@media (max-width: 767px) {
    .mobile-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        transform: translateX(-100%);
        /* Hidden by default */
        box-shadow: 10px 0 25px rgba(0, 0, 0, 0.5);
        z-index: 60;
        /* Higher than portfolio/chat */
    }

    .mobile-sidebar.open {
        transform: translateX(0);
        /* Slide in */
    }

    /* Backdrop for mobile sidebar */
    .mobile-sidebar.open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 280px;
        /* Starts after sidebar */
        right: -100vw;
        /* Covers rest of screen */
        bottom: 0;
        height: 100vh;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(2px);
        z-index: -1;
        pointer-events: auto;
        /* Catch clicks to close if JS supported */
    }
}


/* -----------------------------
   CHAT WINDOW STYLES
----------------------------- */
/* Ensure chat window scrollbar is nice */
#chat-window::-webkit-scrollbar {
    width: 6px;
}

#chat-window::-webkit-scrollbar-thumb {
    background-color: #334155;
    border-radius: 4px;
}

#chat-window::-webkit-scrollbar-track {
    background-color: transparent;
}


/* -----------------------------
   PORTFOLIO WINDOW STYLES
----------------------------- */
.portfolio-window {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 100%;
    /* Default mobile: Full width */
    max-width: 100%;
    height: 85vh;
    /* Takes most of screen height */
    background-color: #0f172a;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    z-index: 50;
    /* Below sidebar on mobile, above chat */
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), height 0.3s ease;
    transform: translateY(0);
}

/* Mobile: Slide Up/Down logic usually handled by x-show transition, 
   but we ensure it stays fixed at bottom */

.portfolio-window.minimized {
    height: 60px;
    /* Only header visible */
    overflow: hidden;
}

.portfolio-window.maximized {
    height: 100vh;
    /* Full screen */
    border-radius: 0;
}

/* Desktop: Sidebar style portfolio or fixed bottom panel */
@media (min-width: 768px) {
    .portfolio-window {
        width: 450px;
        /* Fixed width on desktop */
        right: 20px;
        bottom: 0;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    }
}

/* Content Area */
.portfolio-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent window scroll */
    position: relative;
}

/* Tabs */
.portfolio-tabs button {
    position: relative;
    border-bottom: 2px solid transparent;
}

.portfolio-tabs button.active {
    color: #10b981;
    /* Emerald 500 */
    border-bottom-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

/* Ensure absolute positioning works for tab content scrolling */
.portfolio-content>.relative {
    position: relative;
    flex: 1;
    overflow: hidden;
}