/* Base Styles & Variables */
:root {
    /* Colors based on modern dashboard aesthetic */
    --bg-main: #F4F7FE;
    --bg-sidebar: #1C1E2F;
    --sidebar-text: #8E9BB0;
    --sidebar-text-hover: #FFFFFF;
    --sidebar-active-bg: #635BFF;
    
    --card-bg: #FFFFFF;
    --text-main: #2B3674;
    --text-muted: #A3AED0;
    
    --primary: #4318FF;
    --success: #05CD99;
    --warning: #FFCE20;
    --danger: #EE5D50;
    
    --border-color: #E9EDF7;
    
    /* Shadows */
    --shadow-soft: 0px 18px 40px rgba(112, 144, 176, 0.12);
    --shadow-sm: 0px 4px 12px rgba(112, 144, 176, 0.08);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-header .logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #635BFF, #4318FF);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.sidebar-header .title h2 {
    color: white;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-header .title span {
    font-size: 11px;
    color: var(--sidebar-text);
    letter-spacing: 0.5px;
}

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

/* Tùy chỉnh thanh cuộn cho sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.nav-section {
    font-size: 11px;
    font-weight: 600;
    color: #6C7A9C;
    margin-top: 24px;
    margin-bottom: 8px;
    padding-left: 12px;
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    margin-bottom: 4px;
    transition: all 0.3s ease;
}

.nav-item i {
    width: 24px;
    font-size: 16px;
    margin-right: 8px;
    opacity: 0.8;
}

.nav-item:hover {
    color: var(--sidebar-text-hover);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background-color: var(--sidebar-active-bg);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 91, 255, 0.3);
}

.nav-item.active i {
    opacity: 1;
}

.nav-item .badge {
    margin-left: auto;
    background-color: rgba(255,255,255,0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.status-item {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
}

.status-item.ok i {
    color: var(--success);
}

/* =========================================
   MAIN CONTENT
   ========================================= */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.top-header {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    height: 70px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.breadcrumb {
    color: var(--text-muted);
    font-size: 14px;
}

.breadcrumb span {
    color: var(--text-main);
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile .username {
    font-size: 14px;
    font-weight: 500;
}

.user-profile .avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.dashboard-wrapper {
    padding: 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* =========================================
   SYSTEM STATUS CARDS (Row)
   ========================================= */
.status-cards-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.status-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.status-card:hover {
    transform: translateY(-2px);
}

.status-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.status-icon.tg { background: rgba(36, 161, 222, 0.1); color: #24A1DE; }
.status-icon.sepay { background: rgba(5, 205, 153, 0.1); color: var(--success); }
.status-icon.db { background: rgba(67, 24, 255, 0.1); color: var(--primary); }
.status-icon.license { background: rgba(255, 206, 32, 0.1); color: #EAB308; }

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

.status-info .label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.status-info .value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}
.status-info .value.success { color: var(--success); }

/* =========================================
   KPI CARDS GRID
   ========================================= */
.kpi-cards-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0px 20px 40px rgba(112, 144, 176, 0.18);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.kpi-card.revenue .kpi-icon { background: rgba(5, 205, 153, 0.1); color: var(--success); }
.kpi-card.profit .kpi-icon { background: rgba(67, 24, 255, 0.1); color: var(--primary); }
.kpi-card.orders .kpi-icon { background: rgba(255, 152, 0, 0.1); color: #FF9800; }
.kpi-card.customers .kpi-icon { background: rgba(233, 30, 99, 0.1); color: #E91E63; }
.kpi-card.products .kpi-icon { background: rgba(0, 188, 212, 0.1); color: #00BCD4; }

.kpi-details h3 {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.kpi-trend {
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-trend.positive { color: var(--success); }
.kpi-trend.negative { color: var(--danger); }
.text-muted { color: var(--text-muted); }


/* =========================================
   REPORTS SECTION (Chart & Table)
   ========================================= */
.reports-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.report-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.report-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.chart-wrapper {
    width: 100%;
    height: 300px;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.modern-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.modern-table td {
    padding: 16px;
    font-size: 14px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

.modern-table tr:last-child td {
    border-bottom: none;
}

/* Badges & Buttons */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-warning { background: rgba(255, 206, 32, 0.15); color: #D97706; }
.badge-danger { background: rgba(238, 93, 80, 0.15); color: var(--danger); }

.btn-sm {
    background: rgba(67, 24, 255, 0.1);
    color: var(--primary);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-sm:hover {
    background: var(--primary);
    color: white;
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .kpi-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .reports-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .status-cards-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .sidebar {
        transform: translateX(-100%);
    }
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 600px) {
    .kpi-cards-grid {
        grid-template-columns: 1fr;
    }
    .status-cards-row {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   CUSTOMER MANAGEMENT
   ========================================= */
.customer-wrapper {
    padding: 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.page-header-stats {
    margin-bottom: 24px;
}

.stat-box {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px 24px;
    display: inline-flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    min-width: 250px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
}

.stat-value.highlight {
    color: var(--primary);
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    background: var(--card-bg);
    padding: 16px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-main);
    padding: 10px 16px;
    border-radius: 10px;
    flex: 1;
    max-width: 400px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--primary);
}

.search-box i {
    color: var(--text-muted);
    margin-right: 12px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--text-main);
    width: 100%;
    font-family: inherit;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.sort-box .modern-select {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    outline: none;
    font-family: inherit;
    cursor: pointer;
}

.customer-table th.text-right,
.customer-table td.text-right {
    text-align: right;
}

.user-info-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.bg-primary { background: var(--primary); }
.bg-success { background: var(--success); }
.bg-warning { background: var(--warning); }

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-main);
    margin-bottom: 2px;
}

.user-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-username {
    color: var(--primary);
    text-decoration: none;
}

.user-username:hover {
    text-decoration: underline;
}

.dot-separator {
    font-size: 10px;
    color: #D1D5DB;
}

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

.actions-cell {
    white-space: nowrap;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(163, 174, 208, 0.1);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(163, 174, 208, 0.2);
    color: var(--text-main);
}

.btn-icon.btn-view:hover { color: var(--primary); background: rgba(67, 24, 255, 0.1); }
.btn-icon.btn-edit-balance:hover { color: var(--success); background: rgba(5, 205, 153, 0.1); }
.btn-icon.btn-delete:hover { color: var(--danger); background: rgba(238, 93, 80, 0.1); }

