/* ===================== BRAND & DESIGN TOKENS ===================== */
:root {
    /* Corporate Blue & Professional Palette */
    --brand-primary: #1d4ed8;
    /* Blue 700 */
    --brand-secondary: #1e3a8a;
    /* Blue 900 */
    --brand-accent: #3b82f6;
    /* Blue 500 */
    --brand-success: #059669;
    /* Emerald 600 */
    --brand-warning: #ea580c;
    /* Orange 600 */
    --brand-danger: #dc2626;
    /* Red 600 */
    --brand-dark: #0f172a;
    /* Slate 900 for Sidebar */
    --brand-warm-bg: #f8fafc;
    /* Cool slate off-white */
    --brand-surface: #ffffff;

    /* Layout Constants */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
    --card-radius: 16px;
    --btn-radius: 10px;

    /* Animation */
    --transition-fast: all 0.2s ease;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--brand-warm-bg);
    color: #334155;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--brand-dark);
    color: #ecf0f1;
    z-index: 1050;
    transition: var(--transition-smooth);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    min-height: var(--topbar-height);
    height: auto;
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .ms-auto {
    display: none !important;
}

.sidebar-nav {
    list-style: none;
    padding: 16px 12px;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar-nav>li {
    margin-bottom: 6px;
}

.sidebar-nav a,
.sidebar-nav .submenu-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 12px;
    transition: var(--transition-smooth);
    background: transparent;
    border: none;
    width: 100%;
}

.sidebar-nav>li.active>a,
.sidebar-nav>li.active>.submenu-toggle {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: #fff;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3);
}

.sidebar-nav a:hover,
.sidebar-nav .submenu-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    transform: translateX(4px);
}

.sidebar-nav i {
    font-size: 1.2rem;
    min-width: 20px;
}

/* Submenu Styling */
.sidebar-submenu ul {
    list-style: none;
    padding: 0;
    margin: 4px 0 10px 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
}

.sidebar-submenu.open ul {
    max-height: 1000px;
}

.sidebar-submenu ul li a {
    padding: 10px 16px 10px 48px;
    font-size: 0.88rem;
    color: #b4c6ef;
}

.sidebar-submenu ul li.active a {
    color: var(--brand-primary);
    font-weight: 600;
}

.sidebar-submenu .bi-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.3s;
}

.sidebar-submenu.open .bi-chevron-down {
    transform: rotate(180deg);
}

/* ===================== MAIN CONTENT ===================== */
.main-content {
    margin-left: var(--sidebar-width);
    transition: var(--transition-smooth);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed);
}

.top-navbar {
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 24px;
    display: flex;
    align-items: center;
}

.sidebar-toggle-btn {
    font-size: 1.4rem;
    color: #64748b;
    padding: 8px;
    border-radius: 10px;
    transition: var(--transition-fast);
}

.sidebar-toggle-btn:hover {
    background: #f1f5f9;
    color: var(--brand-primary);
}

.content-wrapper {
    padding: 32px;
    flex: 1;
}

@media (max-width: 768px) {
    .sidebar {
        left: -100%;
    }

    .sidebar.mobile-open {
        left: 0;
        width: 100%;
    }

    .main-content {
        margin-left: 0 !important;
    }
}

