/* ==========================================================================
   CSS VARIABLE DECLARATIONS & SYSTEM STYLES
   ========================================================================== */
:root {
    /* Color Palette */
    --primary-color: #0B2240;      /* Trang trọng: Xanh navy đậm cho Bộ Tài chính */
    --primary-light: #16365C;     /* Navy sáng hơn */
    --primary-dark: #07172C;      /* Navy tối */
    --accent-color: #E5A93C;      /* Vàng Gold - tăng độ trang trọng */
    --red-accent: #DA251D;        /* Đỏ cờ Tổ quốc cho badge, cảnh báo, trạng thái */
    
    /* Interactive Colors */
    --btn-blue: #2563EB;          /* Royal blue cho button active/chính */
    --btn-blue-hover: #1D4ED8;
    
    /* Neutral & Backgrounds */
    --bg-color: #F3F4F6;          /* Màu nền chính nhạt mát mẻ */
    --card-bg: #FFFFFF;           /* Nền trắng cho panel, card */
    --border-color: #E5E7EB;      /* Màu viền */
    --text-main: #1F2937;         /* Màu chữ chính */
    --text-muted: #6B7280;        /* Màu chữ phụ, chú thích */
    
    /* Alert Statuses */
    --status-success: #10B981;    /* Xanh lá cho mức tăng/giảm tích cực */
    --status-error: #EF4444;      /* Đỏ cho mức giảm */
    --status-warning: #F59E0B;
    
    /* Layout Configurations */
    --header-height: 70px;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    
    /* Typography & Shadows */
    --font-ui: 'Be Vietnam Pro', -apple-system, sans-serif;
    --font-heading: 'Be Vietnam Pro', 'Montserrat', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition-speed: 0.3s;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: var(--font-ui);
    cursor: pointer;
    border: none;
    background: none;
}

input, select, textarea {
    font-family: var(--font-ui);
    outline: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================================================
   HEADER DESIGN
   ========================================================================== */
.app-header {
    height: var(--header-height);
    background-color: var(--primary-color);
    border-top: 3px solid var(--accent-color);
    box-shadow: var(--shadow-md);
    color: #FFFFFF;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-container {
    display: flex;
    align-items: center;
}

.state-logo {
    filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.25));
    transition: transform var(--transition-speed);
}

.state-logo:hover {
    transform: scale(1.05);
}

.header-title {
    display: flex;
    flex-direction: column;
}

.agency-name {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--accent-color);
    text-transform: uppercase;
}

.system-name {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #FFFFFF;
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Action Buttons & Dropdowns */
.header-action {
    position: relative;
}

.icon-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

.icon-btn .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: var(--red-accent);
    color: white;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary-color);
    padding: 0 2px;
}

.divider {
    width: 1px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.15);
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.user-profile:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.user-avatar-wrapper {
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.status-indicator.online {
    background-color: var(--status-success);
}

.user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
}

.user-role {
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.7);
}

.chevron-icon {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

/* Dropdown Panel */
.dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 1100;
    animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-panel.show {
    display: block;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Notification Panel Specifics */
.notification-panel {
    width: 380px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.mark-all-read {
    font-size: 11.5px;
    color: var(--btn-blue);
    font-weight: 500;
}

.mark-all-read:hover {
    text-decoration: underline;
}

.notification-list {
    list-style: none;
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: background-color 0.2s;
}

.notification-item:hover {
    background-color: #F9FAFB;
}

.notification-item.unread {
    background-color: #EFF6FF;
}

.notification-item.unread .dot {
    width: 8px;
    height: 8px;
    background-color: var(--btn-blue);
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.notif-content p {
    font-size: 12.5px;
    color: var(--text-main);
    margin-bottom: 4px;
}

.notif-time {
    font-size: 10.5px;
    color: var(--text-muted);
}

.panel-footer {
    padding: 12px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background-color: #F9FAFB;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.panel-footer a {
    font-size: 13px;
    color: var(--btn-blue);
    font-weight: 500;
}

/* User Panel Specifics */
.user-panel {
    width: 220px;
    overflow: hidden;
}

.user-menu-list {
    list-style: none;
    padding: 6px 0;
}

.user-menu-list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-main);
    transition: background-color 0.2s;
}

.user-menu-list li a:hover {
    background-color: #F3F4F6;
}

.user-menu-list li a i {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 6px 0;
}

.logout-btn {
    color: var(--red-accent) !important;
}

.logout-btn i {
    color: var(--red-accent) !important;
}

/* ==========================================================================
   LAYOUT STRUCTURE (Sidebar & Main Container)
   ========================================================================== */
.app-layout {
    display: flex;
    flex: 1;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height) - 60px); /* 60px footer */
}

