@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap');

:root {
    --primary: #990000;
    --primary-hover: #800000;
    --primary-light: #fee2e2;
    --secondary: #d97706;
    --primary-gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --dark: #1e2229;
    --light: #f3f4f6;
    --border: #e5e7eb;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --success: #15803d;
    --warning: #b45309;
    --danger: #b91c1c;
    --sidebar-width: 240px;
    --font-family: 'Inter', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: #f8f9fa;
    color: var(--text-main);
    margin: 0;
    overflow-x: hidden;
}

/* Header - Modern Gradient & Glassmorphism */
.top-header {
    background: var(--primary-gradient);
    height: 60px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 101;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    backdrop-filter: blur(10px);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo-flag {
    display: flex;
    gap: 4px;
    align-items: center;
}

.brand-text {
    line-height: 1.2;
}

.brand-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 0;
    color: #fff;
}

.brand-subtitle {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    margin: 0;
}

/* Sidebar - Phong cách tối giản xám đen */
.sidebar {
    position: fixed;
    top: 53px;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    background-color: var(--dark);
    color: #94a3b8;
    z-index: 100;
    transition: all 0.3s ease;
    border-right: 1px solid rgba(255,255,255,0.05);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar-menu {
    padding: 10px 0;
    list-style: none;
    margin: 0;
}

.sidebar-menu li {
    position: relative;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14.5px 20px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    transition: all 0.2s ease;
}

.sidebar-menu a:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.06);
}

.sidebar-menu li.active > a {
    color: #fff;
    background-color: var(--primary);
    font-weight: 600;
}

/* Submenu default styling (Accordion when expanded) */
.sidebar-submenu {
    list-style: none;
    padding-left: 0;
    margin: 0;
    background-color: rgba(0,0,0,0.15);
    display: none; /* Collapsed by default, toggled via JS */
}

.sidebar-submenu a {
    display: flex;
    align-items: center;
    padding: 12px 20px 12px 35px !important;
    font-size: 13px !important;
    color: #cbd5e1 !important;
    border-bottom: none !important;
    transition: all 0.2s ease;
}

.sidebar-submenu a:hover {
    color: #fff !important;
    background-color: rgba(255,255,255,0.04) !important;
}

.sidebar-submenu li.active a {
    color: #fff !important;
    background-color: rgba(255,255,255,0.08) !important;
    font-weight: 600;
}

