/* ==========================================================================
   Enliko Dashboard — Editorial Refinement Layer
   --------------------------------------------------------------------------
   Purpose: Loaded after the dashboard's inline <style>. This layer adds
   designer-grade polish (asymmetric grid, refined typography, editorial
   accents, hand-tuned spacing, micro-interactions) without rewriting
   any existing logic. Pure visual refinement.

   Author: Enliko Design
   Created: 2026-04
   ========================================================================== */


/* ── 0. Type rendering & numeric tabular-nums ───────────────────────────── */

body {
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.stat-value,
.pnl-positive,
.pnl-negative,
.positions-table td,
#custom-date-range input,
.chart-container,
#total-equity,
#daily-pnl,
#week-pnl,
#month-pnl,
#open-positions,
#win-rate {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum", "ss01", "cv11";
}


/* ── 1. Editorial header — eyebrow + hairline ───────────────────────────── */

.page-title {
    letter-spacing: -0.02em;
    font-weight: 700;
}
.page-subtitle {
    letter-spacing: 0.01em;
}

/* Subtle hand-drawn separator under header (SVG noise) */
.header {
    position: relative;
}
.header::after {
    content: "";
    position: absolute;
    left: 32px; right: 32px; bottom: 0;
    height: 1px;
    background:
        linear-gradient(90deg,
            transparent 0%,
            rgba(124,58,237,0.45) 12%,
            rgba(212,160,23,0.5) 50%,
            rgba(124,58,237,0.45) 88%,
            transparent 100%);
    opacity: 0.7;
}


/* ── 2. Asymmetric stats grid (hero card spans 2 cols) ──────────────────── */

@media (min-width: 1100px) {
    .dashboard-content .stats-grid {
        grid-template-columns: 1.6fr 1fr 1fr 1fr;
        grid-auto-rows: auto;
    }
    .dashboard-content .stats-grid > .stat-card:first-child {
        grid-column: span 2;
        grid-row: span 1;
        padding: 32px 32px 28px;
    }
    .dashboard-content .stats-grid > .stat-card:first-child .stat-value {
        font-size: 3rem;
        line-height: 1;
        letter-spacing: -0.025em;
    }
    .dashboard-content .stats-grid > .stat-card:first-child .stat-label {
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.18em;
        font-weight: 600;
    }
}


/* ── 3. Refined stat-card — editorial corner mark + softened depth ───── */

.dashboard-content .stat-card {
    background:
        radial-gradient(120% 100% at 0% 0%, rgba(124,58,237,0.04) 0%, transparent 55%),
        var(--bg-card);
    box-shadow:
        0 1px 0 0 rgba(255,255,255,0.04) inset,
        0 0 0 1px rgba(255,255,255,0.012) inset,
        0 4px 20px -8px rgba(0,0,0,0.4);
    transition: transform .35s cubic-bezier(.2,.7,.2,1),
                box-shadow .35s ease,
                border-color .25s ease;
}

.dashboard-content .stat-card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 1px 0 0 rgba(255,255,255,0.06) inset,
        0 0 0 1px rgba(255,255,255,0.02) inset,
        0 16px 40px -12px rgba(0,0,0,0.5);
}

/* Gold-thread top stripe (refined gradient) */
.dashboard-content .stat-card::before {
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent) 18%,
        var(--accent-gold) 50%,
        var(--accent) 82%,
        transparent 100%);
    opacity: 0.85;
}
.dashboard-content .stat-card.green::before {
    background: linear-gradient(90deg,
        transparent 0%,
        var(--green) 22%,
        rgba(16,185,129,0.6) 50%,
        var(--green) 78%,
        transparent 100%);
}
.dashboard-content .stat-card.gold::before {
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent-gold) 22%,
        rgba(212,160,23,0.7) 50%,
        var(--accent-gold) 78%,
        transparent 100%);
}

/* Editorial corner number — “01”, “02”… for the first-row tiles */
.dashboard-content .stats-grid {
    counter-reset: stat-mark;
}
.dashboard-content .stats-grid > .stat-card {
    counter-increment: stat-mark;
}
.dashboard-content .stats-grid > .stat-card::after {
    content: "0" counter(stat-mark);
    position: absolute;
    bottom: 14px;
    right: 18px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    color: var(--text-muted);
    opacity: 0.45;
    pointer-events: none;
}

/* Stat label — eyebrow style on the smaller tiles */
.dashboard-content .stat-card .stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
    color: var(--text-muted);
}

/* Refined stat-icon: thinner border + glow */
.dashboard-content .stat-card .stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset;
    backdrop-filter: blur(6px);
}

/* Stat value — better letter-spacing for tabular feel */
.dashboard-content .stat-card .stat-value {
    letter-spacing: -0.02em;
    font-weight: 700;
    line-height: 1.1;
}


/* ── 4. Cards — refined depth & hairline highlight ──────────────────────── */

.dashboard-content .card {
    box-shadow:
        0 1px 0 0 rgba(255,255,255,0.035) inset,
        0 8px 24px -12px rgba(0,0,0,0.45);
    transition: border-color .25s ease, box-shadow .35s ease;
}
.dashboard-content .card:hover {
    border-color: var(--border-hover);
}

.dashboard-content .card-header {
    padding: 18px 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.015) 0%, transparent 100%);
}