/* ==========================================================================
   SIDEBAR DESIGN
   ========================================================================== */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: #FFFFFF;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-height);
    bottom: 60px; /* footer height */
    left: 0;
    z-index: 900;
    transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
}

/* Toggle Control */
.sidebar-toggle-container {
    display: flex;
    justify-content: flex-end;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    background-color: #FAFBFD;
}

.toggle-sidebar-btn {
    width: 28px;
    height: 28px;
    background-color: #FFFFFF;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.toggle-sidebar-btn:hover {
    color: var(--primary-color);
    background-color: #F1F5F9;
    border-color: #CBD5E1;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.menu-groups {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Menu Group Header & links */
.menu-group-item {
    display: flex;
    flex-direction: column;
}

.menu-link, .menu-group-header {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    font-size: 13.5px;
    font-weight: 500;
    color: #4B5563;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}

.menu-link i, .menu-group-header i:first-child {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    color: #6B7280;
    flex-shrink: 0;
    transition: color 0.2s;
}

.menu-text {
    flex: 1;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s;
}

.group-chevron {
    width: 14px;
    height: 14px;
    color: #9CA3AF;
    transition: transform var(--transition-speed);
}

/* Hover & Active States */
.menu-link:hover, .menu-group-header:hover {
    background-color: #F3F4F6;
    color: var(--primary-color);
}

.menu-link:hover i, .menu-group-header:hover i:first-child {
    color: var(--primary-color);
}

.menu-group-item.active > .menu-link,
.menu-group-item.active > .menu-group-header {
    background-color: #EFF6FF;
    color: var(--primary-color);
    font-weight: 600;
    border-left-color: var(--btn-blue);
}

.menu-group-item.active > .menu-link i,
.menu-group-item.active > .menu-group-header i:first-child {
    color: var(--btn-blue);
}

/* Expanded group sub-menu */
.sub-menu {
    list-style: none;
    padding-left: 0;
    background-color: #F8FAFC;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.menu-group-item.expanded .sub-menu {
    max-height: 250px;
}

.menu-group-item.expanded .group-chevron {
    transform: rotate(180deg);
}

.sub-menu li {
    position: relative;
}

.sub-menu-link {
    display: flex;
    align-items: center;
    padding: 10px 18px 10px 36px;
    font-size: 12.5px;
    font-weight: 500;
    color: #6B7280;
    transition: all 0.2s;
}

.sub-menu-link .bullet {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #D1D5DB;
    margin-right: 12px;
    flex-shrink: 0;
}

.sub-menu-link:hover {
    color: var(--primary-color);
    background-color: #F1F5F9;
}

.sub-menu-link:hover .bullet {
    background-color: var(--primary-color);
}

.sub-menu li.active .sub-menu-link {
    color: var(--btn-blue);
    background-color: #E0F2FE;
    font-weight: 600;
}

.sub-menu li.active .sub-menu-link .bullet {
    background-color: var(--btn-blue);
    transform: scale(1.4);
}

/* ==========================================================================
   COLLAPSED SIDEBAR STATES (Responsive Sidebar)
   ========================================================================== */
.app-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.app-sidebar.collapsed .menu-text,
.app-sidebar.collapsed .group-chevron,
.app-sidebar.collapsed .sub-menu {
    display: none;
    opacity: 0;
}

.app-sidebar.collapsed .menu-link,
.app-sidebar.collapsed .menu-group-header {
    justify-content: center;
    padding: 12px 0;
}

.app-sidebar.collapsed .menu-link i,
.app-sidebar.collapsed .menu-group-header i:first-child {
    margin-right: 0;
}

.app-sidebar.collapsed .sidebar-toggle-container {
    justify-content: center;
}

/* ==========================================================================
   MAIN CONTENT AREA DESIGN
   ========================================================================== */
.app-main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.app-sidebar.collapsed + .app-main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    font-size: 12.5px;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 4px;
}

.breadcrumbs a {
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--primary-color);
}

.bc-separator {
    color: #D1D5DB;
    margin: 0 4px;
}

.bc-active {
    color: var(--primary-color);
    font-weight: 500;
}

