/* ══════════════════════════════════════════════════════
   Shared CSS — reusable styles across dashboard pages
   ══════════════════════════════════════════════════════ */

/* ── Stat Card ────────────────────────────────────── */
.stat-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15) !important;
}

.stat-card .card-body {
    position: relative;
    z-index: 1;
}

.stat-card .stat-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    opacity: 0.15;
    z-index: 0;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.85;
    font-weight: 600;
}

.stat-card .stat-sub {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ── Table Card ───────────────────────────────────── */
.table-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    background-color: #ffffff;
}

.table-card .table {
    margin-bottom: 0;
}

.table-card .table thead th {
    border-top: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    opacity: 0.95;
    color: #343a40;
}

[data-bs-theme="dark"] .table-card {
    background-color: #2b3035;
}

[data-bs-theme="dark"] .table-card .table thead th {
    color: #dee2e6;
}

.table-card .table td {
    vertical-align: middle;
    font-size: 0.85rem;
}

/* ── Chart Card ───────────────────────────────────── */
.chart-card {
    border: none;
    border-radius: 16px;
    transition: transform 0.2s ease;
    background-color: #ffffff;
}

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

.chart-card .card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 700;
    font-size: 0.95rem;
}

[data-bs-theme="dark"] .chart-card {
    background-color: #2b3035;
}

[data-bs-theme="dark"] .chart-card .card-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}



/* ── Progress Thin ────────────────────────────────── */
.progress-thin {
    height: 6px;
    border-radius: 3px;
}

[data-bs-theme="dark"] .progress-thin {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ── Empty State ──────────────────────────────────── */
.empty-state {
    padding: 3rem;
    text-align: center;
    opacity: 1;
    color: #495057;
}

[data-bs-theme="dark"] .empty-state {
    color: #adb5bd;
}

/* ── Gradient Backgrounds ─────────────────────────── */
.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.bg-gradient-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff;
}

.bg-gradient-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #ff6a00 0%, #ee0979 100%);
    color: #fff;
}

.bg-gradient-dark {
    background: linear-gradient(135deg, #434343 0%, #000000 100%);
    color: #fff;
}

/* ── Status Gradients (system info) ───────────────── */
.status-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.status-warning {
    background: linear-gradient(135deg, #f2c94c 0%, #f2994a 100%);
}

.status-danger {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
}

.status-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* ── Misc Helpers ─────────────────────────────────── */
.country-flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    vertical-align: middle;
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
}

.platform-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.rank-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
}

/* ── Animations ───────────────────────────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-up {
    animation: fadeInUp 0.5s ease forwards;
}

.animate-up:nth-child(2) {
    animation-delay: 0.1s;
}

.animate-up:nth-child(3) {
    animation-delay: 0.2s;
}

.animate-up:nth-child(4) {
    animation-delay: 0.3s;
}

.animate-up:nth-child(5) {
    animation-delay: 0.35s;
}

.animate-up:nth-child(6) {
    animation-delay: 0.4s;
}

.sparkle {
    display: inline-block;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ── Text contrast fixes ──────────────────────────── */
.text-muted {
    color: #5a6268 !important;
}

[data-bs-theme="dark"] .text-muted {
    color: #adb5bd !important;
}

/* ── Badges Center Fix ────────────────────────────── */
.badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

/* ── Layout Styles ────────────────────────────── */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f8f9fa;
    /* Light mode background */
}

main {
    flex: 1;
}

.footer {
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
    padding: 1rem 0;
}

/* Dark mode styles */
[data-bs-theme="dark"] body {
    background-color: #1a1d20;
}

[data-bs-theme="dark"] .footer {
    background-color: #212529;
    border-top-color: #495057;
}

[data-bs-theme="dark"] .bg-light {
    background-color: #343a40 !important;
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .text-dark {
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] i.bi {
    color: #ffffff !important;
}

#htmx-progress {
    height: 3px;
    border-radius: 0;
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
    background-color: rgba(0, 0, 0, 0.05);
    pointer-events: none;
}

#htmx-progress .progress-bar {
    width: 40%;
    background-color: #212529;
    /* Dark in light mode */
    animation: progress-indeterminate 1.5s ease-in-out infinite;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
    position: absolute;
    height: 100%;
}

[data-bs-theme="dark"] #htmx-progress {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] #htmx-progress .progress-bar {
    background-color: #ffffff;
    /* White in dark mode */
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@keyframes progress-indeterminate {
    0% {
        left: -40%;
    }

    100% {
        left: 100%;
    }
}