/* ============================================================
   TMG Admin Panel - 2026 Modern Dashboard Design System
   Inspired by modern hotel management SaaS dashboards
   ============================================================ */

/* --- CSS Variables / Design Tokens --- */
:root {
    --tmg-purple: #4b1853;
    --tmg-purple-light: #6b2d7b;
    --tmg-purple-50: rgba(75, 24, 83, 0.05);
    --tmg-purple-100: rgba(75, 24, 83, 0.1);
    --tmg-gold: #a87c2c;
    --tmg-gold-light: #c9a24e;
    --tmg-gold-50: rgba(168, 124, 44, 0.06);

    --surface: #ffffff;
    --surface-secondary: #f7f8fc;
    --surface-hover: #f0f2f8;
    --bg-page: #f0f2f5;

    --text-primary: #1a1d29;
    --text-secondary: #5f6477;
    --text-tertiary: #8c90a0;
    --text-on-dark: #ffffff;

    --border-light: #e8eaf0;
    --border-medium: #d4d7e0;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 100px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 0 1px rgba(0, 0, 0, 0.08);

    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- Base Overrides --- */
body.theme-tmg {
    font-family: var(--font-sans) !important;
    background: var(--bg-page) !important;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.theme-tmg section.content {
    background: transparent !important;
    padding: 24px !important;
}

/* --- Sidebar Modernization --- */
body.theme-tmg #leftsidebar {
    background: var(--surface) !important;
    box-shadow: 1px 0 0 var(--border-light) !important;
    border-right: none;
}

body.theme-tmg #leftsidebar .navbar-brand {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

body.theme-tmg #leftsidebar .navbar-brand a span {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

body.theme-tmg #leftsidebar .menu .list a {
    color: var(--text-secondary) !important;
    font-size: 13.5px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    margin: 2px 10px;
    transition: all var(--transition-fast);
}

body.theme-tmg #leftsidebar .menu .list a:hover,
body.theme-tmg #leftsidebar .menu .list a:focus {
    background: var(--tmg-purple-50) !important;
    color: var(--tmg-purple) !important;
}

body.theme-tmg #leftsidebar .menu .list a i.zmdi {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

body.theme-tmg #leftsidebar .user-info {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 8px;
}

body.theme-tmg #leftsidebar .user-info .image img {
    border-radius: var(--radius-lg);
    width: 44px;
    height: 44px;
    object-fit: cover;
}

body.theme-tmg #leftsidebar .user-info .detail strong {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

/* --- Dashboard Page Container --- */
.tmg-dashboard-2026 {
    max-width: 1440px;
    margin: 0 auto;
}

/* --- Dashboard Header / Banner --- */
.tmg-dash-header {
    background: linear-gradient(135deg, var(--tmg-purple) 0%, #6b2d7b 40%, #8a4a9a 100%);
    border-radius: var(--radius-xl);
    padding: 32px 36px 28px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.tmg-dash-header::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(168, 124, 44, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.tmg-dash-header::after {
    content: '';
    position: absolute;
    bottom: -60%;
    left: 20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
    border-radius: 50%;
}

.tmg-dash-header .header-content {
    position: relative;
    z-index: 1;
}

.tmg-dash-header .header-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-on-dark);
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}

.tmg-dash-header .header-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 20px;
    font-weight: 400;
}

/* --- Dashboard Nav Pills --- */
.tmg-dash-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.tmg-dash-nav .nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    font-size: 13.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    text-decoration: none;
    transition: all var(--transition-fast);
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

.tmg-dash-nav .nav-pill:hover {
    background: rgba(255, 255, 255, 0.18);
    color: var(--text-on-dark);
    text-decoration: none;
    transform: translateY(-1px);
}

.tmg-dash-nav .nav-pill.active {
    background: var(--text-on-dark);
    color: var(--tmg-purple);
    border-color: var(--text-on-dark);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tmg-dash-nav .nav-pill i {
    font-size: 16px;
}

/* --- Quick Actions Row --- */
.tmg-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.tmg-quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.tmg-quick-action:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--tmg-purple-100);
    color: var(--tmg-purple);
    text-decoration: none;
    transform: translateY(-1px);
}

.tmg-quick-action .qa-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.tmg-quick-action .qa-icon.purple {
    background: var(--tmg-purple-50);
    color: var(--tmg-purple);
}

.tmg-quick-action .qa-icon.gold {
    background: var(--tmg-gold-50);
    color: var(--tmg-gold);
}

/* --- KPI Stat Cards --- */
.tmg-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.tmg-kpi-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.tmg-kpi-card:hover {
    box-shadow: var(--shadow-md);
}

.tmg-kpi-card .kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tmg-kpi-card .kpi-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tmg-kpi-card .kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.tmg-kpi-card .kpi-icon.bg-purple {
    background: linear-gradient(135deg, var(--tmg-purple) 0%, var(--tmg-purple-light) 100%);
    color: var(--text-on-dark);
}

.tmg-kpi-card .kpi-icon.bg-gold {
    background: linear-gradient(135deg, var(--tmg-gold) 0%, var(--tmg-gold-light) 100%);
    color: var(--text-on-dark);
}

