/* ============================================================
   XoX Sports — Design System v2 (Strava + AppHurra Konsept)
   2026 Modern Corporate Athletic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* Primary — Strava-inspired warm orange */
    --primary: #FC4C02;
    --primary-light: #FF6B35;
    --primary-dark: #D93E00;
    --primary-glow: rgba(252,76,2,.12);

    /* Backward compat aliases */
    --accent: #FC4C02;
    --accent-dark: #D93E00;
    --accent-glow: rgba(252,76,2,.12);

    /* Status */
    --blue: #2563EB;
    --blue-glow: rgba(37,99,235,.1);
    --green: #16A34A;
    --green-glow: rgba(22,163,74,.1);
    --yellow: #D97706;
    --yellow-glow: rgba(217,119,6,.1);
    --red: #DC2626;
    --red-glow: rgba(220,38,38,.1);

    /* Dark Theme — User Panel */
    --bg-root: #0A0A0A;
    --bg-card: #141414;
    --bg-card-hover: #1C1C1C;
    --bg-input: #1A1A1A;
    --border: #262626;
    --border-light: #333333;

    /* Text — Dark Theme */
    --text-primary: #F5F5F5;
    --text-secondary: #A3A3A3;
    --text-muted: #737373;

    /* Layout */
    --sidebar-w: 256px;
    --topbar-h: 56px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: .2s ease;
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    background: var(--bg-root);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: inherit; }

/* ── Layout ─────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1; display: flex; flex-direction: column;
    min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: rgba(10,10,10,.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 24px; gap: 16px;
    position: sticky; top: 0; z-index: 100;
}
.topbar-title {
    font-size: 15px; font-weight: 700;
    color: var(--text-primary); flex: 1;
    letter-spacing: -0.01em;
}
.topbar-title small {
    font-size: 12px; font-weight: 400;
    color: var(--text-muted); display: block; margin-top: 1px;
}

/* ── Live Indicator ─────────────────────────────────── */
.live-indicator {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px;
    background: var(--green-glow);
    border: 1px solid rgba(22,163,74,.2);
    border-radius: 20px;
    font-size: 10px; color: var(--green);
    font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.live-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--green);
    animation: livePulse 1.5s infinite;
}
@keyframes livePulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }

/* ── Page Content ─────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }

/* ── Cards ─────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    display: flex; align-items: center; gap: 10px;
}
.card-title {
    font-size: 14px; font-weight: 600;
    color: var(--text-primary); margin: 0; flex: 1;
}
.card-body { padding: 20px; }

/* ── Stat Cards ─────────────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px; position: relative;
    overflow: hidden; transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
.stat-card::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
}
.stat-card.orange::before { background: linear-gradient(90deg, var(--primary), transparent); }
.stat-card.blue::before   { background: linear-gradient(90deg, var(--blue), transparent); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--green), transparent); }
.stat-card.red::before    { background: linear-gradient(90deg, var(--red), transparent); }

.stat-icon {
    width: 44px; height: 44px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-bottom: 14px;
}
.stat-icon.orange { background: var(--primary-glow); color: var(--primary); }
.stat-icon.blue   { background: var(--blue-glow); color: var(--blue); }
.stat-icon.green  { background: var(--green-glow); color: var(--green); }
.stat-icon.red    { background: var(--red-glow); color: var(--red); }

.stat-value {
    font-size: 32px; font-weight: 800;
    color: var(--text-primary); line-height: 1;
    margin-bottom: 4px; letter-spacing: -1px;
    font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* ── Tables ─────────────────────────────────────────── */
.table-premium { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-premium th {
    padding: 10px 16px; font-size: 11px; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .8px; border-bottom: 1px solid var(--border);
    text-align: left;
}
.table-premium td {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    color: var(--text-primary); vertical-align: middle; font-size: 13px;
}
.table-premium tbody tr:last-child td { border-bottom: none; }
.table-premium tbody tr:hover td { background: rgba(255,255,255,.02); }

/* ── Badges ─────────────────────────────────────────── */
.badge-status {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.badge-status::before { content:''; width:6px; height:6px; border-radius:50%; }
.bs-running  { background: var(--green-glow); color: var(--green); }
.bs-running::before { background: var(--green); }
.bs-slow     { background: var(--yellow-glow); color: var(--yellow); }
.bs-slow::before { background: var(--yellow); }
.bs-stopped  { background: var(--red-glow); color: var(--red); }
.bs-stopped::before { background: var(--red); }

.tag {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: 6px;
    font-size: 11px; font-weight: 600;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-premium {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 20px;
    background: var(--primary); color: #fff;
    border: none; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all var(--transition);
    font-family: inherit; touch-action: manipulation;
}
.btn-premium:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-premium:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-ghost {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px;
    background: transparent; color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all var(--transition);
    font-family: inherit; touch-action: manipulation;
}
.btn-ghost:hover { background: rgba(255,255,255,.04); color: var(--text-primary); border-color: var(--border-light); }
.btn-ghost:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-icon {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-secondary);
    cursor: pointer; transition: all var(--transition); font-size: 14px;
}
.btn-icon:hover { background: rgba(255,255,255,.04); color: var(--text-primary); }
.btn-icon.danger:hover { background: var(--red-glow); color: var(--red); border-color: rgba(220,38,38,.25); }

/* ── Forms ─────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
}
.form-input {
    width: 100%; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 10px 14px; color: var(--text-primary);
    font-size: 13px; font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.form-input::placeholder { color: var(--text-muted); }

/* ── Search ─────────────────────────────────────────── */
.search-box { position: relative; }
.search-box .search-icon {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%); color: var(--text-muted);
    font-size: 14px; pointer-events: none;
}
.search-box .form-input { padding-left: 36px; }

/* ── Map ─────────────────────────────────────────── */
.map-container { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.leaflet-popup-content-wrapper {
    background: var(--bg-card); color: var(--text-primary);
    border: 1px solid var(--border-light); border-radius: 10px;
}
.leaflet-popup-tip { background: var(--bg-card); }
.leaflet-popup-content { font-size: 12px; line-height: 1.7; margin: 10px 14px; }
.leaflet-container { background: #0a1628; }

/* ── Progress ─────────────────────────────────────── */
.progress-bar-custom { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; border-radius: 2px; transition: width .6s ease; }

/* ── Alert Cards ─────────────────────────────────── */
.alert-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
    position: relative; overflow: hidden;
}
.alert-card::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; }
.alert-card.sos::before { background: var(--red); }
.alert-card.route::before { background: var(--blue); }

/* ── Empty State ─────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; max-width: 320px; margin: 0 auto; }

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .page-content { padding: 16px; }
}

/* ── Utility ─────────────────────────────────────── */
.text-accent  { color: var(--primary) !important; }
.text-muted-c { color: var(--text-secondary) !important; }
.divider      { height: 1px; background: var(--border); margin: 16px 0; }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ── WIG: Focus visible ─────────────────────────── */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── WIG: Reduced motion ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
