/* Base Variables & Typography */
:root {
    --primary-color: #4361ee;
    --primary-hover: #3a56d4;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --sidebar-width: 280px;
    --text-main: #1e293b;
    --text-muted: #64748b;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
}

/* Glassmorphism Login - Light Mode */
.login-wrapper {
    background: radial-gradient(circle at top left, rgba(67, 97, 238, 0.1), transparent 50%),
        radial-gradient(circle at bottom right, rgba(114, 9, 183, 0.1), transparent 50%),
        #f1f5f9;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.05);
}

.text-gradient {
    background: linear-gradient(135deg, #4361ee, #7209b7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Form Controls Customization */
.form-floating>.form-control {
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    color: var(--text-main);
}

.form-floating>.form-control:focus {
    background-color: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.15);
}

.form-floating>label {
    color: var(--text-muted);
}

.btn-login {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #fff;
}

.btn-login:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(67, 97, 238, 0.5);
    color: #fff;
}

/* Dashboard Layout */
.sidebar {
    width: var(--sidebar-width);
    z-index: 1040;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    left: 0;
}

.main-content {
    margin-left: var(--sidebar-width);
    background-color: var(--bg-light);
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Toggle Handle Style (Django Admin Style) */
.sidebar-toggle-handle {
    position: absolute;
    top: 50%;
    right: -14px; /* Stand on the boundary line */
    transform: translateY(-50%);
    width: 14px;
    height: 60px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-left: none;
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1050;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
    padding: 0;
}

.sidebar-toggle-handle:hover {
    background-color: #f1f5f9;
    color: var(--primary-color);
    width: 18px;
    right: -18px;
}

.sidebar-toggle-handle i {
    font-size: 0.75rem;
    font-weight: 700;
}

/* Desktop Collapsed state */
body.sidebar-collapsed .sidebar {
    left: calc(-1 * var(--sidebar-width));
}

body.sidebar-collapsed .main-content {
    margin-left: 0;
}

/* Desktop Collapsed state for custom elements */
html.layout-menu-collapsed:not(.layout-menu-hover) .custom-menu-text,
html.layout-menu-collapsed:not(.layout-menu-hover) .custom-profile-name,
html.layout-menu-collapsed:not(.layout-menu-hover) .custom-logout-btn,
html.layout-menu-collapsed:not(.layout-menu-hover) .app-brand-logo,
html.layout-menu-collapsed:not(.layout-menu-hover) .app-brand-text {
    display: none !important;
}

html.layout-menu-collapsed:not(.layout-menu-hover) .custom-menu-icon {
    margin-right: 0 !important;
}

html.layout-menu-collapsed .sidebar-custom-toggle i {
    transform: rotate(180deg) !important;
}

/* Sidebar Header Abbreviations when collapsed */
html.layout-menu-collapsed:not(.layout-menu-hover) .menu-header-text {
    display: none !important;
}

/* Reset .menu-header styles that hide text in collapsed mode */
html.layout-menu-collapsed:not(.layout-menu-hover) .layout-menu .menu-vertical .menu-inner > .menu-header,
html.layout-menu-collapsed:not(.layout-menu-hover) .menu-vertical .menu-inner > .menu-header {
    text-indent: 0 !important;
    margin-inline-start: 0 !important;
    inline-size: var(--bs-menu-collapsed-width) !important;
    padding-inline: 0 !important;
    text-align: center !important;
    margin-top: 0.25rem !important;
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
}

html.layout-menu-collapsed:not(.layout-menu-hover) .menu-header-abbr {
    display: block !important;
    text-align: center;
    color: #a1acb8 !important; /* Açık gri (light gray) */
    font-size: 0.75rem;
    font-weight: 400 !important; /* Normal text */
    letter-spacing: 0.5px;
}

/* Hide the pseudo-element divider */
html.layout-menu-collapsed:not(.layout-menu-hover) .layout-menu .menu-vertical .menu-inner > .menu-header::before,
html.layout-menu-collapsed:not(.layout-menu-hover) .menu-vertical .menu-inner > .menu-header::before {
    display: none !important;
}

/* Mobile & Tablet Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
        box-shadow: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding-top: 60px !important; /* Space for mobile header */
    }
    
    .sidebar-toggle-btn {
        display: none !important;
    }
    
    body.sidebar-open .sidebar {
        left: 0;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Backdrop */
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(15, 23, 42, 0.5);
        backdrop-filter: blur(4px);
        z-index: 1035;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }
    
    .mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background-color: #ffffff;
        border-bottom: 1px solid #e2e8f0;
        display: flex !important;
        align-items: center;
        padding: 0 1rem;
        z-index: 1030;
    }
}

