/* ===========================================================
   Kemet FC — Season Report theme (original brand colors)
   Deep navy + brand gold, matching the app's original palette
   and logo colors, in an editorial "match report" layout.
   This file forces the shared visual language across every
   page's own markup via high-specificity !important overrides,
   since each page ships its own embedded <style> block.
   =========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  color-scheme: dark !important;

  /* Core palette — restored to Kemet FC's original brand colors */
  --navy: #071A2B !important;      /* original app navy — dark panels/buttons */
  --ink: #F4F7FA !important;       /* primary text — white on navy */
  --blue: #2563EB !important;      /* original app blue — links, info badges */
  --green: #16A66A !important;     /* original app green — success accent */
  --lime: #F5C45D !important;      /* original logo gold — primary accent */
  --gold: #C9A45D !important;      /* original secondary gold — muted accent */
  --muted: #8CA1BB !important;     /* original sidebar muted text */
  --line: rgba(244, 247, 250, 0.12) !important;
  --page: #071A2B !important;      /* app background */
  --surface: #0D2A45 !important;   /* panel/card background */
  --white: #F4F7FA !important;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 8px 22px rgba(0, 0, 0, .28);
  --shadow-md: 0 20px 50px rgba(0, 0, 0, .38);
  --ring: 0 0 0 4px rgba(245, 196, 93, .22);

  --alarm: #E1685C;
  --ok: #0D7652;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* ---------- Base ---------- */
body {
  min-height: 100vh !important;
  color: var(--ink) !important;
  background:
    radial-gradient(circle at 8% -5%, rgba(245, 196, 93, .06), transparent 30%),
    radial-gradient(circle at 96% 12%, rgba(37, 99, 235, .05), transparent 28%),
    var(--page) !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif !important;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { color: var(--navy); background: var(--lime); }

a, button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); text-underline-offset: 3px; }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

p { color: var(--muted) !important; }
label { color: var(--muted) !important; letter-spacing: .035em; }
small { color: var(--muted); }

h1, h2, h3, h4, h5, h6 { color: var(--ink) !important; }

/* Big numbers / brand marks — clean, compact, no oversized display face */
header h1,
.brand,
.metric-value,
.stat strong,
.journey-number,
.feature-icon,
#players-count, #teams-count, #analyses-count, #plans-count, #drills-count,
#featured-score, #featured-plans {
  font-family: Inter, ui-sans-serif, sans-serif !important;
  font-weight: 800 !important;
  letter-spacing: -.01em !important;
}

header h1 { font-size: clamp(22px, 2.2vw, 30px) !important; }
.brand { font-size: 18px !important; }
.metric-value, .stat strong, #featured-score { font-size: clamp(20px, 2vw, 26px) !important; }
#players-count, #teams-count, #analyses-count, #plans-count, #drills-count, #featured-plans {
  font-size: 22px !important;
}

/* Muted / meta / mono-leaning data */
.feature-meta, .meta span, .review-meta, .fmeta {
  font-family: "IBM Plex Mono", monospace !important;
}

/* ---------- Header hero ---------- */
header {
  position: relative;
  overflow: hidden;
  border-bottom-color: rgba(245, 196, 93, .3) !important;
  background:
    radial-gradient(circle at 85% 0%, rgba(245, 196, 93, .14), transparent 32%),
    linear-gradient(125deg, #071A2B 0%, #0D2A45 58%, #123655 100%) !important;
  color: var(--ink) !important;
}

header::after {
  position: absolute;
  right: -80px;
  bottom: -120px;
  width: 340px;
  height: 340px;
  border: 1px solid rgba(244, 247, 250, .08);
  border-radius: 50%;
  box-shadow:
    0 0 0 45px rgba(244, 247, 250, .02),
    0 0 0 90px rgba(244, 247, 250, .014);
  content: "";
  pointer-events: none;
}

header h1 { letter-spacing: -.02em; }
header p { max-width: 720px; color: var(--muted) !important; }

/* ---------- Forms ---------- */
input, select, textarea {
  max-width: 100%;
  border-color: rgba(244, 247, 250, .18) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--ink) !important;
  background: rgba(15, 42, 66, .55) !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:hover, select:hover, textarea:hover {
  border-color: rgba(245, 196, 93, .4) !important;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--lime) !important;
  outline: none;
  background: rgba(19, 54, 84, .85) !important;
  box-shadow: var(--ring) !important;
}

