/* Modern Design System - css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Noto+Sans+Thai:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary-color: #4e73df;
    --primary-dark: #2e59d9;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;

    /* Backgrounds */
    --bg-body: #f3f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #1a1c23;

    /* Text */
    --text-primary: #2e384d;
    --text-secondary: #6c757d;
    --text-light: #f8f9fc;

    /* Effects */
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: 1px solid rgba(255, 255, 255, 0.3);

    /* Sidebar Specific */
    --sidebar-width: 300px;
    --sidebar-gradient: linear-gradient(180deg, #1a1c23 0%, #121418 100%);
    --nav-hover-bg: rgba(255, 255, 255, 0.1);
    --nav-active-bg: rgba(78, 115, 223, 0.2);
    --nav-active-color: #4e73df;
}

body {
    font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* --- Premium Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-gradient);
    color: var(--text-light);
    padding: 0;
    z-index: 1050;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-header img {
    height: 60px;
    object-fit: contain;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.sidebar-header img:hover {
    transform: scale(1.05);
}

.sidebar-header h6 {
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #fff;
    margin: 0;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 1.5rem 1rem;
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
    list-style: none;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.nav-link i {
    width: 24px;
    text-align: center;
    margin-right: 12px;
    font-size: 1.1rem;
    transition: transform 0.2s;
}

/* Hover & Active States */
.sidebar-nav .nav-link:hover {
    background-color: var(--nav-hover-bg);
    color: #fff;
    transform: translateX(4px);
}

.sidebar-nav .nav-link.active {
    background-color: var(--nav-active-bg);
    color: #fff;
    border: 1px solid rgba(78, 115, 223, 0.3);
    box-shadow: 0 4px 12px rgba(78, 115, 223, 0.2);
}

.sidebar-nav .nav-link:hover i,
.sidebar-nav .nav-link.active i {
    color: var(--primary-color);
    transform: scale(1.1);
}

/* Dropdown/Submenu */
.nav-group-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    margin: 1.5rem 1.25rem 0.5rem;
    font-weight: 700;
}

.dropdown-menu-custom {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin-top: 5px;
    padding: 0.5rem;
    border: none;
}

.dropdown-item-custom {
    color: rgba(255, 255, 255, 0.6);
    padding: 0.6rem 1rem 0.6rem 3rem;
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s;
}

.dropdown-item-custom:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.dropdown-item-custom i {
    font-size: 0.8rem;
    margin-right: 10px;
    opacity: 0.7;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-footer a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    display: bock;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.05);
    text-align: center;
}

.sidebar-footer a:hover {
    background: var(--danger-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(231, 74, 59, 0.3);
}

/* --- Main Content Area --- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

/* Premium Cards */
.card-modern {
    background: var(--bg-card);
    border: none;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    position: relative;
    height: 100%;
}

.card-modern:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.card-bg-icon {
    position: absolute;
    right: -20px;
    bottom: -20px;
    font-size: 8rem;
    opacity: 0.05;
    transform: rotate(-15deg);
    pointer-events: none;
}

.stat-card {
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

.stat-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
    line-height: 1.2;
}

/* Card Variants */
.bg-gradient-primary {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #1cc88a 0%, #13855c 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #36b9cc 0%, #258391 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #f6c23e 0%, #dda20a 100%);
}

/* Chart Containers */
.chart-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    height: 100%;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.1rem;
    margin: 0;
}

.card-chart-container {
    position: relative;
    width: 100%;
    height: 350px;
    /* Adjust height as needed */
}

/* Mobile Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        backdrop-filter: blur(2px);
    }


}


/* --- Premium Page Headers --- */
.page-header-gradient {
    background: linear-gradient(135deg, #4e73df 0%, #2e59d9 100%);
    padding: 2rem;
    border-radius: 16px;
    color: white;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(78, 115, 223, 0.2);
}

.page-header-gradient::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 2.24 5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 2.24 5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.6;
    pointer-events: none;
}

/* --- Premium Stats Cards --- */
.stat-card-custom {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
    border-left: 4px solid var(--primary-color);
}

.stat-card-custom:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #858796;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.stat-val {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2e384d;
}

/* --- Glassmorphism Filter Bar --- */
.filter-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-top: -30px;
    /* Overlap with header */
    position: relative;
    z-index: 10;
}

/* --- Premium Tables --- */
.table-custom {
    border-collapse: separate;
    border-spacing: 0 6px;
    /* Row spacing */
}

.table-custom thead th {
    border: none;
    background: transparent;
    font-size: 0.8rem;
    color: #858796;
    text-transform: uppercase;
    font-weight: 600;
    padding-bottom: 1rem;
}

.table-custom tbody tr {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.table-custom tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    z-index: 1;
    position: relative;
}

.table-custom td {
    border: none;
    padding: 1rem;
    vertical-align: middle;
}

.table-custom td:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.table-custom td:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

/* --- Avatars & Badges --- */
.avatar-initial {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    /* Soft square */
    background-color: #f8f9fc;
    color: #4e73df;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.avatar-circle-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.badge-soft {
    background-color: rgba(62, 102, 251, 0.1);
    color: #3e66fb;
    border: 1px solid rgba(62, 102, 251, 0.2);
    padding: 0.4em 0.8em;
    border-radius: 8px;
    font-weight: 500;
}

.badge-dept {
    background-color: rgba(54, 185, 204, 0.1);
    color: #36b9cc;
    border: 1px solid rgba(54, 185, 204, 0.2);
}