/* ==========================================================================
   PICKLIST — Design System
   Football intelligence dashboard aesthetic.
   Dark-first, glassmorphic cards, configurable via CSS variables (spec §92).
   ========================================================================== */

/* ---- 1. Design tokens --------------------------------------------------- */
:root {
    /* Tells the browser to render native widgets (select dropdown popups,
       date/time pickers, scrollbars…) in dark chrome. Without this the
       <select> box itself picks up our dark colours from .form-select
       below, but the browser's own OS-native option list ignores our CSS
       entirely and falls back to a plain white popup — light option text
       on a white background is then invisible. */
    color-scheme: dark;

    /* Brand */
    --pk-primary: #16c784;          /* pitch green — confidence / success */
    --pk-primary-rgb: 22, 199, 132;
    --pk-secondary: #2b6ef2;        /* analyst blue */
    --pk-secondary-rgb: 43, 110, 242;
    --pk-accent: #f5b301;           /* value / odds highlight */
    --pk-accent-rgb: 245, 179, 1;

    /* Feedback */
    --pk-success: #16c784;
    --pk-danger:  #f6465d;
    --pk-warning: #f5b301;
    --pk-info:    #2b9bf4;

    /* Neutrals (dark theme defaults) */
    --pk-bg:        #0b1120;
    --pk-bg-2:      #0f1a2e;
    --pk-surface:   rgba(255, 255, 255, 0.04);
    --pk-surface-2: rgba(255, 255, 255, 0.07);
    --pk-border:    rgba(255, 255, 255, 0.10);
    --pk-text:      #e8eef7;
    --pk-muted:     #93a4bd;

    /* Effects */
    --pk-radius:    18px;
    --pk-radius-sm: 12px;
    --pk-shadow:    0 18px 50px -12px rgba(0, 0, 0, 0.55);
    --pk-blur:      16px;
    --pk-hero-gradient: radial-gradient(1200px 400px at 15% -10%, rgba(var(--pk-secondary-rgb), 0.35), transparent 60%),
                        radial-gradient(900px 380px at 100% 0%, rgba(var(--pk-primary-rgb), 0.28), transparent 55%);

    --pk-font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

/* Light theme overrides */
[data-bs-theme="light"] {
    color-scheme: light;
    --pk-bg:        #eef2f8;
    --pk-bg-2:      #e4eaf3;
    --pk-surface:   #ffffff;
    --pk-surface-2: #f5f7fb;
    --pk-border:    #e2e8f2;
    --pk-text:      #12203a;
    --pk-muted:     #5b6b85;
    --pk-shadow:    0 16px 40px -18px rgba(20, 40, 80, 0.28);
    --pk-hero-gradient: radial-gradient(1200px 400px at 15% -10%, rgba(var(--pk-secondary-rgb), 0.16), transparent 60%),
                        radial-gradient(900px 380px at 100% 0%, rgba(var(--pk-primary-rgb), 0.14), transparent 55%);
}

/* ---- 2. Base --------------------------------------------------------------- */
html { overflow-x: hidden; }
body {
    background-color: var(--pk-bg);
    background-image:
        radial-gradient(900px 500px at 100% -5%, rgba(var(--pk-secondary-rgb), 0.10), transparent 60%),
        radial-gradient(700px 400px at -10% 0%, rgba(var(--pk-primary-rgb), 0.08), transparent 55%);
    background-attachment: fixed;
    color: var(--pk-text);
    font-family: var(--pk-font);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Any uploaded image (hero banners, ads, crests, receipts) must never be
   wider than its container on a small screen — without this, one oversized
   upload can force horizontal scroll on the whole page. */
img, svg { max-width: 100%; height: auto; }

a { color: var(--pk-primary); text-decoration: none; }
a:hover { color: var(--pk-primary); opacity: .85; }
.text-muted, .text-secondary { color: var(--pk-muted) !important; }
hr { border-color: var(--pk-border); opacity: 1; }
::selection { background: rgba(var(--pk-primary-rgb), .35); }

.pk-display {
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.05;
}
.pk-eyebrow {
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: .72rem;
    font-weight: 700;
    color: var(--pk-muted);
}

/* ---- 3. Cards / surfaces ---------------------------------------------------- */
.pk-card {
    background: var(--pk-surface);
    border: 1px solid var(--pk-border);
    border-radius: var(--pk-radius);
    backdrop-filter: blur(var(--pk-blur));
    -webkit-backdrop-filter: blur(var(--pk-blur));
    box-shadow: var(--pk-shadow);
}
.pk-card-body { padding: 1.25rem 1.35rem; }
.pk-card-hover { transition: transform .18s ease, border-color .18s ease; }
.pk-card-hover:hover { transform: translateY(-3px); border-color: rgba(var(--pk-primary-rgb), .45); }

.pk-panel {
    background: var(--pk-surface-2);
    border: 1px solid var(--pk-border);
    border-radius: var(--pk-radius-sm);
}

/* ---- 4. Stat tiles (spec §42 / §109) ------------------------------------- */
.pk-stat {
    background: var(--pk-surface);
    border: 1px solid var(--pk-border);
    border-radius: var(--pk-radius);
    padding: 1.15rem 1.25rem;
    backdrop-filter: blur(var(--pk-blur));
    -webkit-backdrop-filter: blur(var(--pk-blur));
    height: 100%;
}
.pk-stat__label { font-size: .78rem; color: var(--pk-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.pk-stat__value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; margin-top: .35rem; }
.pk-stat__meta  { font-size: .8rem; color: var(--pk-muted); margin-top: .15rem; }
.pk-stat__icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
    background: rgba(var(--pk-primary-rgb), .14);
    color: var(--pk-primary);
}
.pk-delta-up   { color: var(--pk-success); }
.pk-delta-down { color: var(--pk-danger); }

/* ---- 5. Badges ---------------------------------------------------------- */
.pk-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .72rem; font-weight: 700; letter-spacing: .04em;
    padding: .3rem .6rem; border-radius: 999px;
    text-transform: uppercase;
    border: 1px solid transparent;
}
.pk-badge-free    { background: rgba(var(--pk-primary-rgb), .16); color: var(--pk-primary); border-color: rgba(var(--pk-primary-rgb), .35); }
.pk-badge-premium { background: rgba(var(--pk-accent-rgb), .16); color: var(--pk-accent); border-color: rgba(var(--pk-accent-rgb), .35); }
.pk-badge-neutral { background: var(--pk-surface-2); color: var(--pk-muted); border-color: var(--pk-border); }
.pk-badge-won     { background: rgba(var(--pk-primary-rgb), .16); color: var(--pk-success); }
.pk-badge-lost    { background: rgba(246, 70, 93, .16); color: var(--pk-danger); }

/* ---- 6. Buttons ------------------------------------------------------------- */
.btn-pk {
    --bs-btn-color: #04150d;
    --bs-btn-bg: var(--pk-primary);
    --bs-btn-border-color: var(--pk-primary);
    --bs-btn-hover-color: #04150d;
    --bs-btn-hover-bg: #12b878;
    --bs-btn-hover-border-color: #12b878;
    --bs-btn-active-bg: #0fa76c;
    --bs-btn-disabled-bg: var(--pk-primary);
    --bs-btn-font-weight: 700;
}
.btn-pk-outline {
    --bs-btn-color: var(--pk-text);
    --bs-btn-border-color: var(--pk-border);
    --bs-btn-bg: transparent;
    --bs-btn-hover-color: var(--pk-text);
    --bs-btn-hover-bg: var(--pk-surface-2);
    --bs-btn-hover-border-color: var(--pk-primary);
    --bs-btn-font-weight: 600;
}
.btn-pk-ghost {
    --bs-btn-color: var(--pk-muted);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--pk-text);
    --bs-btn-hover-bg: var(--pk-surface-2);
}