input::placeholder, textarea::placeholder { color: rgba(159, 182, 168, .7) !important; }

/* ---------- Buttons ---------- */
button, .button, .quick-link, .watch, .home-link {
  border-radius: var(--radius-sm) !important;
  color: var(--navy) !important;
  background: linear-gradient(135deg, #FDE9BE, var(--lime)) !important;
  font-weight: 700 !important;
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    filter .18s ease,
    background .18s ease;
}

button:not(:disabled):hover, .button:hover, .quick-link:hover,
.watch:hover, .home-link:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 12px 24px rgba(245, 196, 93, .22);
}

button:not(:disabled):active, .button:active, .quick-link:active,
.watch:active, .home-link:active { transform: translateY(0); }

button:disabled { cursor: not-allowed !important; opacity: .45; filter: grayscale(.4); }

/* Secondary / low-emphasis buttons keep a dark treatment */
.secondary, .home-link.secondary, button.secondary {
  color: var(--ink) !important;
  background: rgba(244, 247, 250, .06) !important;
  border: 1px solid rgba(244, 247, 250, .18) !important;
}

/* ---------- Cards / panels / stats ---------- */
.card, .panel, .stat, .toolbar, form:not(#login-form) {
  border-color: var(--line) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-sm) !important;
}

.card, .panel, .stat, .toolbar {
  background: rgba(13, 42, 69, .82) !important;
  color: var(--ink) !important;
}

.card, .panel, .stat {
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.card:hover, .stat:hover {
  border-color: rgba(245, 196, 93, .35) !important;
  box-shadow: var(--shadow-md) !important;
}

/* Small light-background info chips (score tiles, attribute rows, notes,
   recommendation boxes, etc.) keep their own light background from each
   page's own styling — force dark, readable text instead of inheriting
   the card's white text, which made values invisible on light boxes.
   This list was built from a full scan of every page's own <style>
   block for classes with a light/white background. */
.metric:not(.card), .attribute, .recommendation, .item, .plan, .match, .event-card,
.note, .notice, .choice, .rep, .score-fields, .skill,
.error, .delete, .cancelled, .abstained, .rejected, .other,
.action-icon, .approved, .assessment, .bar, .cancel, .completed,
.controls, .day, .delete-drill, .drill, .edit-drill, .empty-icon,
.event, .getting-started, .home-action, .how-it-works, .inactive,
.permission, .quality, .recommendation-form, .score:not(.good):not(.average):not(.low),
.status, .step,
.summary, .tag, .tags, .team-card, .track, .user-card, .video-card, .weakness,
.home-feature, .journey, .meta, .plan-meta, .quick-actions-panel, .calendar-head {
  color: #16233B !important;
}

/* Headings inside light-background boxes are still forced white by the
   global h1-h6 rule above (it targets the heading tag directly, so it
   wins over the container's color even after the fix above) — override
   those specific headings back to dark text. */
.getting-started h2, .quick-actions-panel h2 {
  color: #16233B !important;
}

/* Video/team/user cards render their title as an h1-h6 tag and use the
   dark-context .badge style — both need a light-card-specific override. */
.video-card h1, .video-card h2, .video-card h3,
.team-card h1, .team-card h2, .team-card h3,
.user-card h1, .user-card h2, .user-card h3,
.assessment h1, .assessment h2, .assessment h3,
.event-card h1, .event-card h2, .event-card h3,
.player h1, .player h2, .player h3 {
  color: #16233B !important;
}

.video-card .badge, .team-card .badge, .user-card .badge, .assessment .badge, .item .badge {
  color: #16233B !important;
  background: rgba(16, 35, 59, .07) !important;
  border-color: rgba(16, 35, 59, .16) !important;
}

/* Player list card (players.html) — plain white card, same pattern. */
.player {
  color: #16233B !important;
}
.player .tags span, .player .player-id, .player .player-footer span {
  color: #5B6B7C !important;
}

/* Dashboard shape refresh — rounder cards and icon tiles, same colors.
   Only border-radius / spacing change here, no color values touched. */
.home-feature, .quick-actions-panel, .getting-started, .journey a,
.stat, .panel, .card {
  border-radius: 26px !important;
}

.feature-icon, .action-icon, .stat-icon {
  border-radius: 20px !important;
}

.home-action {
  border-radius: 22px !important;
}

.score-ring {
  border-radius: 50% !important;
}

/* These light boxes hold their own status-colored text (green/orange/red,
   etc.) set directly on a more specific selector in each page — those
   still win over the dark-text rule above because they're more specific,
   so this only fixes elements that had no color of their own. */

.badge, .pill, .meta span {
  border: 1px solid rgba(245, 196, 93, .22) !important;
  border-radius: 999px !important;
  color: var(--ink) !important;
  background: rgba(245, 196, 93, .1) !important;
}

/* ---------- Tables ---------- */
table {
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-md);
  background: #0D2A45 !important;
  box-shadow: var(--shadow-sm);
  color: var(--ink) !important;
}

