/* ============================================================
   AETRAM BULLION ERP - Premium Gold Theme Layer
   UI-only enhancements — Bloomberg / bullion-desk aesthetic
   ============================================================ */

body.premium-theme {
    background: var(--bg-primary);
    background-image: none;
}

[data-theme="dark"] body.premium-theme {
    background-image: none;
}

/* ── Sidebar premium ───────────────────────────────────── */
.premium-theme .sidebar {
    border-right: 1px solid var(--border-color);
    background: var(--bg-sidebar);
}

.premium-theme .sidebar-brand {
    border-bottom-color: var(--border-color);
}

.premium-theme .nav-link .nav-icon {
    color: var(--brand-gold);
    opacity: .85;
    transition: color .2s, transform .2s, opacity .2s;
}

.premium-theme .nav-link:hover .nav-icon {
    color: var(--brand-gold);
    opacity: 1;
    transform: scale(1.08);
}

.premium-theme .nav-section-label {
    color: var(--text-muted);
}

/* ── Header ────────────────────────────────────────────── */
.premium-theme .top-header {
    backdrop-filter: none;
    background: var(--bg-header);
    border-bottom-color: var(--border-color);
}

/* ── Cards ─────────────────────────────────────────────── */
.premium-theme .card,
.premium-theme .stat-card {
    border-color: var(--border-color);
    background: var(--bg-card);
}

.premium-theme .card:hover,
.premium-theme .stat-card:hover {
    border-color: transparent;
    box-shadow: 0 12px 32px rgba(0,0,0,.4);
}

.premium-theme .card-header {
    border-bottom-color: var(--border-color);
}

.premium-theme .card-accent {
    border-top: 2px solid var(--brand-gold);
}

/* ── Executive KPI cards ───────────────────────────────── */
.exec-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 1400px) { .exec-kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .exec-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .exec-kpi-grid { grid-template-columns: 1fr; } }

.exec-kpi-card {
    position: relative;
    padding: 18px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    overflow: hidden;
    transition: var(--transition);
}

.exec-kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gradient-gold);
    opacity: .6;
}

.exec-kpi-card:hover {
    border-color: rgba(212,175,55,.35);
    box-shadow: var(--shadow-gold);
    transform: translateY(-2px);
}

.exec-kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: rgba(255,191,0,.12);
    color: var(--brand-gold);
    margin-bottom: 12px;
}

.exec-kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.exec-kpi-label {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.exec-kpi-trend {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.exec-kpi-trend.up { background: rgba(22,163,74,.15); color: #16A34A; }
.exec-kpi-trend.down { background: rgba(220,38,38,.15); color: #DC2626; }
.exec-kpi-trend.neutral { background: rgba(156,163,175,.12); color: var(--text-secondary); }

.exec-kpi-spark {
    height: 28px;
    margin-top: 10px;
    opacity: .7;
}

/* ── Dashboard widgets ─────────────────────────────────── */
.widget-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    height: 100%;
}

.widget-panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.widget-panel-title {
    font-size: 13.5px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.widget-list { list-style: none; margin: 0; padding: 0; }

.widget-list-item {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: background .15s;
}

.widget-list-item:last-child { border-bottom: none; }
.widget-list-item:hover { background: rgba(212,175,55,.04); }

.widget-list-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
}

.widget-list-icon.gold { background: rgba(212,175,55,.12); color: var(--brand-gold); }
.widget-list-icon.green { background: rgba(22,163,74,.12); color: #16A34A; }
.widget-list-icon.red { background: rgba(220,38,38,.12); color: #DC2626; }
.widget-list-icon.amber { background: rgba(245,158,11,.12); color: #F59E0B; }

.widget-list-body { flex: 1; min-width: 0; }
.widget-list-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.widget-list-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* ── Chart cards ───────────────────────────────────────── */
.chart-card .card-body { padding: 16px 20px 12px; }
.chart-card .card-title { font-size: 13.5px; }

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 992px) { .chart-grid { grid-template-columns: 1fr; } }

/* ── Tables premium ────────────────────────────────────── */
.premium-theme .table-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    max-height: 480px;
    overflow: auto;
}

.premium-theme .data-table tbody tr {
    transition: background .15s;
}

.premium-theme .data-table tbody tr:hover {
    background: var(--table-row-hover);
}

.premium-theme table.dataTable thead th {
    background: var(--bg-header) !important;
    color: var(--text-secondary) !important;
    border-bottom-color: var(--border-color) !important;
    position: sticky;
    top: 0;
    z-index: 2;
}

.premium-theme .dataTables_wrapper .dataTables_filter input,
.premium-theme .dataTables_wrapper .dataTables_length select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
}

.premium-theme .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--brand-gold) !important;
    border-color: var(--brand-gold) !important;
    color: #0F1115 !important;
}

.premium-theme .table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-header);
}

