﻿:root {
  --ff-radius: 18px;
  --ff-radius-sm: 12px;
  --ff-shadow: 0 24px 48px rgba(15, 23, 42, 0.12);
  --ff-border: rgba(255, 255, 255, 0.12);
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-strong: #eef2f7;
  --text: #101827;
  --muted: #5f6f8d;
  --border: rgba(15, 23, 42, 0.08);
  --primary: #009688;
  --primary-text: #ffffff;
  --accent: #00C2A8;
}

html[data-bs-theme="dark"] {
  --bg: #0D1117;
  --surface: #1A1F26;
  --surface-strong: #252C35;
  --text: #E6E8EA;
  --muted: #8899a6;
  --border: rgba(230, 232, 234, 0.12);
  --primary: #00C2A8;
  --primary-text: #0D1117;
  --accent: #00C2A8;
}

html[data-bs-theme="light"] {
  color-scheme: light;
}

html[data-bs-theme="dark"] {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(0, 194, 168, 0.08), transparent 30%),
              radial-gradient(circle at bottom right, rgba(0, 194, 168, 0.05), transparent 28%),
              var(--bg);
  color: var(--text);
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.theme-navbar {
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px);
}

html[data-bs-theme="dark"] .theme-navbar {
  background: rgba(15, 23, 42, 0.94);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* ── League sub-navigation ─────────────────────────────────────────────── */
.league-subnav {
  background: rgba(255, 255, 255, 0.75);
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  backdrop-filter: blur(12px);
}

html[data-bs-theme="dark"] .league-subnav {
  background: rgba(15, 23, 42, 0.82);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.league-subnav .navbar-text {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.league-subnav-link {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 0.3rem 0.65rem !important;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.league-subnav-link:hover {
  color: var(--text);
  background: var(--surface-strong);
}

.league-subnav-link.active {
  color: var(--primary-text);
  background: var(--primary);
  font-weight: 600;
}

html[data-bs-theme="dark"] .league-subnav-link.active {
  color: #0f172a;
}

.navbar-brand {
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  font-weight: 700;
}

.theme-navbar .navbar-brand,
.theme-navbar .navbar-brand:hover,
.theme-navbar .navbar-brand:focus {
  color: var(--text);
}

.main-shell {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--ff-radius);
  box-shadow: var(--ff-shadow);
}

.card .card-body {
  padding: 1.5rem;
}

.btn {
  border-radius: 999px;
}

.btn-primary,
.btn-outline-primary {
  border-color: transparent;
}

.btn-outline-primary {
  color: var(--primary);
  border-color: rgba(0, 194, 168, 0.35);
}

..btn-outline-light {
  border-color: rgba(255, 255, 255, 0.2);
}

html[data-bs-theme="light"] .btn-outline-light {
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.15);
  background: rgba(255, 255, 255, 0.92);
}

html[data-bs-theme="light"] .theme-navbar .btn-outline-light {
  color: var(--text);
}

.btn-primary:hover,
.btn-outline-primary:hover,
.btn-outline-light:hover {
  transform: translateY(-1px);
}

.btn-sm {
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
}

.table {
  color: var(--text);
}

.table thead th {
  font-size: 0.9rem;
  font-weight: 700;
  opacity: 0.9;
  border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
  background: rgba(0, 194, 168, 0.06);
}

.alert {
  border-radius: 16px;
}

.form-control,
.form-select {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
}

.form-control:focus,
.form-select:focus,
.btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(0, 194, 168, 0.3);
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header .h4,
.page-header h1,
.page-header h2 {
  margin-bottom: 0;
}

.section-card {
  margin-bottom: 1rem;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  opacity: 0.85;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.action-bar form {
  margin: 0;
}

.list-group-item {
  border-left: 0;
  border-right: 0;
  background: transparent;
}

.list-group-item:first-child {
  border-top: 0;
}

.list-group-item:last-child {
  border-bottom: 0;
}

.ff-table-wrap {
  overflow-x: auto;
}

.ff-muted {
  opacity: 0.75;
}

.ff-mono {
  font-variant-numeric: tabular-nums;
}

.section-card-surface {
  background: var(--surface-strong) !important;
  color: var(--text);
}

/* ── Spinner overlay ── */
#ff-spinner-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
}
#ff-spinner-overlay.active {
  display: grid;
}
#ff-spinner-overlay .spinner-border {
  width: 3rem;
  height: 3rem;
  border-width: 0.3rem;
  color: var(--primary);
}

