/* ==========================================================================
   TSUFM — Responsive App Layout, Player Cards, Tables & Modals
   ========================================================================== */

.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Shell: Desktop Sidebar + Main | Mobile Top Bar + Bottom Nav */
.career-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
}

.sidebar-nav {
  display: none;
  width: 232px;
  flex-shrink: 0;
  background: rgba(9, 15, 29, 0.94);
  border-right: 1px solid var(--border-subtle);
  padding: 18px 12px;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}

.brand-logo-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #059669, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #03150e;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.35);
}

.brand-text h1 {
  font-size: 24px;
  line-height: 0.95;
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, #f8fafc, #38bdf8, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.14s ease;
  position: relative;
  text-align: left;
}

.nav-item:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.08));
  border-color: rgba(16, 185, 129, 0.42);
  color: #34d399;
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--accent-fire);
  color: #fff;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(74px + var(--safe-bottom));
}

/* Sticky Top HUD Bar */
.top-hud {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(8, 13, 24, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.hud-player-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hud-ovr-pill {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: linear-gradient(145deg, #1f2937, #0f172a);
  color: #fbbf24;
  flex-shrink: 0;
}
.hud-ovr-pill small {
  font-size: 9px;
  opacity: 0.8;
  letter-spacing: 0.04em;
}
.hud-ovr-pill span {
  font-size: 18px;
}

.hud-meta {
  min-width: 0;
}
.hud-meta .hud-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-meta .hud-sub {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-stats-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hud-stat-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.14s ease;
}
.icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-bright);
  background: var(--bg-surface-2);
}

/* Main Content Area */
.content-wrap {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Mobile Bottom Nav */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: rgba(8, 13, 25, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-med);
  padding: 6px 4px calc(6px + var(--safe-bottom));
}

.bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 4px 2px;
  cursor: pointer;
  position: relative;
}

.bottom-nav-btn.active {
  color: var(--accent-pitch-bright);
}

.bottom-nav-btn .nav-dot {
  position: absolute;
  top: 2px;
  right: 16%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--accent-fire);
  color: #fff;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive Grids */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

@media (min-width: 680px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .content-wrap { padding: 18px 22px; gap: 16px; }
}

@media (min-width: 980px) {
  .sidebar-nav { display: flex; }
  .bottom-nav { display: none; }
  .main-column { padding-bottom: 24px; }
  .dashboard-grid {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }
}

/* ==========================================================================
   FIFA / FM Ultimate Player OVR Card
   ========================================================================== */
.player-card {
  position: relative;
  border-radius: 18px;
  padding: 18px 16px 16px;
  overflow: hidden;
  border: 2px solid rgba(251, 191, 36, 0.55);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(-30deg, rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 2px, transparent 2px, transparent 10px),
    radial-gradient(circle at 80% 15%, rgba(255,255,255,0.16), transparent 48%);
  pointer-events: none;
}

.player-card.tier-bronze {
  background: linear-gradient(155deg, #5c3a21 0%, #2c1b10 55%, #160e09 100%);
  border-color: #b47b49;
}
.player-card.tier-silver {
  background: linear-gradient(155deg, #64748b 0%, #334155 55%, #151e2c 100%);
  border-color: #cbd5e1;
}
.player-card.tier-gold {
  background: linear-gradient(155deg, #a16207 0%, #5e3b09 50%, #1d1508 100%);
  border-color: #fbbf24;
  box-shadow: 0 14px 38px rgba(245, 158, 11, 0.25);
}
.player-card.tier-elite {
  background: linear-gradient(155deg, #0e7490 0%, #1e3a8a 48%, #0c1326 100%);
  border-color: #38bdf8;
  box-shadow: 0 14px 40px rgba(6, 182, 212, 0.34);
}
.player-card.tier-icon {
  background: linear-gradient(155deg, #1f192f 0%, #3b2609 42%, #0a0c14 100%);
  border-color: #fde047;
  box-shadow: 0 14px 44px rgba(250, 204, 21, 0.42);
}

.pc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.pc-rating-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  min-width: 64px;
}
.pc-ovr {
  font-family: var(--font-display);
  font-size: 54px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 3px 14px rgba(0,0,0,0.6);
}
.pc-pos {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fde68a;
  margin-top: -2px;
}
.pc-badges-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.pc-jersey-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 4px;
}

.pc-name-plate {
  position: relative;
  z-index: 1;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.2);
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding: 7px 4px;
}
.pc-name-plate h2 {
  font-size: 26px;
  letter-spacing: 0.05em;
  color: #fff;
}
.pc-name-plate .pc-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.78);
  margin-top: 2px;
}

.pc-stats-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px 14px;
  padding: 2px 6px;
}

.pc-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}
.pc-stat-row .lbl { color: rgba(255,255,255,0.72); font-size: 14px; }
.pc-stat-row .val { color: #fff; }

/* ==========================================================================
   Tables (League Standings, Top Scorers, Records)
   ========================================================================== */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.fm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.fm-table th {
  text-align: left;
  padding: 8px 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-med);
  white-space: nowrap;
}

.fm-table td {
  padding: 8px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: middle;
  white-space: nowrap;
}