/* ---- 7. Public header --------------------------------------------------- */
.pk-navbar {
    background: rgba(11, 17, 32, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--pk-border);
}
[data-bs-theme="light"] .pk-navbar { background: rgba(255, 255, 255, 0.82); }
.pk-navbar .nav-link { color: var(--pk-muted); font-weight: 600; font-size: .93rem; padding: .5rem .8rem; border-radius: 8px; }
.pk-navbar .nav-link:hover,
.pk-navbar .nav-link.active { color: var(--pk-text); background: var(--pk-surface-2); }
.pk-brand { font-weight: 800; letter-spacing: -0.02em; font-size: 1.2rem; color: var(--pk-text); display: inline-flex; align-items: center; gap: .5rem; }
.pk-brand__mark {
    width: 30px; height: 30px; border-radius: 9px;
    background: linear-gradient(135deg, var(--pk-primary), var(--pk-secondary));
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1rem;
}

/* ---- 8. Hero ---------------------------------------------------------------- */
.pk-hero {
    position: relative;
    border-radius: var(--pk-radius);
    border: 1px solid var(--pk-border);
    background-color: var(--pk-bg-2);
    background-image: var(--pk-hero-gradient);
    overflow: hidden;
    padding: clamp(2rem, 5vw, 4rem);
}
.pk-hero__grid {
    position: absolute; inset: 0;
    background-image: linear-gradient(var(--pk-border) 1px, transparent 1px),
                      linear-gradient(90deg, var(--pk-border) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(circle at 20% 0%, #000, transparent 70%);
    mask-image: radial-gradient(circle at 20% 0%, #000, transparent 70%);
    opacity: .5;
    pointer-events: none;
}

/* ---- 9. Match card (spec §49) ----------------------------------------------- */
.match-card { background: var(--pk-surface); border: 1px solid var(--pk-border); border-radius: var(--pk-radius); overflow: hidden; }
a.match-card { text-decoration: none; transition: transform .16s ease, border-color .16s ease; }
a.match-card:hover { transform: translateY(-2px); border-color: rgba(var(--pk-primary-rgb), .45); }

.pk-ad { text-decoration: none; border: 1px solid var(--pk-border); border-radius: var(--pk-radius-sm); overflow: hidden; padding: .35rem; }
.pk-ad:hover { border-color: rgba(var(--pk-primary-rgb), .4); }
.match-card__head { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1rem; border-bottom: 1px solid var(--pk-border); font-size: .82rem; }
.match-card__league { color: var(--pk-secondary); font-weight: 700; }
.match-card__time { color: var(--pk-muted); font-weight: 600; }
.match-card__teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; padding: 1.1rem 1rem; }
.match-card__team { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; font-weight: 600; font-size: .9rem; }
.match-card__logo { width: 44px; height: 44px; object-fit: contain; }
.match-card__vs { color: var(--pk-muted); font-weight: 700; font-size: .8rem; }
.match-card__foot { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--pk-border); }
.match-card__cell { padding: .7rem 1rem; text-align: center; }
.match-card__cell + .match-card__cell { border-left: 1px solid var(--pk-border); }
.match-card__cell-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pk-muted); }
.match-card__cell-value { font-weight: 700; font-size: .95rem; margin-top: .15rem; }