/* Page Title Section */
.page-title-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-btn {
    width: 36px;
    height: 36px;
    background-color: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.back-btn:hover {
    color: var(--primary-color);
    background-color: #F8FAFC;
    border-color: #CBD5E1;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.page-subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================================================
   CARDS COMMON DESIGN
   ========================================================================== */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.title-icon {
    width: 18px;
    height: 18px;
    color: var(--primary-light);
}

/* ==========================================================================
   FILTER CARD & MULTI-SELECT DESIGN
   ========================================================================== */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-item.full-width {
    grid-column: span 4;
}

.filter-item.span-2 {
    grid-column: span 2;
}

.filter-item label {
    font-size: 12px;
    font-weight: 600;
    color: #4B5563;
}

/* Standard Inputs & Selects */
.form-control {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    font-size: 13px;
    background-color: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    color: var(--text-main);
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--btn-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Custom dropdown style wrapper */
.custom-select-wrapper {
    position: relative;
}

/* Multi-select tag system (Crucial Change for Multi-item Selection) */
.multi-select-container {
    position: relative;
    width: 100%;
}

.select-box {
    min-height: 38px;
    padding: 4px 36px 4px 10px;
    background-color: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.select-box:hover {
    border-color: #94A3B8;
}

.select-box .placeholder {
    font-size: 13px;
    color: #9CA3AF;
    user-select: none;
}

.select-box .dropdown-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: transform 0.2s;
}

/* Selected item Tag styling */
.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag {
    background-color: #EFF6FF;
    color: var(--btn-blue);
    border: 1px solid #BFDBFE;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: tagAppear 0.15s ease-out;
}

@keyframes tagAppear {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.tag .remove-tag-btn {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #60A5FA;
    transition: all 0.15s;
}

.tag .remove-tag-btn:hover {
    background-color: #DBEAFE;
    color: var(--btn-blue);
}

.tag .remove-tag-btn svg {
    width: 10px;
    height: 10px;
}

/* Options dropdown panel for filter selection */
.options-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background-color: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 950;
    max-height: 260px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.options-panel.hidden {
    display: none;
}

.option-search-box {
    position: relative;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    background-color: #F9FAFB;
}

.option-search-box input {
    width: 100%;
    height: 32px;
    padding: 0 10px 0 32px;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    font-size: 12.5px;
}

.option-search-box .search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.options-list {
    overflow-y: auto;
    max-height: 200px;
    padding: 4px 0;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.option-item:hover {
    background-color: #F3F4F6;
}

.option-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--btn-blue);
    cursor: pointer;
}

.option-item .option-label {
    flex: 1;
    user-select: none;
}

/* Chart type selector styling */
.chart-type-selector {
    display: flex;
    background-color: #F3F4F6;
    padding: 3px;
    border-radius: 6px;
    height: 38px;
}

.type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 4px;
    transition: all 0.2s;
}

.type-btn i {
    width: 16px;
    height: 16px;
}

.type-btn:hover {
    color: var(--primary-color);
}

.type-btn.active {
    background-color: var(--btn-blue);
    color: #FFFFFF;
    box-shadow: var(--shadow-sm);
}

/* Dynamic Comparison Pills row */
.active-comparisons-row {
    margin-top: 14px;
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.active-comparisons-row .label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.comparison-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.comp-pill {
    background-color: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 11.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.comp-pill::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-indicator, var(--btn-blue));
    display: inline-block;
}

.comp-pill .close-pill-btn {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    transition: all 0.15s;
}

.comp-pill .close-pill-btn:hover {
    background-color: #F1F5F9;
    color: var(--red-accent);
}

.comp-pill .close-pill-btn svg {
    width: 8px;
    height: 8px;
}

/* ==========================================================================
   CHART CARD CONTAINER DESIGN
   ========================================================================== */
.chart-card-container {
    padding: 20px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.chart-info {
    display: flex;
    flex-direction: column;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

.chart-subtitle {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.chart-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chart-action-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background-color: #FFFFFF;
    color: var(--text-muted);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chart-action-btn:hover {
    color: var(--primary-color);
    background-color: #F9FAFB;
    border-color: #CBD5E1;
}

.chart-action-btn i {
    width: 15px;
    height: 15px;
}

/* Primary Export Action button style */
.primary-action-btn {
    width: auto;
    padding: 0 12px;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    background-color: #FFFFFF;
}

.export-dropdown-wrapper {
    position: relative;
}

.export-panel {
    width: 200px;
    right: 0;
}

.export-panel ul {
    list-style: none;
    padding: 4px 0;
}

.export-panel ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 12.5px;
    color: var(--text-main);
    transition: background-color 0.15s;
}

.export-panel ul li a:hover {
    background-color: #F3F4F6;
    color: var(--primary-color);
}

.export-panel ul li a i {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.chart-wrapper {
    position: relative;
    height: 400px;
    width: 100%;
}

/* ==========================================================================
   DATA GRID TABLE DESIGN
   ========================================================================== */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
    padding-bottom: 10px;
}

.table-header .card-title {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.search-table-wrapper {
    position: relative;
    width: 240px;
}

.search-table-wrapper input {
    width: 100%;
    height: 32px;
    padding: 0 10px 0 32px;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    font-size: 12px;
}

.search-table-wrapper .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.data-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-grid th {
    background-color: #F8FAFC;
    color: #475569;
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-grid td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    background-color: #FFFFFF;
    transition: background-color 0.15s;
}

.data-grid tbody tr:last-child td {
    border-bottom: none;
}

.data-grid tbody tr:hover td {
    background-color: #F1F5F9;
}

/* Trend badge styling */
.trend-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 11.5px;
    padding: 2px 6px;
    border-radius: 4px;
}

.trend-up {
    color: var(--status-success);
    background-color: #ECFDF5;
}

.trend-down {
    color: var(--status-error);
    background-color: #FEF2F2;
}

.trend-nochange {
    color: var(--text-muted);
    background-color: #F3F4F6;
}

/* Pagination design */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 12.5px;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pag-btn {
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    background-color: #FFFFFF;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.pag-btn:hover:not(:disabled) {
    background-color: #F3F4F6;
    border-color: #CBD5E1;
}

.pag-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 4px;
}

.page-num {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background-color: #FFFFFF;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.page-num:hover:not(.active) {
    background-color: #F3F4F6;
}

.page-num.active {
    background-color: var(--btn-blue);
    color: #FFFFFF;
    border-color: var(--btn-blue);
}

/* ==========================================================================
   FOOTER DESIGN
   ========================================================================== */
.app-footer {
    background-color: #1E293B;   /* Slate 800 - Đậm đà, sạch sẽ */
    color: rgba(255, 255, 255, 0.7);
    padding: 16px 24px;
    width: 100%;
    margin-top: auto;
    font-size: 12px;
    position: relative;
    z-index: 100;
}

.footer-top-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--accent-color);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.footer-copyright {
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 2px;
}

.footer-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.info-divider {
    color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   RESPONSIVE DESIGN ADAPTATIONS
   ========================================================================== */
@media (max-width: 1200px) {
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .filter-item.full-width,
    .filter-item.span-2 {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    
    .app-sidebar {
        position: relative;
        width: 100% !important;
        height: auto;
        bottom: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .app-sidebar.collapsed {
        display: none; /* Hide sidebar completely when collapsed on mobile */
    }
    
    .app-main-content {
        margin-left: 0 !important;
        padding: 16px;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    .filter-item.full-width,
    .filter-item.span-2 {
        grid-column: span 1;
    }
    
    .header-title {
        display: none; /* Hide text logo on mobile screen sizes */
    }
    
    .footer-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .footer-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .info-divider {
        display: none;
    }
}

/* ==========================================================================
   CUSTOM DATE PICKER STYLES
   ========================================================================== */
.custom-date-row {
    display: flex;
    gap: 16px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--border-color);
    animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-date-row.hidden {
    display: none !important;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    max-width: 250px;
}

.date-input-group label {
    font-size: 12px;
    font-weight: 600;
    color: #4B5563;
}

.date-input-wrapper {
    position: relative;
    width: 100%;
}

.date-input-wrapper .form-control {
    padding-right: 38px;
}

.date-input-wrapper .calendar-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 5;
}

.date-input-wrapper .native-date-helper {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 576px) {
    .custom-date-row {
        flex-direction: column;
        gap: 12px;
    }
    .date-input-group {
        max-width: 100%;
    }
}

/* ==========================================================================
   TREE SELECT STYLING
   ========================================================================== */
.tree-group {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
}

.tree-group:last-child {
    border-bottom: none;
}

.tree-node-parent {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background-color: #F8FAFC;
    font-weight: 600;
    font-size: 13px;
    color: var(--primary-color);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s;
}

.tree-node-parent:hover {
    background-color: #F1F5F9;
}

.tree-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-group.collapsed .tree-chevron {
    transform: rotate(-90deg);
}

.tree-group.collapsed .tree-children {
    display: none;
}

.tree-children {
    display: flex;
    flex-direction: column;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
    margin-left: 22px;
    margin-top: 4px;
    margin-bottom: 6px;
}

.tree-node-child {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 12.5px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.tree-node-child:hover {
    background-color: #F3F4F6;
    border-radius: 4px;
}

.tree-node-child input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--btn-blue);
    cursor: pointer;
}

.tree-node-child .option-label {
    flex: 1;
    user-select: none;
}

/* ==========================================================================
   COMBINED VIEW CARD & TAB SWITCHER STYLES
   ========================================================================== */
.view-card {
    padding: 0 !important; /* Loại bỏ padding ngoài rìa để tab căng tràn */
    overflow: hidden;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #F8FAFC;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.view-toggle-selector {
    display: flex;
    background-color: #E2E8F0;
    padding: 3px;
    border-radius: 8px;
    gap: 2px;
}

.view-tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    border-radius: 6px;
    transition: all 0.2s;
}

.view-tab-btn:hover {
    color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.5);
}

.view-tab-btn.active {
    background-color: #FFFFFF;
    color: var(--btn-blue);
    box-shadow: var(--shadow-sm);
}

.view-tab-btn i {
    width: 14px;
    height: 14px;
}

.view-content-wrapper {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.view-content-wrapper.hidden {
    display: none !important;
}

/* Price Type tags in Table */
.price-type-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
}

.price-type-tag.avg {
    background-color: #EFF6FF;
    color: #2563EB;
    border-color: #BFDBFE;
}

.price-type-tag.min {
    background-color: #ECFDF5;
    color: #059669;
    border-color: #A7F3D0;
}

.price-type-tag.max {
    background-color: #FFFBEB;
    color: #D97706;
    border-color: #FDE68A;
}

/* Zoom controls visibility */
.chart-zoom-controls {
    display: flex;
    gap: 6px;
}

.chart-zoom-controls.hidden {
    display: none !important;
}

/* Hide export chart options in table mode */
.export-panel.table-mode .export-chart-only {
    display: none !important;
}

.chart-info-bar {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.chart-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

.chart-card-subtitle {
    font-size: 11.5px;
    color: var(--text-muted);
}

.table-actions-row {
    display: flex;
    justify-content: flex-start;
}

#chartViewWrapper .active-comparisons-row {
    border-top: none;
    padding-top: 0;
    margin-top: 6px;
    margin-bottom: 12px;
}

.compare-actions-wrapper {
    position: relative;
    margin-left: 12px;
}

.compare-panel {
    width: 250px;
    left: 0;
    right: auto;
}

.compare-panel ul {
    list-style: none;
    padding: 4px 0;
}

.compare-panel ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 12.5px;
    color: var(--text-main);
    transition: background-color 0.15s;
}

.compare-panel ul li:hover a {
    background-color: #F3F4F6;
    color: var(--primary-color);
}

.compare-panel ul li.active a {
    font-weight: 600;
    color: var(--btn-blue);
}

.compare-panel ul li a i {
    width: 14px;
    height: 14px;
}

.compare-panel ul li .check-icon-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    visibility: hidden;
}