.dashboard-content .card-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 600;
    color: var(--text-secondary);
}
.dashboard-content .card-title i {
    color: var(--accent-gold);
    font-size: 0.85rem;
}


/* ── 5. Period tabs — refined pill switch ───────────────────────────────── */

.dashboard-content .period-tabs {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    padding: 3px;
}
.dashboard-content .period-tab {
    padding: 5px 12px;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.dashboard-content .period-tab.active {
    background: linear-gradient(135deg, var(--accent) 0%, #8B5CF6 100%);
    box-shadow: 0 2px 12px -2px rgba(124,58,237,0.45);
}


/* ── 6. Chart container — soft inner glow ───────────────────────────────── */

.chart-container {
    position: relative;
    border-radius: 12px;
    background:
        radial-gradient(80% 60% at 50% 0%, rgba(124,58,237,0.06) 0%, transparent 60%),
        rgba(0,0,0,0.15);
}


/* ── 7. Quick actions — refined depth ──────────────────────────────────── */

.dashboard-content .action-btn {
    transition: transform .25s cubic-bezier(.2,.7,.2,1),
                background .2s ease,
                border-color .2s ease;
    position: relative;
    overflow: hidden;
}
.dashboard-content .action-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(124,58,237,0.12) 0%, transparent 60%);
    opacity: 0;
    transition: opacity .3s ease;
}
.dashboard-content .action-btn:hover {
    transform: translateY(-2px);
}
.dashboard-content .action-btn:hover::after { opacity: 1; }


/* ── 8. Insight cards — editorial accent dots ──────────────────────────── */

.dashboard-content .insight-card {
    position: relative;
    padding-left: 18px;
}
.dashboard-content .insight-card .insight-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 600;
    color: var(--text-secondary);
}
.dashboard-content .insight-card .insight-title i.fa-circle {
    font-size: 0.4rem;
    color: var(--accent-gold);
    transform: translateY(-2px);
}
.dashboard-content .insight-card .insight-text {
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--text-primary);
    letter-spacing: -0.005em;
}


/* ── 9. Positions table — refined ──────────────────────────────────────── */

.dashboard-content .positions-table thead th {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
}
.dashboard-content .positions-table tbody td {
    padding: 14px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.dashboard-content .positions-table tbody tr {
    transition: background .15s ease;
}
.dashboard-content .positions-table tbody tr:hover {
    background: rgba(124,58,237,0.04);
}


/* ── 10. Header buttons — refined exchange/account switcher ────────────── */

.exchange-btn {
    letter-spacing: 0.04em;
    font-weight: 600;
    transition: transform .2s ease, border-color .2s ease, box-shadow .25s ease;
}
.exchange-btn.active {
    box-shadow:
        0 0 0 1px var(--accent) inset,
        0 4px 14px -6px rgba(124,58,237,0.5);
}
.exchange-btn.account-btn.active {
    box-shadow:
        0 0 0 1px var(--accent-gold) inset,
        0 4px 14px -6px rgba(212,160,23,0.45);
}


/* ── 11. Global period bar — softer, less boxy ─────────────────────────── */

.global-period-bar {
    background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%),
                var(--bg-secondary);
    box-shadow: 0 1px 0 0 rgba(255,255,255,0.03) inset;
}


/* ── 12. Subtle animated entrance for cards on first paint ─────────────── */

@keyframes refinedRise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.dashboard-content .stat-card { animation: refinedRise .55s cubic-bezier(.2,.7,.2,1) both; }
.dashboard-content .stats-grid > .stat-card:nth-child(1) { animation-delay: .00s; }
.dashboard-content .stats-grid > .stat-card:nth-child(2) { animation-delay: .04s; }
.dashboard-content .stats-grid > .stat-card:nth-child(3) { animation-delay: .08s; }
.dashboard-content .stats-grid > .stat-card:nth-child(4) { animation-delay: .12s; }
.dashboard-content .stats-grid > .stat-card:nth-child(5) { animation-delay: .16s; }
.dashboard-content .stats-grid > .stat-card:nth-child(6) { animation-delay: .20s; }
.dashboard-content .main-grid > div > .card { animation: refinedRise .55s cubic-bezier(.2,.7,.2,1) both; animation-delay: .24s; }


/* ── 13. Selection highlight — refined ─────────────────────────────────── */

::selection {
    background: rgba(124,58,237,0.4);
    color: #fff;
}


/* ── 14. Mobile — graceful collapse ────────────────────────────────────── */

@media (max-width: 1099px) {
    .dashboard-content .stats-grid > .stat-card:first-child .stat-value {
        font-size: 2.1rem;
    }
    .dashboard-content .stats-grid > .stat-card::after {
        bottom: 10px; right: 14px;
        font-size: 0.55rem;
    }
}

@media (max-width: 768px) {
    .header::after { left: 16px; right: 16px; }
    .dashboard-content .card-title { font-size: 0.7rem; letter-spacing: 0.14em; }
    .dashboard-content .stats-grid > .stat-card::after { display: none; }
}


/* ── 15. Reduced motion — respect user preference ──────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .dashboard-content .stat-card,
    .dashboard-content .main-grid > div > .card {
        animation: none !important;
    }
    .dashboard-content .stat-card:hover,
    .dashboard-content .action-btn:hover {
        transform: none;
    }
}