th {
  color: var(--muted) !important;
  background: #123655 !important;
  font-size: 12px;
  letter-spacing: .055em;
  text-transform: uppercase;
}

th, td { border-bottom-color: var(--line) !important; }

tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgba(244, 247, 250, .04) !important; }

[role="status"] { border-radius: 10px; color: var(--ink) !important; }

/* Error-toned status messages need to stay legible and red-coded */
#login-status:not(:empty),
.error-status,
[role="alert"] {
  color: #FF9B92 !important;
}

.state, .empty, .empty-state {
  border: 1px dashed rgba(244, 247, 250, .2) !important;
  border-radius: var(--radius-md) !important;
  background: rgba(13, 42, 69, .5) !important;
  color: var(--muted) !important;
}

/* ---------- Dashboard shell / nav rail ---------- */
.layout aside {
  border-right: 1px solid rgba(244, 247, 250, .06) !important;
  background:
    radial-gradient(circle at 20% 0%, rgba(245, 196, 93, .08), transparent 28%),
    linear-gradient(180deg, #0D2A45, #051220 88%) !important;
  box-shadow: 16px 0 45px rgba(0, 0, 0, .28) !important;
}

.layout .brand {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center;
  color: var(--lime) !important;
  letter-spacing: -.02em;
}
.layout .brand::before {
  content: "Kemet FC";
  display: block;
  width: 100%;
  padding-top: 92px;
  margin-bottom: 0;
  line-height: 1.1;
  background-image: url("/logo.png");
  background-size: 80px 80px;
  background-repeat: no-repeat;
  background-position: top center;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  color: var(--lime);
}
.layout .brand {
  font-size: 0 !important;
  gap: 0;
}
.layout .brand::after {
  content: "Academy Development";
  display: block;
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
}
.layout .brand small { display: none; }

.layout nav a {
  position: relative;
  border: 1px solid transparent;
  border-radius: 10px !important;
  color: var(--muted) !important;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.layout nav a:hover {
  border-color: rgba(37, 99, 235, .28) !important;
  background: rgba(244, 247, 250, .06) !important;
  color: var(--ink) !important;
  transform: translateX(3px);
}

.layout nav a.active {
  border-color: transparent !important;
  color: #fff !important;
  background: var(--blue) !important;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .35);
  font-weight: 700;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-inline-start: 6px;
  border-radius: 999px;
  color: #fff !important;
  background: #E1685C !important;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}
.nav-badge[hidden] { display: none !important; }

.topbar { padding: 4px 0 6px; }

.layout header.topbar {
  overflow: visible;
  padding: 4px 0 6px;
  border: 0 !important;
  color: var(--ink) !important;
  background: transparent !important;
}
.layout header.topbar::after { display: none; }
.layout header.topbar p { color: var(--muted) !important; }

.quick-link {
  color: var(--navy) !important;
  background: linear-gradient(135deg, #FDE9BE, var(--lime)) !important;
  box-shadow: 0 10px 24px rgba(245, 196, 93, .22);
}

.stat-icon, .avatar {
  color: var(--navy) !important;
  background: linear-gradient(160deg, #FDE9BE, var(--lime)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 8px 18px rgba(0, 0, 0, .25);
}

/* Journey / onboarding steps (real numbered sequence) */
.journey a {
  background: rgba(13, 42, 69, .82) !important;
  border: 1px solid var(--line) !important;
}
.journey a:hover { border-color: rgba(245, 196, 93, .35) !important; transform: translateY(-2px); }
.journey-number {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--lime) !important;
  border: 1px solid rgba(245, 196, 93, .4) !important;
  background: rgba(245, 196, 93, .08) !important;
}

/* ---------- Login ---------- */
#login-form { box-shadow: none !important; }

body:has(#login-form) {
  background:
    radial-gradient(circle at 16% 12%, rgba(245, 196, 93, .1), transparent 30%),
    radial-gradient(circle at 90% 88%, rgba(37, 99, 235, .08), transparent 34%),
    #071A2B !important;
}

body:has(#login-form) > main {
  border: 1px solid rgba(245, 196, 93, .18) !important;
  border-radius: var(--radius-lg) !important;
  background: rgba(13, 42, 69, .96) !important;
  box-shadow: 0 35px 90px rgba(0, 0, 0, .5) !important;
  color: var(--ink) !important;
}

body:has(#login-form) h1 { color: var(--ink) !important; }
body:has(#login-form) .brand { color: var(--ink) !important; font-size: 20px; }
body:has(#login-form) .brand span { color: var(--green) !important; }

body:has(#login-form) label { color: var(--muted) !important; }

body:has(#login-form) button {
  min-height: 50px;
  color: var(--navy) !important;
  background: linear-gradient(135deg, #FDE9BE, var(--lime)) !important;
  box-shadow: 0 12px 26px rgba(245, 196, 93, .25);
}

/* ---------- Drill library ---------- */
.drill-library-page > header { padding: 22px 24px 28px !important; }
.drill-library-page > header h1 { margin: 5px 0 3px; font-size: clamp(22px, 2.2vw, 30px); line-height: 1.1; }
.drill-library-page > header p { margin: 8px 0 0; font-size: 15px; line-height: 1.45; }

.library-hero-inner {
  display: flex; align-items: center; justify-content: space-between;
  width: min(1180px, 100%); margin: 0 auto; gap: 28px;
}
.library-hero-copy { min-width: 0; }
.library-hero-actions { display: flex; flex: 0 0 auto; gap: 10px; }
.library-hero-actions .watch { padding: 10px 16px; white-space: nowrap; }
.library-hero-actions .secondary {
  border: 1px solid rgba(244, 247, 250, .2) !important;
  color: var(--ink) !important;
  background: rgba(244, 247, 250, .06) !important;
}

.drill-library-page > main { width: min(1180px, calc(100% - 32px)); margin: 18px auto 60px; }

.recommendation-form {
  grid-template-columns: minmax(250px, 1.4fr) repeat(3, minmax(150px, 1fr)) !important;
  align-items: start;
  background: linear-gradient(135deg, rgba(13, 42, 69, .9), rgba(9, 33, 54, .9)) !important;
}
.recommendation-form small { display: block; margin-top: 8px; color: var(--muted) !important; line-height: 1.45; }
.recommendation-form .form-actions { grid-column: 1 / -1; justify-content: flex-end; }
.recommendation-form .form-actions button { min-width: 190px; max-width: 230px; white-space: nowrap; }

.inline-action { color: var(--lime) !important; font-weight: 800; text-decoration: none; }
.inline-action:hover { text-decoration: underline; }

.recommendation-form button[type="submit"] {
  background: linear-gradient(135deg, #FDE9BE, var(--lime)) !important;
  color: var(--navy) !important;
}

#save-training-plan {
  background: linear-gradient(135deg, #123655, #071A2B) !important;
  color: var(--ink) !important;
  border: 1px solid rgba(245, 196, 93, .3) !important;
}

.media {
  background:
    radial-gradient(circle at 50% 15%, rgba(245, 196, 93, .1), transparent 34%),
    linear-gradient(145deg, #123655, #071A2B) !important;
}

.category { color: var(--lime) !important; letter-spacing: .08em; }

/* ---------- Status semantics kept legible on dark ---------- */
.status-active, .status-approved, .status-completed { color: var(--ok) !important; }
.status-pending, .status-review, .status-queued { color: var(--lime) !important; }
.status-error, .status-rejected, .status-failed { color: var(--alarm) !important; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .library-hero-inner { align-items: flex-start; flex-direction: column; gap: 16px; }

  .layout { display: block !important; }
  .layout aside { position: static !important; width: 100%; height: auto !important; padding: 16px !important; }
  .layout aside .brand { margin-bottom: 14px !important; }

  .layout nav {
    display: flex !important; flex-wrap: nowrap !important; gap: 8px;
    overflow-x: auto; padding-bottom: 5px; scrollbar-width: none;
  }
  .layout nav::-webkit-scrollbar { display: none; }
  .layout nav a { flex: 0 0 auto; white-space: nowrap; }

  .layout main { padding: 22px 18px 48px !important; }
  .topbar { align-items: flex-start !important; }

  .dashboard-grid, .overview, .player-overview { grid-template-columns: 1fr !important; }
  .recommendation-form { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 640px) {
  .drill-library-page > header { padding: 12px 14px 14px !important; }
  .drill-library-page > header h1 { margin: 2px 0 0; font-size: 20px !important; }
  .drill-library-page > header .label { font-size: 10px; }
  .drill-library-page > header .library-hero-copy > p { display: none; }

  .library-hero-inner { gap: 9px; }
  .library-hero-actions { width: 100%; gap: 7px; }
  .library-hero-actions .watch { flex: 1; padding: 8px 9px; text-align: center; font-size: 12px; }

  .drill-library-page > main { margin-top: 14px !important; }

  body { font-size: 15px; }
  header { padding: 26px 20px 32px !important; }
  header h1 { font-size: clamp(20px, 6vw, 26px) !important; line-height: 1.15; }

  main:not(.layout main) { width: min(100% - 24px, 1180px) !important; margin-top: 18px !important; }

  .topbar { display: grid !important; }
  .topbar .quick-link { width: 100%; text-align: center; }

  #dashboard-stats, .dashboard-grid, .overview, .snapshot, form, .recommendation-form {
    grid-template-columns: 1fr !important;
  }
  .recommendation-form .form-actions { grid-column: auto; }
  .recommendation-form .form-actions button { width: 100%; max-width: none; }

  .form-actions, .actions { display: grid !important; grid-template-columns: 1fr !important; }

  button, .button, .quick-link, .watch, .home-link { min-height: 48px; }

  .card, .panel, .stat, .toolbar, form:not(#login-form) { border-radius: 16px !important; }

  table { display: block; overflow-x: auto; white-space: nowrap; }

  /* Mobile bottom nav, if a page provides one */
  .mobile-nav {
    background: #0D2A45 !important;
    border-top: 1px solid var(--line) !important;
  }
  .mobile-nav a { color: var(--muted) !important; }
  .mobile-nav a.active { color: var(--lime) !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