/* Form indicators (spec §50) */
.pk-form { display: inline-flex; gap: 3px; }
.pk-form span {
    width: 20px; height: 20px; border-radius: 6px;
    font-size: .68rem; font-weight: 800; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
}
.pk-form .w { background: var(--pk-success); }
.pk-form .d { background: var(--pk-muted); }
.pk-form .l { background: var(--pk-danger); }

/* ---- 10. Admin shell --------------------------------------------------- */
.pk-shell { display: flex; min-height: 100vh; }
.pk-sidebar {
    width: 264px; flex-shrink: 0;
    background: var(--pk-bg-2);
    border-right: 1px solid var(--pk-border);
    padding: 1.1rem .9rem;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.pk-sidebar__section { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--pk-muted); font-weight: 700; margin: 1.2rem .6rem .35rem; }
.pk-sidebar__link {
    display: flex; align-items: center; gap: .7rem;
    padding: .58rem .7rem; border-radius: 10px;
    color: var(--pk-muted); font-weight: 600; font-size: .9rem;
}
.pk-sidebar__link:hover { background: var(--pk-surface-2); color: var(--pk-text); }
.pk-sidebar__link.active { background: rgba(var(--pk-primary-rgb), .14); color: var(--pk-primary); }
.pk-sidebar__link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }

.pk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pk-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .9rem 1.3rem;
    background: rgba(11, 17, 32, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--pk-border);
    position: sticky; top: 0; z-index: 20;
}
[data-bs-theme="light"] .pk-topbar { background: rgba(255,255,255,.78); }
.pk-content { padding: 1.5rem 1.3rem 3rem; flex: 1; }

.pk-sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1035; display: none; }

@media (max-width: 991.98px) {
    .pk-sidebar {
        position: fixed; z-index: 1040; left: 0; top: 0;
        transform: translateX(-100%); transition: transform .22s ease;
    }
    .pk-shell.pk-sidebar-open .pk-sidebar { transform: translateX(0); }
    .pk-shell.pk-sidebar-open .pk-sidebar-backdrop { display: block; }
}

/* ---- 11. Forms -------------------------------------------------------------- */
.form-control, .form-select {
    background: var(--pk-surface-2);
    border: 1px solid var(--pk-border);
    color: var(--pk-text);
    padding: .6rem .8rem;
    border-radius: 10px;
}
.form-control:focus, .form-select:focus {
    background: var(--pk-surface-2);
    color: var(--pk-text);
    border-color: var(--pk-primary);
    box-shadow: 0 0 0 .2rem rgba(var(--pk-primary-rgb), .2);
}
.form-control::placeholder { color: var(--pk-muted); opacity: .7; }
.form-label { font-weight: 600; font-size: .88rem; margin-bottom: .35rem; }
.form-check-input:checked { background-color: var(--pk-primary); border-color: var(--pk-primary); }

/* Bootstrap's .dropdown-menu (account menu, notification bell, admin action
   menus) is a plain styled <div>, not a native browser widget — the
   color-scheme fix above only affects native popups (native <select>
   options, date pickers). Without explicit colours here it falls back to
   Bootstrap's default white dropdown, and since our own dark-theme text
   colour still applies to it, that's near-white text on a white
   background. Tied to the same tokens as every other surface. */
.dropdown-menu {
    background-color: var(--pk-surface-2);
    border: 1px solid var(--pk-border);
    color: var(--pk-text);
    box-shadow: var(--pk-shadow);
}
.dropdown-item { color: var(--pk-text); }
.dropdown-item:hover, .dropdown-item:focus, .dropdown-item.active, .dropdown-item:active {
    background-color: var(--pk-surface);
    color: var(--pk-text);
}
.dropdown-item.text-danger:hover, .dropdown-item.text-danger:focus { color: var(--pk-danger) !important; }
.dropdown-divider { border-color: var(--pk-border); }
.dropdown-header { color: var(--pk-muted); }

/* Kickoff countdown badge (prediction / tip-slip cards) */
.pk-countdown {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    color: var(--pk-accent);
    background: rgba(var(--pk-accent-rgb), .12);
    border-radius: 999px;
    padding: .2rem .55rem;
}
.pk-countdown--live { color: var(--pk-danger); background: rgba(246, 70, 93, .12); }

/* Floating WhatsApp community button (spec §53) */
.pk-whatsapp-fab {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1030;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    font-size: 1.6rem;
    box-shadow: 0 10px 24px -6px rgba(0, 0, 0, .4);
    transition: transform .15s ease;
}
.pk-whatsapp-fab:hover, .pk-whatsapp-fab:focus { color: #fff; transform: scale(1.08); }
@media (max-width: 767.98px) {
    .pk-has-bottomnav .pk-whatsapp-fab { bottom: 4.5rem; }
}

/* ---- 12. Auth screens ------------------------------------------------------- */
.pk-auth {
    min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
}
.pk-auth__aside {
    position: relative; overflow: hidden;
    background-color: var(--pk-bg-2);
    background-image: var(--pk-hero-gradient);
    padding: 3rem;
    display: flex; flex-direction: column; justify-content: space-between;
}
.pk-auth__aside--photo { background-size: cover; background-position: center; }
.pk-auth__form { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.pk-auth__form-inner { width: 100%; max-width: 420px; }
@media (max-width: 991.98px) {
    .pk-auth { grid-template-columns: 1fr; }
    .pk-auth__aside { display: none; }
}

/* ---- 13. Tables ---------------------------------------------------------- */
.table { --bs-table-color: var(--pk-text); --bs-table-bg: transparent; --bs-table-border-color: var(--pk-border); }
.table > :not(caption) > * > * { background: transparent; }
.table thead th { color: var(--pk-muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--pk-border); }

/* ---- 14. Utilities ---------------------------------------------------------- */
.pk-divider { height: 1px; background: var(--pk-border); border: 0; }
.pk-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--pk-primary); }
.pk-ring { box-shadow: 0 0 0 4px rgba(var(--pk-primary-rgb), .12); }
.bg-pk-surface { background: var(--pk-surface) !important; }
.text-pk-primary { color: var(--pk-primary) !important; }
.pk-empty { text-align: center; padding: 2.5rem 1rem; color: var(--pk-muted); }
.pk-empty i { font-size: 2rem; opacity: .5; display: block; margin-bottom: .5rem; }

