/* CSGOWin BI Dashboard — Dark Minimal Professional Theme */

/* ---- Base ---- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #111113;
}

/* ---- Sidebar utilities ---- */
.sidebar-w { width: 208px; }
.sidebar-ml { margin-left: 208px; }
.z-30 { z-index: 30; }
.gap-2\.5 { gap: 0.625rem; }
.space-y-0\.5 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.125rem; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.py-\[7px\] { padding-top: 7px; padding-bottom: 7px; }
.text-\[13px\] { font-size: 13px; }
.text-\[11px\] { font-size: 11px; }
.text-\[10px\] { font-size: 10px; }
.tracking-tight { letter-spacing: -0.025em; }

/* ---- Loading indicators (no animation) ---- */
.loading-pulse {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.loading-bar {
    height: 28px;
    width: 60%;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Date input dark fix ---- */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
}

/* ---- Table styles ---- */
#creatorTable tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* ---- ROI column coloring ---- */
.roi-green {
    color: #34d399;
}
.roi-yellow {
    color: #fbbf24;
}
.roi-red {
    color: #f87171;
}

/* ---- Clickable cards ---- */
.kpi-card[onclick]:hover .clickable-icon,
.kpi-card.cursor-pointer:hover .clickable-icon {
    color: #e5e7eb;
}

/* ---- Modal ---- */

/* ---- Column tooltips ---- */
th.has-tooltip {
    position: relative;
}
th.has-tooltip .col-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    min-width: 260px;
    max-width: 340px;
    padding: 10px 14px;
    background: #1f1f25;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    color: #e5e7eb;
    text-transform: none;
    letter-spacing: 0;
    white-space: pre-line;
    text-align: left;
    pointer-events: none;
    margin-top: 4px;
}
th.has-tooltip:hover .col-tooltip {
    display: block;
    animation: fadeIn 0.15s ease-out;
}
/* Keep right-side tooltips from overflowing */
th.has-tooltip:nth-last-child(-n+4) .col-tooltip {
    left: auto;
    right: 0;
    transform: none;
}
/* Keep left-side tooltips from overflowing */
th.has-tooltip:nth-child(-n+2) .col-tooltip {
    left: 0;
    transform: none;
}

/* ---- Sort indicators ---- */
th[data-sort] {
    position: relative;
    user-select: none;
}
th[data-sort]::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 6px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid rgba(255,255,255,0.2);
    transition: all 0.15s;
}
th[data-sort].sort-asc::after {
    border-top: none;
    border-bottom: 5px solid #3b82f6;
}
th[data-sort].sort-desc::after {
    border-top: 5px solid #3b82f6;
}

/* ---- Health bar colors ---- */
.health-green { background: #10b981; }
.health-yellow { background: #eab308; }
.health-red { background: #ef4444; }

/* ---- Definition sections ---- */
.section-toggle .section-arrow.open {
    transform: rotate(180deg);
}

/* ---- Spin animation for refresh icon ---- */
.animate-spin {
    animation: spin 1s linear infinite;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .text-2xl { font-size: 1.25rem; }
    .grid { gap: 0.5rem; }
}

/* ---- Toggle switch ---- */
.toggle-track {
    position: relative;
    width: 32px;
    height: 18px;
    background: #1e1e2e;
    border-radius: 9px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #6b7280;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
#activeDealsOnly:checked + .toggle-track {
    background: rgba(59, 130, 246, 0.5);
}
#activeDealsOnly:checked + .toggle-track::after {
    transform: translateX(14px);
    background: white;
}

/* ---- Cost group container ---- */
.cost-group-container {
    background: rgba(255, 255, 255, 0.01);
    border-color: rgba(255, 255, 255, 0.06);
}

/* ---- KPI hover tooltip ---- */
.kpi-tooltip {
    position: fixed;
    z-index: 50;
    min-width: 240px;
    max-width: 400px;
    padding: 10px 14px;
    background: #1a1a1f;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    animation: fadeIn 0.12s ease-out;
}
.kpi-tooltip.hidden { display: none; }
.kpi-tip-desc {
    font-size: 11px;
    color: #9ca3af;
    line-height: 1.4;
    margin-bottom: 6px;
}
.kpi-tip-formula {
    font-size: 12px;
    color: #e5e7eb;
    font-weight: 500;
    margin-bottom: 4px;
}
.kpi-tip-calc {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 12px;
    color: #3b82f6;
    letter-spacing: -0.3px;
}
.kpi-tip-link {
    margin-top: 6px;
    font-size: 10px;
    color: #6b7280;
}

/* ---- Chart containers ---- */
.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

#chartsSection .grid > div {
    transition: opacity 0.3s ease;
}

#chartsSection.charts-loading .grid > div {
    opacity: 0.4;
}