.submenu-title {
    display: none; /* Only visible in collapsed sidebar popup */
    padding: 11px 16px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background-color: #14171d;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Submenu Arrow rotation */
.submenu-arrow {
    transition: transform 0.2s ease;
}
.sidebar-item.open .submenu-arrow {
    transform: rotate(180deg);
}

/* Collapsed state for sidebar */
body.sidebar-collapsed .sidebar {
    width: 65px;
    overflow: visible !important;
}
body.sidebar-collapsed .main-content {
    margin-left: 65px;
}
body.sidebar-collapsed .sidebar-menu > li > a > span,
body.sidebar-collapsed .sidebar-menu > li > a > .submenu-arrow {
    display: none !important;
}

/* Floating popup submenu when collapsed */
body.sidebar-collapsed .sidebar-item {
    position: relative;
}
body.sidebar-collapsed .sidebar-submenu {
    position: absolute;
    left: 65px;
    top: 0;
    width: 220px;
    background-color: var(--dark);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 5px 5px 15px rgba(0,0,0,0.3);
    display: none !important;
    z-index: 1050;
}
body.sidebar-collapsed .sidebar-item:hover .sidebar-submenu {
    display: block !important;
}
body.sidebar-collapsed .submenu-title {
    display: block;
}
body.sidebar-collapsed .sidebar-submenu a {
    padding: 8px 16px !important;
    justify-content: flex-start !important;
}

/* Icon adjustments when collapsed */
body.sidebar-collapsed .sidebar-menu a {
    justify-content: center;
    padding: 14.5px 0;
}
body.sidebar-collapsed .sidebar-menu a i:first-child {
    font-size: 16px;
    margin: 0;
}

/* Tabbed Interface - Dưới Header */
.tabs-bar {
    background-color: #f3f4f6;
    border-bottom: 1px solid #d1d5db;
    padding: 4px 10px 0 10px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden; /* Hide vertical scrollbars */
    white-space: nowrap;
    position: sticky;
    top: 53px;
    z-index: 99;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.tab-item {
    background-color: #e5e7eb;
    border: 1px solid #d1d5db;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    padding: 6px 12px;
    font-size: 12px;
    color: #4b5563;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-item:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.tab-item.active {
    background-color: #fff;
    color: var(--primary);
    font-weight: 600;
    border-top: 3px solid var(--primary);
    margin-bottom: -1px;
    position: relative;
    z-index: 2;
}

.tab-close {
    font-size: 10px;
    color: #9ca3af;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-close:hover {
    background-color: rgba(0,0,0,0.1);
    color: #374151;
}

.tab-close-all {
    position: sticky;
    right: 0;
    margin-left: auto;
    background-color: #f3f4f6;
    color: #ef4444;
    padding: 6px 12px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    border: 1px solid #d1d5db;
    border-bottom: none;
    box-shadow: -2px 0 5px rgba(0,0,0,0.05);
    z-index: 10;
    transition: all 0.2s;
}

.tab-close-all:hover {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Main Area */
.main-content {
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
    min-height: calc(100vh - 53px);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}

/* Breadcrumb kiểu chính phủ */
.custom-breadcrumb {
    background-color: #fff;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: #4b5563;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.breadcrumb-path {
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-path a {
    color: var(--text-muted);
    text-decoration: none;
}

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

/* Search Box góc trên phải bảng */
.table-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-action-red {
    background-color: var(--primary);
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-action-red:hover {
    background-color: var(--primary-hover);
    color: #fff;
}

.btn-action-outline {
    background-color: #fff;
    color: #374151;
    border: 1px solid var(--border);
    padding: 6px 16px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-action-outline:hover {
    background-color: #f3f4f6;
}

/* Giao diện Bảng (Table) kiểu Hành chính */
.table-premium {
    width: 100%;
    background-color: #fff;
    border: 1px solid var(--border);
    border-collapse: collapse;
}

.table-premium th {
    background-color: #f3f4f6;
    color: #374151;
    font-weight: 600;
    font-size: 12.5px;
    padding: 12px 10px;
    border: 1px solid var(--border);
    text-align: left;
}

.table-premium td {
    padding: 12px 10px;
    font-size: 13px;
    color: #1f2937;
    border: 1px solid var(--border);
    background-color: #fff;
}

.table-premium tr:nth-child(even) td {
    background-color: #f9fafb;
}

.table-premium tr:hover td {
    background-color: #f3f4f6;
}

.table-filter-row input, .table-filter-row select {
    width: 100%;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* Thẻ Dashboard (Modern Card Style) & Global Card Override */
.card-admin-dashboard, .card {
    background-color: #fff;
    border-radius: 12px !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03) !important;
    margin-bottom: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-admin-dashboard:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08) !important;
}

.card-admin-header, .card-header {
    padding: 16px 20px !important;
    font-size: 15px;
    font-weight: 700;
    color: var(--page-title-color) !important;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top-left-radius: 12px !important;
    border-top-right-radius: 12px !important;
    background-color: rgba(0,0,0,0.01) !important;
}

.card-admin-body, .card-body {
    padding: 20px !important;
}

/* Khối thống kê chỉ số trong Card */
.stat-item-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    border-left: 4px solid #9ca3af;
}

.stat-item-block:hover {
    transform: translateX(3px);
}

.stat-item-blue { background-color: #eff6ff; color: #1e40af; border-left-color: #3b82f6; }
.stat-item-yellow { background-color: #fef3c7; color: #92400e; border-left-color: #f59e0b; }
.stat-item-red { background-color: #fef2f2; color: #991b1b; border-left-color: #ef4444; }
.stat-item-pink { background-color: #fdf2f8; color: #9d174d; border-left-color: #ec4899; }
.stat-item-purple { background-color: #faf5ff; color: #6b21a8; border-left-color: #a855f7; }
.stat-item-green { background-color: #f0fdf4; color: #166534; border-left-color: #22c55e; }
.stat-item-grey { background-color: #f3f4f6; color: #374151; border-left-color: #9ca3af; }

.stat-number {
    font-size: 18px;
    font-weight: 700;
}

/* Thẻ lưới (Image 5 right columns) */
.grid-stat-box {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.grid-stat-icon {
    font-size: 20px;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-stat-info {
    flex-grow: 1;
}

.grid-stat-title {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

.grid-stat-count {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

/* Đăng nhập kiểu mới (Image 2 style) */
.gov-login-bg {
    background: #fdfbf7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    font-family: var(--font-family);
}

.gov-login-top {
    height: 120px;
    background: linear-gradient(180deg, #fef08a 0%, #fdfbf7 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid #fef08a;
}

.gov-login-middle {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.gov-login-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.gov-login-card-header {
    text-align: center;
    margin-bottom: 30px;
}

.gov-login-flag {
    width: 60px;
    height: 40px;
    margin: 0 auto 15px auto;
}

.gov-login-card-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    text-transform: uppercase;
}

.gov-login-card-subtitle {
    font-size: 15px;
    color: var(--primary);
    font-weight: 700;
    margin: 5px 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gov-login-card .form-label {
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
}

.gov-login-card .form-control {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 14px;
}

.gov-login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(153, 0, 0, 0.15);
}

.btn-gov-red {
    background-color: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 12px;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.2s;
    width: 100%;
}

.btn-gov-red:hover {
    background-color: var(--primary-hover);
    color: #fff;
}

.btn-gov-vneid {
    background-color: #fff;
    color: #111827;
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 10px;
    font-weight: 600;
    font-size: 13.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    transition: all 0.2s;
}

.btn-gov-vneid:hover {
    background-color: #fff5f5;
}

/* Gov login footer (Image 2 bottom red banner) */
.gov-login-footer {
    background: linear-gradient(90deg, #990000 0%, #b91c1c 100%);
    color: #fff;
    padding: 30px 40px;
    font-size: 12px;
    border-top: 4px solid #facc15;
}

.gov-footer-info {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.gov-footer-left {
    max-width: 500px;
}

.gov-footer-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.qr-code-box {
    text-align: center;
}

.qr-code-img {
    width: 80px;
    height: 80px;
    background-color: #fff;
    padding: 4px;
    border-radius: 4px;
}

/* Responsive sidebar */
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    .sidebar.show {
        margin-left: 0;
    }
    .main-content {
        margin-left: 0;
    }
}

/* Custom Dark Premium Dropdown Menu */
.user-profile .dropdown-toggle::after {
    display: none !important;
}

.user-profile .dropdown-menu {
    background-color: #1e2229 !important; /* Matches dark sidebar */
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 8px !important;
    padding: 8px 0 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3) !important;
}

.user-profile .dropdown-item {
    color: #cbd5e1 !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    padding: 8px 20px !important;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    text-align: left;
}

.user-profile .dropdown-item:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.06) !important;
}

.user-profile .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.08) !important;
    margin: 6px 0 !important;
}

/* Rotate gear icon on hover */
.hover-rotate {
    transition: transform 0.3s ease;
}
.user-profile:hover .hover-rotate {
    transform: rotate(45deg);
}

/* ==========================================================================
   Table Grayscale Badges Policy (User Request: 2026-06-25)
   Remove background colors & make text dark grayscale for non-status badges inside tables
   ========================================================================== */
.table td .badge:not(.badge-status),
.table-premium td .badge:not(.badge-status),
.datatable-premium td .badge:not(.badge-status) {
    background-color: transparent !important;
    background: none !important;
    border: none !important;
    color: #1f2937 !important; /* Elegant dark charcoal text */
    padding: 0 !important;
    font-size: 13px !important; /* Align with standard cell text size */
    font-weight: 500 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Ensure font awesome icons in plain badges have decent spacing */
.table td .badge:not(.badge-status) i,
.table-premium td .badge:not(.badge-status) i {
    margin-right: 4px;
}

.text-theme { color: var(--primary) !important; }
.bg-theme { background: var(--primary-gradient) !important; color: white !important; }

/* Global Form Control Overrides */
.form-control, .form-select {
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

/* Global Button Overrides */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Global Theme Overrides for Typography */
.form-control, .form-select, .form-label, .small, small {
    font-size: var(--global-font-size) !important;
}

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

.btn-outline-secondary {
    border-color: var(--border);
    color: var(--text-main);
}
.btn-outline-secondary:hover {
    background-color: var(--border);
    color: var(--text-main);
}