.tmg-kpi-card .kpi-icon.bg-success {
    background: linear-gradient(135deg, #0C7C59 0%, #10B981 100%);
    color: var(--text-on-dark);
}

.tmg-kpi-card .kpi-icon.bg-danger {
    background: linear-gradient(135deg, #DC2626 0%, #F87171 100%);
    color: var(--text-on-dark);
}

.tmg-kpi-card .kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.tmg-kpi-card .kpi-detail {
    font-size: 12.5px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.tmg-kpi-card .kpi-detail a {
    color: var(--tmg-purple);
    text-decoration: none;
    font-weight: 500;
}

.tmg-kpi-card .kpi-detail a:hover {
    text-decoration: underline;
}

/* --- Modern Chart Cards --- */
.tmg-chart-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 20px;
    transition: all var(--transition-base);
}

.tmg-chart-card:hover {
    box-shadow: var(--shadow-md);
}

.tmg-chart-card .chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
    flex-wrap: wrap;
    gap: 12px;
}

.tmg-chart-card .chart-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin: 0;
}

.tmg-chart-card .chart-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tmg-chart-card .chart-tab-group {
    display: flex;
    background: var(--surface-secondary);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}

.tmg-chart-card .chart-tab {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.tmg-chart-card .chart-tab:hover {
    color: var(--text-secondary);
    text-decoration: none;
}

.tmg-chart-card .chart-tab.active {
    background: var(--surface);
    color: var(--tmg-purple);
    box-shadow: var(--shadow-sm);
}

.tmg-chart-card .chart-card-body {
    padding: 16px 20px 20px;
}

.tmg-chart-card .chart-actions-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--tmg-purple);
    background: var(--tmg-purple-50);
    border: 1px solid var(--tmg-purple-100);
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.tmg-chart-card .chart-actions-btn:hover {
    background: var(--tmg-purple);
    color: var(--text-on-dark);
    text-decoration: none;
}

.tmg-chart-card .chart-actions-btn .dropdown-toggle::after {
    display: none;
}

/* --- Chart Cards Grid --- */
.tmg-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 991px) {
    .tmg-chart-grid {
        grid-template-columns: 1fr;
    }
}

/* --- ApexCharts overrides --- */
.tmg-chart-card .apexcharts-canvas {
    font-family: var(--font-sans) !important;
}

.tmg-chart-card .apexcharts-legend-text {
    font-family: var(--font-sans) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: var(--text-secondary) !important;
}

.tmg-chart-card .apexcharts-tooltip {
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-lg) !important;
    border: 1px solid var(--border-light) !important;
}

.tmg-chart-card .apexcharts-tooltip .apexcharts-tooltip-title {
    font-family: var(--font-sans) !important;
    font-weight: 600 !important;
    background: var(--surface-secondary) !important;
    border-bottom: 1px solid var(--border-light) !important;
}

.tmg-chart-card .apexcharts-xaxis-label,
.tmg-chart-card .apexcharts-yaxis-label {
    font-family: var(--font-sans) !important;
    fill: var(--text-tertiary) !important;
    font-size: 11px !important;
}

.tmg-chart-card .apexcharts-gridline {
    stroke: var(--border-light) !important;
}

/* --- Modern Dropdown --- */
.tmg-dropdown .dropdown-menu {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    min-width: 180px;
    margin-top: 4px;
}

.tmg-dropdown .dropdown-menu li a,
.tmg-dropdown .dropdown-menu .dropdown-item {
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.tmg-dropdown .dropdown-menu li a:hover,
.tmg-dropdown .dropdown-menu .dropdown-item:hover {
    background: var(--tmg-purple-50);
    color: var(--tmg-purple);
}

/* --- Modern Modal --- */
.tmg-modal .modal-content {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.tmg-modal .modal-header {
    background: linear-gradient(135deg, var(--tmg-purple) 0%, var(--tmg-purple-light) 100%);
    color: var(--text-on-dark);
    padding: 18px 24px;
    border-bottom: none;
}

.tmg-modal .modal-body {
    padding: 24px;
}

.tmg-modal .modal-body .table {
    margin: 0;
}

.tmg-modal .modal-body .table td {
    padding: 10px 12px;
    font-size: 13.5px;
    border-color: var(--border-light);
    vertical-align: middle;
}

.tmg-modal .modal-body .table td a {
    color: var(--tmg-purple);
    font-weight: 500;
    text-decoration: none;
}

.tmg-modal .modal-body .table td a:hover {
    text-decoration: underline;
}

.tmg-modal .modal-body .table tr.bg-success td {
    background: rgba(16, 185, 129, 0.08) !important;
    color: #065F46;
}

.tmg-modal .modal-body .table tr.bg-warning td {
    background: rgba(245, 158, 11, 0.08) !important;
    color: #92400E;
}

.tmg-modal .modal-body .table tr.bg-danger td {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #991B1B;
}

.tmg-modal .modal-body .table tr.bg-success td a,
.tmg-modal .modal-body .table tr.bg-warning td a,
.tmg-modal .modal-body .table tr.bg-danger td a {
    color: inherit;
}

/* --- Responsive --- */
@media (max-width: 767px) {
    body.theme-tmg section.content {
        padding: 12px !important;
    }

    .tmg-dash-header {
        padding: 20px;
        border-radius: var(--radius-lg);
    }

    .tmg-dash-header .header-title {
        font-size: 18px;
    }

    .tmg-dash-nav {
        gap: 6px;
    }

    .tmg-dash-nav .nav-pill {
        padding: 8px 14px;
        font-size: 12px;
    }

    .tmg-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .tmg-kpi-card {
        padding: 16px;
    }

    .tmg-kpi-card .kpi-value {
        font-size: 22px;
    }

    .tmg-quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .tmg-chart-grid {
        gap: 12px;
    }

    .tmg-chart-card .chart-card-header {
        padding: 16px 16px 0;
    }

    .tmg-chart-card .chart-card-body {
        padding: 12px 12px 16px;
    }
}

@media (max-width: 480px) {
    .tmg-kpi-grid {
        grid-template-columns: 1fr;
    }

    .tmg-quick-actions {
        grid-template-columns: 1fr;
    }
}