.fm-table tr.row-user {
  background: rgba(16, 185, 129, 0.14);
}
.fm-table tr.row-user td:first-child {
  box-shadow: inset 3px 0 0 #10b981;
}
.fm-table tr.row-promo td:first-child {
  box-shadow: inset 3px 0 0 #38bdf8;
}
.fm-table tr.row-releg td:first-child {
  box-shadow: inset 3px 0 0 #ef4444;
}

.club-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.form-dots {
  display: inline-flex;
  gap: 3px;
}
.form-dot {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.form-dot.W { background: rgba(16, 185, 129, 0.25); color: #34d399; }
.form-dot.D { background: rgba(245, 158, 11, 0.22); color: #fbbf24; }
.form-dot.L { background: rgba(239, 68, 68, 0.24); color: #fb7185; }

/* Sub-tabs */
.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 2px;
}
.tab-btn {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.14s ease;
}
.tab-btn.active {
  background: rgba(6, 182, 212, 0.18);
  border-color: rgba(56, 189, 248, 0.55);
  color: #38bdf8;
}

/* Inbox & List Items */
.list-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mail-card {
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(12, 19, 35, 0.85);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.mail-card:hover {
  border-color: var(--border-bright);
  background: rgba(18, 29, 52, 0.92);
}
.mail-card.unread {
  border-left: 3px solid var(--accent-cyan-bright);
  background: rgba(14, 28, 48, 0.95);
}
.mail-card.urgent {
  border-left: 3px solid var(--accent-gold-bright);
}

/* Mentality Spectrum Bar (Kapitan vs Egoista) */
.spectrum-bar {
  position: relative;
  height: 14px;
  border-radius: 99px;
  background: linear-gradient(90deg, #0ea5e9 0%, #334155 50%, #f43f5e 100%);
  border: 1px solid var(--border-med);
}
.spectrum-marker {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #0a101d;
  box-shadow: 0 0 12px rgba(255,255,255,0.8);
  transform: translate(-50%, -50%);
  transition: left 0.35s ease;
}

/* Title & Character Creation Screen */
.hero-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.hero-card {
  width: 100%;
  max-width: 820px;
  background: linear-gradient(175deg, rgba(16, 26, 48, 0.96) 0%, rgba(9, 15, 28, 0.98) 100%);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 22px;
  padding: 26px 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}

.hero-title {
  font-size: clamp(40px, 8vw, 68px);
  font-weight: 800;
  font-style: italic;
  line-height: 0.95;
  background: linear-gradient(90deg, #ffffff 0%, #38bdf8 48%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 10px;
}

.choice-tile {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(11, 18, 33, 0.85);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  color: var(--text-primary);
}
.choice-tile:hover {
  border-color: var(--border-bright);
  background: rgba(20, 34, 58, 0.9);
}
.choice-tile.selected {
  border-color: #34d399;
  background: rgba(16, 185, 129, 0.16);
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.22);
}

/* Modals & Toasts */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 7, 16, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #131f38 0%, #0b1324 100%);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.72);
  animation: slideUp 0.2s ease-out;
}

.toast-root {
  position: fixed;
  bottom: calc(76px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(350px, calc(100vw - 24px));
  pointer-events: none;
}

@media (min-width: 980px) {
  .toast-root {
    bottom: 20px;
    left: auto;
    right: 20px;
    transform: none;
    width: 340px;
  }
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: rgba(13, 22, 41, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  font-weight: 600;
  animation: slideUp 0.2s ease-out;
}
.toast-item.gold { border-color: rgba(251, 191, 36, 0.7); }
.toast-item.fire { border-color: rgba(244, 63, 94, 0.7); }
.toast-item.pitch { border-color: rgba(52, 211, 153, 0.7); }

/* ==========================================================================
   v3.0: Formation Board SVG, 3x3 Pitch Heatmap & Goal Target Analytics
   ========================================================================== */
.tactics-board-wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid rgba(52, 211, 153, 0.4);
  background: #0d3a22;
}
.tactics-board-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

.heatmap-pitch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(52, 211, 153, 0.45);
  background: linear-gradient(180deg, #0b3a22 0%, #10492b 50%, #0b3a22 100%);
}
.heatmap-cell {
  padding: 14px 6px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.heatmap-cell .hm-zone {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.78);
}
.heatmap-cell .hm-val {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
}

.goal-corners-analytics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 3px solid rgba(248, 250, 252, 0.75);
  border-bottom: 2px dashed rgba(52, 211, 153, 0.5);
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0, rgba(255,255,255,0.05) 1px, transparent 1px, transparent 14px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0, rgba(255,255,255,0.05) 1px, transparent 1px, transparent 14px),
    rgba(6, 28, 18, 0.85);
}
.goal-corner-stat {
  padding: 10px 8px;
  border-radius: 8px;
  background: rgba(12, 20, 38, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.3);
  text-align: center;
}
.goal-corner-stat.best {
  border-color: #fde047;
  background: rgba(251, 191, 36, 0.18);
}

.comp-vs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: center;
}
@media (min-width: 560px) {
  .comp-vs-grid {
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
  }
}