/* CMS page body copy (spec §57) */
.pk-prose { max-width: 72ch; line-height: 1.7; color: var(--pk-text); }
.pk-prose p { margin-bottom: 1rem; }

/* Club logo / monogram */
.pk-club-logo { flex-shrink: 0; display: inline-block; vertical-align: middle; }
.pk-club-logo--monogram { filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25)); }

/* Homepage "leagues & clubs" marquee (spec §8, §56) */
.pk-marquee {
    position: relative;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.pk-marquee__track {
    display: flex;
    align-items: flex-start;
    gap: 2.25rem;
    width: max-content;
    animation: pk-marquee-scroll 48s linear infinite;
}
.pk-marquee:hover .pk-marquee__track { animation-play-state: paused; }
.pk-marquee__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    width: 84px;
    text-decoration: none;
    opacity: .82;
    transition: opacity .15s ease, transform .15s ease;
}
.pk-marquee__item:hover { opacity: 1; transform: translateY(-2px); }
.pk-marquee__label {
    font-size: .7rem;
    font-weight: 600;
    color: var(--pk-muted);
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
@keyframes pk-marquee-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
    .pk-marquee__track { animation: none; flex-wrap: wrap; width: 100%; justify-content: center; }
    .pk-marquee { mask-image: none; -webkit-mask-image: none; }
    .pk-marquee__item[aria-hidden="true"] { display: none; } /* drop the duplicate loop-pass, not just from a11y */
}

/* Notifications (spec §58) */
.pk-notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--pk-danger);
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}
.pk-notif-menu { width: 320px; max-width: 90vw; max-height: 70vh; overflow-y: auto; }
.pk-notif { border-radius: var(--pk-radius-sm); }
.pk-notif--unread { background: rgba(var(--pk-secondary-rgb), .07); }
.min-width-0 { min-width: 0; }
a.pk-panel { text-decoration: none; transition: border-color .15s ease; }
a.pk-panel:hover { border-color: rgba(var(--pk-primary-rgb), .45); }

.pk-footer { border-top: 1px solid var(--pk-border); background: var(--pk-bg-2); }
.pk-footer a { color: var(--pk-muted); font-weight: 500; }
.pk-footer a:hover { color: var(--pk-text); }

.pk-disclaimer { font-size: .8rem; color: var(--pk-muted); }
.pk-18 {
    display: inline-flex; align-items: center; gap: .4rem;
    border: 1px solid var(--pk-border); border-radius: 999px;
    padding: .2rem .6rem; font-size: .72rem; font-weight: 700; color: var(--pk-muted);
}

/* Bottom nav (mobile, spec §48) */
.pk-bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    display: none;
    background: rgba(11,17,32,.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--pk-border);
}
[data-bs-theme="light"] .pk-bottomnav { background: rgba(255,255,255,.92); }
.pk-bottomnav a { flex: 1; text-align: center; padding: .5rem 0; color: var(--pk-muted); font-size: .68rem; font-weight: 600; }
.pk-bottomnav a i { display: block; font-size: 1.15rem; margin-bottom: .1rem; }
.pk-bottomnav a.active { color: var(--pk-primary); }
@media (max-width: 767.98px) {
    .pk-bottomnav { display: flex; }
    .pk-has-bottomnav { padding-bottom: 4.5rem; }
}