/* ===================== PREMIUM COMPONENTS ===================== */
/* Cards */
.card {
    border: none;
    border-radius: var(--card-radius);
    background: var(--brand-surface);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    transition: var(--transition-smooth);
    overflow: hidden;
    margin-bottom: 24px;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.card-header {
    background: transparent;
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 700;
    font-size: 1.1rem;
    color: #1e293b;
}

/* Stat Cards */
.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.bg-primary-gradient {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
}

.bg-info-gradient {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
}

.bg-success-gradient {
    background: linear-gradient(135deg, #10b981, #059669);
}

.bg-danger-gradient {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.bg-warning-gradient {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.bg-purple-gradient {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.urgency-high {
    background: rgba(220, 38, 38, 0.1);
    border-left: 4px solid #dc2626 !important;
}

.urgency-medium {
    background: rgba(234, 88, 12, 0.1);
    border-left: 4px solid #ea580c !important;
}

.urgency-none {
    border-left: 4px solid #e2e8f0 !important;
}

.upcoming-task-item {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-fast);
    border: 1px solid #f1f5f9;
}

.upcoming-task-item:hover {
    transform: translateX(4px);
    background: #f8fafc;
}

.stat-info .stat-label {
    font-size: 0.88rem;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 2px;
}

.stat-info .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1e293b;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
}

.top-navbar .btn-outline-danger {
    border: 1px solid #fee2e2;
    background: #fff;
    color: #ef4444;
}

.top-navbar .btn-outline-danger:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
}

/* Buttons */
.btn {
    border-radius: var(--btn-radius);
    padding: 10px 20px;
    font-weight: 600;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(29, 78, 216, 0.4);
}

.btn-primary:hover {
    background: var(--brand-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.3);
    color: #fff;
}

/* Tables */
.table {
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: -8px;
}

.table thead th {
    background: transparent;
    border: none;
    color: #64748b;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 24px;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody td {
    background: transparent;
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: inherit;
}

.table tbody tr {
    background-color: #fff;
    color: #1e293b;
    transition: var(--transition-fast);
}

.table tbody td:first-child {
    border-left: 1px solid #f1f5f9;
    border-radius: 16px 0 0 16px;
}

.table tbody td:last-child {
    border-right: 1px solid #f1f5f9;
    border-radius: 0 16px 16px 0;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

.table tbody tr:hover td {
    border-color: #e2e8f0;
}

/* Task Status Classes */
.table tbody tr.task-unread {
    background-color: #dc3545 !important;
    color: #fff !important;
}

.table tbody tr.task-unread a {
    color: #fff !important;
}

.table tbody tr.task-read {
    color: #0d6efd !important;
}

/* DataTables Responsive Support */
.table tbody tr.task-unread + tr.child {
    background-color: #dc3545 !important;
    color: #fff !important;
}

.table tbody tr.task-unread + tr.child a {
    color: #fff !important;
}

.table tbody tr.task-unread + tr.child .dtr-details {
    background-color: transparent !important;
}

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.75rem;
}

.bg-success {
    background-color: #dcfce7 !important;
    color: #15803d !important;
}

.bg-primary {
    background-color: #e0e7ff !important;
    color: #4338ca !important;
}

.bg-warning {
    background-color: #fef3c7 !important;
    color: #b45309 !important;
}

.bg-danger {
    background-color: #fee2e2 !important;
    color: #b91c1c !important;
}

.bg-secondary {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
}

/* Forms */
.form-control,
.form-select {
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(139, 0, 0, 0.1);
}

.breadcrumb {
    font-size: 0.95rem;
    font-weight: 500;
}

.breadcrumb-item+.breadcrumb-item::before {
    content: "\F285";
    font-family: "bootstrap-icons";
    font-size: 0.7rem;
    color: #94a3b8;
}

.breadcrumb-item.active {
    color: #1e293b;
    font-weight: 700;
}

.breadcrumb-item a {
    color: #64748b;
    text-decoration: none;
    transition: var(--transition-fast);
}

.breadcrumb-item a:hover {
    color: var(--brand-primary);
}

/* Tabs */
.nav-tabs {
    border: none;
    gap: 8px;
    margin-bottom: 24px;
}

.nav-tabs .nav-link {
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    color: #64748b;
    transition: var(--transition-fast);
}

.nav-tabs .nav-link:hover {
    background-color: #f1f5f9;
    color: #1e293b;
}

.nav-tabs .nav-link.active {
    background-color: var(--brand-primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.2);
}

/* ===================== LOGIN PAGE ===================== */
.login-page {
    background: url('/assets/img/login_bg.png') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(2, 6, 23, 0.6));
    z-index: 1;
}

.login-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 50px 40px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 100%;
    animation: fadeInScale 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-icon {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: #fff;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    margin: 0 auto 24px;
    box-shadow: 0 15px 30px rgba(29, 78, 216, 0.3);
    position: relative;
    overflow: hidden;
}

.login-icon::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

.login-card h3 {
    color: #fff;
    font-weight: 800;
    font-size: 1.75rem;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-card .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
    font-weight: 500;
    font-size: 1rem;
}

.login-page .form-label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 0.9rem;
}

.login-page .form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 14px 16px;
}

.login-page .form-control:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.login-page .input-group-text {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
}

.login-page .form-check-label {
    color: rgba(255, 255, 255, 0.7);
}

.btn-login {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    border: none;
    padding: 14px;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 10px 25px rgba(29, 78, 216, 0.4);
    transition: var(--transition-smooth);
}

.btn-login:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 35px rgba(29, 78, 216, 0.5);
    color: #fff;
}

/* Animations */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes shine {
    0% { transform: translateX(-150%) rotate(45deg); }
    100% { transform: translateX(150%) rotate(45deg); }
}

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

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

.content-wrapper>* {
    animation: fadeIn 0.4s ease forwards;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Stock Status Badges */
.badge-stock-var {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    border: 1px solid #27ae60;
    font-weight: 600;
    padding: 0.4em 0.8em;
    border-radius: 6px;
}

.badge-stock-yok {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid #e74c3c;
    font-weight: 600;
    padding: 0.4em 0.8em;
    border-radius: 6px;
}

/* DataTables Buttons Styling */
.dt-buttons .btn {
    border-radius: 8px !important;
    margin-right: 5px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Mobile Enhancements */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -250px;
        z-index: 1000;
        transition: all 0.3s;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .main-content.expanded {
        margin-left: 0;
    }

    .content-wrapper {
        padding: 16px;
    }

    .card-body {
        padding: 16px;
    }

    .stat-card {
        padding: 16px;
    }

    /* Top Navbar Mobile Optimization */
    .top-navbar {
        padding: 0 12px !important;
    }
    
    .top-navbar .breadcrumb {
        display: none;
    }

    .top-navbar .ms-auto span {
        display: none; /* Hide user name string, keep icon if possible or just hide both */
    }
    
    .top-navbar .ms-auto .btn-sm {
        padding: 4px 8px;
    }

    .table-responsive .table {
        white-space: normal; /* Allow text wrapping on mobile */
    }

    .table-responsive .table.nowrap {
        white-space: nowrap; /* Keep nowrap only if explicitly requested */
    }

    /* Better DataTables Responsive Child Row Styling */
    table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before {
        background-color: var(--brand-primary);
    }

    table.dataTable > tbody > tr.child ul.dtr-details {
        width: 100%;
        padding: 15px;
    }

    table.dataTable > tbody > tr.child span.dtr-title {
        font-weight: 700;
        min-width: 120px;
        display: inline-block;
    }

    table.dataTable > tbody > tr.child span.dtr-data {
        white-space: normal;
    }
}