#chartsSection.charts-ready #chartsLoading {
    display: none;
}

/* Concentration legend items */
.conc-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #9ca3af;
}
.conc-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}
.conc-legend-pct {
    margin-left: auto;
    font-weight: 600;
    color: #e5e7eb;
}
.conc-legend-ggr {
    font-size: 10px;
    color: #6b7280;
    min-width: 70px;
    text-align: right;
}

/* ---- Negative values ---- */
.text-negative {
    color: #f87171;
}

/* ---- Dot indicators ---- */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.green { background: #10b981; }
.status-dot.yellow { background: #eab308; }
.status-dot.red { background: #ef4444; }

/* ---- Tab Navigation ---- */
.tab-nav {
    gap: 2px;
}
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}
.tab-btn:hover {
    color: #e5e7eb;
}
.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}
.tab-content.hidden {
    display: none;
}

/* ---- Country table sort indicators ---- */
th[data-csort] {
    position: relative;
    user-select: none;
}
th[data-csort]::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 6px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid rgba(255,255,255,0.2);
    transition: all 0.15s;
}
th[data-csort].sort-asc::after {
    border-top: none;
    border-bottom: 5px solid #3b82f6;
}
th[data-csort].sort-desc::after {
    border-top: 5px solid #3b82f6;
}

/* ---- Country table stripes ---- */
#countryTable tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* ---- World Map ---- */
.map-country {
    cursor: pointer;
    transition: opacity 0.15s;
}
.map-country:hover {
    opacity: 0.85;
}

.map-tooltip {
    position: absolute;
    z-index: 30;
    min-width: 220px;
    max-width: 280px;
    padding: 12px 14px;
    background: #1a1a1f;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    font-size: 12px;
}
.map-tip-title {
    font-weight: 700;
    font-size: 14px;
    color: #3b82f6;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 6px;
}
.map-tip-code {
    font-size: 11px;
    font-weight: 400;
    color: #6b7280;
    margin-left: 4px;
}
.map-tip-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.map-tip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.map-tip-label {
    color: #6b7280;
    font-size: 11px;
}
.map-tip-val {
    font-weight: 600;
    color: #e5e7eb;
    font-size: 12px;
}

/* ---- Toggle for country tab ---- */
.toggle-track-country {
    position: relative;
    width: 32px;
    height: 18px;
    background: #1e1e2e;
    border-radius: 9px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.toggle-track-country::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #6b7280;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
#profitableOnly:checked + .toggle-track-country {
    background: rgba(16, 185, 129, 0.6);
}
#profitableOnly:checked + .toggle-track-country::after {
    transform: translateX(14px);
    background: white;
}

/* ---- KPI Table ---- */
#kpiTable tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}
#kpiTable tbody tr.today-highlight {
    background: rgba(59, 130, 246, 0.04);
    border-left: 2px solid rgba(59, 130, 246, 0.3);
}

/* ---- VIP Host Module ---- */
.coin-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: -3px;
    margin-right: 4px;
}

.clickable-card {
    cursor: pointer;
}
.clickable-card:hover .clickable-icon {
    color: #3b82f6;
}

.chart-container {
    position: relative;
    width: 100%;
}

/* ---- CAC/LTV Analytics Module ---- */
.cac-metric-card {
    transition: border-color 0.2s;
}
.cac-metric-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.cohort-cell {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.cohort-header {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