/* ── Forms premium ─────────────────────────────────────── */
.form-section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    overflow: hidden;
}

.form-section-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(212,175,55,.04);
}

.form-section-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-section-header i { color: var(--brand-gold); }

.form-section-body { padding: 20px; }

.form-progress-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 24px;
}

.form-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-gold-dark), var(--brand-gold));
    border-radius: 2px;
    transition: width .4s ease;
}

.premium-theme .form-control,
.premium-theme .form-select {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
}

.premium-theme .input-group-text {
    background: var(--bg-header);
    border-color: var(--border-color);
    color: var(--brand-gold);
}

/* ── Status soft backgrounds ───────────────────────────── */
.bg-success-soft { background: rgba(22,163,74,.12) !important; }
.bg-warning-soft { background: rgba(245,158,11,.12) !important; }
.bg-danger-soft { background: rgba(220,38,38,.12) !important; }
.bg-gold-soft { background: rgba(212,175,55,.12) !important; }
.bg-info-soft { background: rgba(59,130,246,.12) !important; }

/* ── Page header executive ─────────────────────────────── */
.premium-theme .page-title {
    font-family: var(--font-family-base);
    font-weight: 600;
    letter-spacing: .3px;
}

.premium-theme .page-title i { font-family: 'Font Awesome 6 Free'; }

/* ── Tabs ──────────────────────────────────────────────── */
.premium-theme .tab-nav .tab-btn.active {
    color: var(--brand-gold);
    border-bottom-color: var(--brand-gold);
}

/* ── Alerts dark-friendly ──────────────────────────────── */
[data-theme="dark"] .alert-success,
:root .alert-success { background: rgba(22,163,74,.12); border-color: rgba(22,163,74,.3); color: #86EFAC; }
[data-theme="dark"] .alert-warning,
:root .alert-warning { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); color: #FCD34D; }
[data-theme="dark"] .alert-danger,
:root .alert-danger { background: rgba(220,38,38,.12); border-color: rgba(220,38,38,.3); color: #FCA5A5; }
[data-theme="dark"] .alert-info,
:root .alert-info { background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.3); color: #93C5FD; }

[data-theme="light"] .alert-success { color: #065F46; }
[data-theme="light"] .alert-warning { color: #92400E; }
[data-theme="light"] .alert-danger { color: #991B1B; }
[data-theme="light"] .alert-info { color: #1E40AF; }

/* ── Counter animation ─────────────────────────────────── */
@keyframes countPulse {
    0% { opacity: .5; transform: scale(.98); }
    100% { opacity: 1; transform: scale(1); }
}

.stat-value.animating,
.exec-kpi-value.animating {
    animation: countPulse .4s ease;
}

/* ── Gold shimmer loading bar (see aetram-rich-ui.css for full design) ── */
.dashboard-live-bar {
    height: 4px;
    background: rgba(255,255,255,.05);
    overflow: hidden;
    margin-bottom: 0;
}

.dashboard-live-bar::after {
    display: none;
}

.dashboard-live-bar.hidden { display: none; }

/* ── Theme Switcher ────────────────────────────────────── */
.theme-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.theme-switcher-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 36px;
    height: 32px;
    padding: 0 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.theme-switcher-btn i { font-size: 13px; }

.theme-switcher-btn:hover {
    color: var(--text-primary);
    background: var(--table-row-hover);
}

.theme-switcher-btn.active {
    background: var(--gradient-menu-active);
    color: #000000;
    box-shadow: 0 4px 12px rgba(249,200,81,.25);
}

.theme-switcher-label {
    display: none;
}

@media (min-width: 1200px) {
    .theme-switcher-btn { min-width: auto; padding: 0 12px; }
    .theme-switcher-label { display: inline; }
}

/* Auth page theme toggle */
.auth-theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.auth-theme-toggle .theme-switcher {
    box-shadow: var(--shadow-md);
}