.dashboard-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 992px) {
  .dashboard-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-grid.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* ── Accent color usage (draft board & league pages) ── */
.table-warning {
  background-color: color-mix(in srgb, var(--accent) 18%, transparent) !important;
  color: var(--text) !important;
}

.alert-success {
  border-left: 4px solid var(--accent);
}

.draft-widget .card {
  border-top: 3px solid var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Sidebar layout
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --sidebar-w: 240px;
  --sidebar-icon-w: 58px;
  --navbar-h: 52px; /* overridden by JS at runtime */
}

/* ── Flex wrapper ── */
.ff-layout {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--navbar-h));
}

/* ── Standalone (no league) ── */
.ff-standalone {
  padding: 1.5rem 2rem 2rem;
}

/* ── Sidebar ── */
.ff-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #0D1117;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: var(--navbar-h);
  height: calc(100vh - var(--navbar-h));
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.22s cubic-bezier(.4, 0, .2, 1),
              min-width 0.22s cubic-bezier(.4, 0, .2, 1);
  z-index: 100;
}

/* Slim scrollbar inside sidebar */
.ff-sidebar::-webkit-scrollbar { width: 4px; }
.ff-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

html[data-bs-theme="dark"] .ff-sidebar {
  background: #0D1117;
  border-right-color: rgba(255, 255, 255, 0.05);
}

.ff-sidebar.ff-sidebar-collapsed {
  width: var(--sidebar-icon-w);
  min-width: var(--sidebar-icon-w);
}

/* ── Sidebar header ── */
.ff-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0.85rem 0.75rem 1rem;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  gap: 0.5rem;
}

.ff-sidebar-header > .ff-sidebar-label {
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 0%;
  transition: opacity 0.18s, width 0.18s;
}

.ff-sidebar.ff-sidebar-collapsed .ff-sidebar-header > .ff-sidebar-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* ── Toggle button ── */
.ff-sidebar-toggle-btn {
  color: rgba(255, 255, 255, 0.55) !important;
  padding: 0.22rem 0.4rem !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.13) !important;
  font-size: 0.95rem;
  line-height: 1.2;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.ff-sidebar-toggle-btn:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.1) !important;
}

.ff-sidebar-toggle-btn .bi {
  transition: transform 0.22s ease;
}

/* ── Section headers ── */
.ff-sidebar-section-header {
  padding: 0.85rem 1rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s;
}

.ff-sidebar.ff-sidebar-collapsed .ff-sidebar-section-header {
  opacity: 0;
  padding-top: 0.5rem;
  padding-bottom: 0.1rem;
}

/* ── Nav links ── */
.ff-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.15s, color 0.15s, padding 0.22s;
}

.ff-sidebar-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.ff-sidebar-link.active {
  color: #fff;
  background: rgba(0, 194, 168, 0.15);
  border-left: 3px solid var(--primary, #00C2A8);
  padding-left: calc(1rem - 3px);
}

.ff-sidebar-link.active .ff-sidebar-icon {
  color: #00C2A8;
}

/* ── Icons ── */
.ff-sidebar-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 1.2rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  transition: color 0.15s;
}

.ff-sidebar-link:hover .ff-sidebar-icon {
  color: rgba(255, 255, 255, 0.9);
}

/* ── Label hide when collapsed ── */
.ff-sidebar .ff-sidebar-label {
  transition: opacity 0.15s, width 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ff-sidebar.ff-sidebar-collapsed .ff-sidebar-label {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.ff-sidebar.ff-sidebar-collapsed .ff-sidebar-link {
  justify-content: center;
  padding: 0.55rem;
  gap: 0;
}

.ff-sidebar.ff-sidebar-collapsed .ff-sidebar-link.active {
  border-left-width: 2px;
  padding-left: calc(0.55rem - 2px);
}

/* ── Footer ── */
.ff-sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-bottom: 0.5rem;
  flex-shrink: 0;
}

/* ── Main content area ── */
.ff-main {
  flex: 1 1 0%;
  min-width: 0;
  padding: 1.5rem 2rem 2.5rem;
}

/* ── Mobile sidebar ── */
@media (max-width: 991.98px) {
  .ff-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.22s ease, width 0.22s ease;
    z-index: 1050;
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
  }

  .ff-sidebar.ff-sidebar-mobile-open {
    transform: translateX(0);
  }

  .ff-main {
    padding: 1rem 1rem 2rem;
  }

  .ff-standalone {
    padding: 1rem 1rem 2rem;
  }
}

/* Button-based sidebar links (theme toggle, logout) */
button.ff-sidebar-link {
  cursor: pointer;
  appearance: none;
  line-height: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
}

button.ff-sidebar-link:hover {
  color: #fff;
}

/* Mobile sidebar backdrop */
.ff-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1049;
  backdrop-filter: blur(2px);
}

.ff-sidebar-backdrop.show {
  display: block;
}