.compare-panel ul li.active .check-icon-placeholder {
    visibility: visible;
}

.text-success {
    color: var(--status-success) !important;
}

.text-danger {
    color: var(--status-error) !important;
}

.chart-action-btn.active-compare {
    background-color: #EFF6FF;
    border-color: #BFDBFE;
    color: var(--btn-blue);
    font-weight: 600;
}

.trend-warning {
    color: #D97706 !important;
    background-color: #FEF3C7 !important;
    border: 1px solid #FCD34D !important;
}

/* Tooltip styling */
.custom-tooltip {
    position: relative;
    cursor: help;
}

.custom-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background-color: #0F172A;
    color: #FFFFFF;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 100;
    pointer-events: none;
}

.custom-tooltip::before {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border-width: 5px;
    border-style: solid;
    border-color: #0F172A transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 100;
    pointer-events: none;
}

.custom-tooltip:hover::after,
.custom-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   COMMON FILTER BUTTONS AND ACTION ROW
   ========================================================================== */
.filter-actions-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 16px;
    gap: 12px;
    width: 100%;
}

.btn-primary-custom {
    height: 36px;
    padding: 0 16px;
    border-radius: 6px;
    background-color: var(--btn-blue);
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    border: none;
    cursor: pointer;
}

.btn-primary-custom:hover {
    background-color: var(--btn-blue-hover);
}

.btn-secondary-custom {
    height: 36px;
    padding: 0 16px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: #FFFFFF;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-secondary-custom:hover {
    background-color: #F9FAFB;
    border-color: #CBD5E1;
    color: var(--primary-color);
}

