* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #BF2B26;
    --primary-rgb: 191, 43, 38;
    --secondary: #231F20;
    --sidebar-width: 220px;
    --sidebar-collapsed-width: 50px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    overflow-x: hidden;
}

/* Keyframe Animations - Disabled */
/*
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes bounceIn {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    60% {
        transform: translateX(10px);
        opacity: 1;
    }
    80% {
        transform: translateX(-5px);
    }
    100% {
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}
*/

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--theme-sidebar-bg, #212529);
    color: white;
    padding: 0;
    margin: 0;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Sidebar Brand */
.sidebar-brand {
    padding: 18px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 18px 5px;
}

.sidebar-brand:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-brand i {
    font-size: 24px;
    flex-shrink: 0;
}

.sidebar-brand span {
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-brand span {
    opacity: 0;
    display: none;
}

/* Sidebar Navigation */
.sidebar-nav {
    list-style: none;
    padding: 15px 0;
    margin: 0;
}

.sidebar-nav-item {
    margin: 0;
    padding: 0;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-left: 3px solid transparent;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.sidebar.collapsed .sidebar-nav-link {
    justify-content: center;
    padding: 11px 5px;
    gap: 0;
}

.sidebar-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: white;
}

.sidebar-nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: white;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .sidebar-nav-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    margin-left: 15px;
    font-size: 13px;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar.collapsed .sidebar-nav-link:hover::after {
    opacity: 1;
}

.sidebar-nav-link i {
    font-size: 18px;
    flex-shrink: 0;
    width: 18px;
}

.sidebar-nav-link span {
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-nav-link span {
    opacity: 0;
    display: none;
}

/* Sidebar Section - Collapsible Headers */
.sidebar-section {
    padding: 12px 15px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 4px;
    user-select: none;
}

.sidebar-section:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-section-icon {
    font-size: 14px;
    flex-shrink: 0;
}

/* Rotate icon when section is collapsed */
.sidebar-section.collapsed .sidebar-section-icon {
    transform: rotate(-90deg);
}

.sidebar.collapsed .sidebar-section {
    justify-content: center;
    padding: 12px 5px;
}

.sidebar.collapsed .sidebar-section-text {
    display: none;
}

.sidebar.collapsed .sidebar-section-icon {
    transform: rotate(0deg) !important;
}

/* Section Content - Collapsible Container */
.sidebar-section-content {
    max-height: 2000px;
    overflow: hidden;
    opacity: 1;
}

.sidebar-section-content.collapsed {
    max-height: 0;
    opacity: 0;
    display: none;
}

/* Main Content */
.main-wrapper {
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-wrapper.collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Navigation Bar */
.topbar {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-toggle {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.topbar-toggle::after {
    content: 'Ctrl+B';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.topbar-toggle:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.topbar-toggle:hover {
    background-color: #fff5f5;
    transform: scale(1.1) rotate(5deg);
}

.topbar-toggle:active {
    transform: scale(0.95) rotate(-5deg);
}

.topbar-toggle i {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Language Selector */
.language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-btn {
    background: none;
    border: none;
    color: #667;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s;
    text-decoration: none;
}

.lang-btn:hover {
    background-color: #f0f0f0;
    color: var(--primary);
}

.lang-btn.active {
    background-color: #ffe5e5;
    color: var(--primary);
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    background-color: rgba(var(--primary-rgb, 191, 43, 38), 0.08);
    transition: all 0.3s;
    text-decoration: none;
    color: var(--primary);
    border: none;
}

.user-menu:hover {
    background-color: rgba(var(--primary-rgb, 191, 43, 38), 0.15);
    color: var(--primary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 15px 20px;
    text-align: center;
    color: #666;
    font-size: 13px;
}

/* Dropdowns */
.dropdown-menu {
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
}

.dropdown-item {
    font-size: 14px;
    padding: 10px 15px;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: #f5f5f5;
    color: var(--primary);
}

.dropdown-divider {
    margin: 0.5rem 0;
}

/* Mobile Backdrop Overlay */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 200px;
        --sidebar-collapsed-width: 50px;
    }

    .sidebar {
        z-index: 999;
    }

    .sidebar-nav-link {
        padding: 10px 12px;
    }

    .main-content {
        padding: 20px 15px;
    }

    .topbar {
        padding: 12px 15px;
    }
    
    .topbar-toggle::after {
        display: none;
    }
}

@media (max-width: 576px) {
    :root {
        --sidebar-width: 0;
        --sidebar-collapsed-width: 0;
    }

    .sidebar {
        width: 240px !important;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
        z-index: 1000;
    }

    .sidebar.show {
        /* No animation */
    }
    
    .sidebar.collapsed {
        width: 240px !important;
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .topbar {
        z-index: 998;
    }
    
    .topbar-toggle::after {
        display: none;
    }
}

/* Table Optimizations */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    margin-bottom: 0;
}

.table th,
.table td {
    padding: 10px 12px;
    vertical-align: middle;
    white-space: nowrap;
}

.table thead th {
    font-weight: 600;
    font-size: 13px;
}

.table tbody td {
    font-size: 14px;
}

/* Compact table cells */
.table th.text-nowrap,
.table td.text-nowrap {
    white-space: nowrap;
}

/* Action column optimization */
th:last-child,
td:last-child {
    width: 1%;
    white-space: nowrap;
}