@media (min-width: 992px) {
    .mobile-header {
        display: none !important;
    }
}

/* Sidebar Scrollable Nav List */
.sidebar > .nav {
    overflow-y: auto;
    overflow-x: hidden;
    flex-wrap: nowrap;
    flex-grow: 1;
    flex-shrink: 1;
    min-height: 0;
    padding-right: 2px; /* Small space for scrollbar */
}
.sidebar > .nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar > .nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar > .nav::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.sidebar > .nav::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Sidebar Links */
.sidebar .nav-link {
    border-radius: 0.5rem;
    padding: 0.8rem 1rem;
    transition: all 0.2s;
    font-weight: 500;
}

.sidebar .nav-link:hover:not(.active) {
    background-color: #f1f5f9;
    transform: translateX(5px);
    color: var(--primary-color) !important;
}

.sidebar .nav-link.active {
    background: var(--primary-color);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

/* Expanded top-level collapse menu headers */
.sidebar .nav-link[aria-expanded="true"],
.sidebar .nav-item:has(.collapse.show) > .nav-link {
    background-color: #f1f5f9;
    color: var(--primary-color) !important;
    border-left: 4px solid var(--primary-color);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    font-weight: 600;
}
.sidebar .nav-link .bi-chevron-down {
    transition: transform 0.2s ease;
}
.sidebar .nav-link[aria-expanded="true"] .bi-chevron-down,
.sidebar .nav-item:has(.collapse.show) > .nav-link .bi-chevron-down {
    transform: rotate(180deg);
}

/* Dashboard Cards */
.stat-card {
    background-color: var(--card-bg);
    border-radius: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.08) !important;
}

/* Utilities */
.fs-7 {
    font-size: 0.875rem;
}

/* HTMX Loading Indicators */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator {
    display: inline-block;
}

/* Critical Stock Blinking Dot */
.critical-stock-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: #ef4444;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 8px #ef4444;
    animation: blink-dot 1.5s infinite ease-in-out;
}

@keyframes blink-dot {
    0% {
        transform: scale(0.9);
        opacity: 0.6;
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(0.9);
        opacity: 0.6;
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Sidebar Icon Colors (Only when link is not active) */
.sidebar .nav-link:not(.active) i.bi-house-door {
    color: #3b82f6 !important; /* Blue */
}
.sidebar .nav-link:not(.active) i.bi-boxes {
    color: #f97316 !important; /* Orange */
}
.sidebar .nav-link:not(.active) i.bi-folder2-open {
    color: #10b981 !important; /* Emerald */
}
.sidebar .nav-link:not(.active) i.bi-graph-up {
    color: #06b6d4 !important; /* Cyan */
}
.sidebar .nav-link:not(.active) i.bi-people-fill {
    color: #8b5cf6 !important; /* Violet */
}
.sidebar .nav-link:not(.active) i.bi-chat-right-text {
    color: #ec4899 !important; /* Pink/Rose */
}
.sidebar .nav-link:not(.active) i.bi-envelope-at {
    color: #0d9488 !important; /* Teal */
}
.sidebar .nav-link:not(.active) i.bi-folder-fill {
    color: #eab308 !important; /* Amber */
}
.sidebar .nav-link:not(.active) i.bi-gear-fill {
    color: #ef4444 !important; /* Red */
}
 / *   S e l e c t 2   c o m b o b o x   i t e m s   s m a l l e r   f o n t   a n d   p a d d i n g   * / 
 . s e l e c t 2 - r e s u l t s _ _ o p t i o n   { 
         f o n t - s i z e :   0 . 8 5 r e m   ! i m p o r t a n t ; 
         p a d d i n g :   4 p x   8 p x   ! i m p o r t a n t ; 
 } 
 . s e l e c t 2 - c o n t a i n e r - - b o o t s t r a p - 5   . s e l e c t 2 - s e l e c t i o n   { 
         f o n t - s i z e :   0 . 9 r e m   ! i m p o r t a n t ; 
 } 
  
 
/* Fix mobile sidebar scrolling */
@media (max-width: 991.98px) {
    .layout-menu {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .menu-inner {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        touch-action: auto !important;
    }
}
