/* ARMS Custom Styles - Premium UI Extensions */

:root {
    --sidebar-width: 16rem; /* 256px */
    --sidebar-collapsed-width: 5rem; /* 80px */
    --primary-color: #1e3a8a;
    --transition-speed: 0.3s;
}

/* Sidebar Transition */
#sidebar {
    transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1), 
                transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Independent Scroll Layout ===== */
/* Lock the outer flex wrapper to viewport height so sidebar & main scroll independently */
.flex.min-h-screen {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

/* Sidebar: full viewport height, internal nav scrolls */
@media (min-width: 768px) {
    #sidebar {
        height: 100vh;
        max-height: 100vh;
        position: sticky;
        top: 0;
    }
}

/* Main content column: fill remaining height, scroll internally */
.flex.min-h-screen > .flex-1.flex.flex-col {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

/* The <main> tag scrolls independently */
.flex.min-h-screen > .flex-1.flex.flex-col > main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Sidebar scrollbar styling */
#sidebar .custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}
#sidebar .custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
#sidebar .custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
#sidebar .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Collapsed State Styles (Desktop only) */
@media (min-width: 768px) {
    body.sidebar-collapsed #sidebar {
        width: var(--sidebar-collapsed-width);
    }

    body.sidebar-collapsed #sidebar .sidebar-text,
    body.sidebar-collapsed #sidebar .sidebar-header-text,
    body.sidebar-collapsed #sidebar .sidebar-footer-text {
        display: none;
    }

    body.sidebar-collapsed #sidebar .nav-item {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    body.sidebar-collapsed #sidebar .nav-item i {
        margin-right: 0;
        font-size: 1.25rem;
    }

    body.sidebar-collapsed #sidebar .section-title {
        display: flex;
        justify-content: center;
    }

    body.sidebar-collapsed #sidebar .section-title p {
        display: none;
    }

    body.sidebar-collapsed #sidebar .section-title::after {
        content: "";
        display: block;
        width: 20px;
        height: 1px;
        background: rgba(255, 255, 255, 0.1);
        margin: 10px 0;
    }

    body.sidebar-collapsed .sidebar-user-section {
        padding: 1rem 0;
        display: flex;
        justify-content: center;
    }

    /* Stacked Header when Collapsed */
    body.sidebar-collapsed #sidebar .sidebar-header {
        flex-direction: column !important;
        height: auto !important;
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 1rem !important;
    }

    body.sidebar-collapsed #sidebar .sidebar-header-content {
        justify-content: center !important;
        width: auto !important;
        margin-left: 0 !important;
    }

    body.sidebar-collapsed #sidebar .sidebar-logo {
        height: 2.5rem !important;
        width: 2.5rem !important;
        object-fit: contain !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }

    body.sidebar-collapsed #sidebar #sidebar-toggle {
        margin: 0 !important;
        display: flex !important; /* Ensure it stays visible */
    }
}

/* User Profile Section in Sidebar */
.sidebar-user-section {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.25rem 1rem;
    background: rgba(15, 23, 42, 0.8); /* Slightly darker */
    backdrop-filter: blur(10px);
}

/* Logo Adjustment */
body.sidebar-collapsed #sidebar .sidebar-logo {
    margin-right: 0;
}

/* Main Content Adjustment */
#main-content {
    transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

/* Premium Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Interactive Elements */
.nav-item {
    position: relative;
    overflow: hidden;
}

.nav-item::after {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--primary-color);
    transition: height 0.2s ease;
}

.nav-item.active::after {
    height: 60%;
}

/* Glassmorphism Utilities */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    transition: all 0.3s ease;
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.glass-button {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.8), rgba(30, 64, 175, 0.8));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.glass-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.9), rgba(30, 64, 175, 0.9));
}

/* Global Blur Synchronization */
.blur-active {
    filter: blur(8px) saturate(150%) brightness(0.9);
    transition: filter 0.3s ease-out;
    pointer-events: none;
    user-select: none;
}

/* Premium Modal Animations */
@keyframes modalIn {
    0% { opacity: 0; transform: scale(0.95) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes modalOut {
    0% { opacity: 1; transform: scale(1) translateY(0); }
    100% { opacity: 0; transform: scale(0.95) translateY(10px); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.modal-animate-in {
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-animate-out {
    animation: modalOut 0.2s ease-in forwards;
}

.backdrop-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

.backdrop-fade-out {
    animation: fadeOut 0.2s ease-in forwards;
}
