/* ═══════════════════════════════════════════════════════════════
   dashboard.css — Topline dashboard
   ═══════════════════════════════════════════════════════════════ */

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.dash-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
  flex-wrap: wrap; gap: var(--gap-sm);
}
.dash-sub {
  font-size: 0.8rem; font-weight: 300;
  color: var(--muted); margin-top: 4px; letter-spacing: 0.02em;
}
.dash-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* ── STAT STRIP ──────────────────────────────────────────────── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap-sm);
  margin-bottom: var(--gap-md);
}
.stat-tile {
  background: var(--cream);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat-tile::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--terra), var(--sage));
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.3s ease;
}
.stat-tile:hover::after { transform: scaleX(1); }
.stat-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.2rem; font-weight: 400;
  color: var(--charcoal); line-height: 1;
}
.stat-label {
  font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--muted); margin-top: 6px;
}

/* ── DL ──────────────────────────────────────────────────────── */
dl { display: grid; grid-gap: 4px 16px; grid-template-columns: max-content; font-size: 0.9rem; }
dt { font-weight: bold; }
dd { margin: 0; grid-column-start: 2; }

/* ── MAIN GRID ───────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--gap-md);
  align-items: start;
}
.dash-left  { display: flex; flex-direction: column; gap: var(--gap-md); }
.dash-right { display: flex; flex-direction: column; gap: var(--gap-md); }

/* ── MOBILE NOTIFICATIONS (above horses on mobile) ───────────── */
.dash-top-aside { display: none; margin-bottom: var(--gap-md); }
.dash-right-notif { display: block; }

/* ── UPCOMING SHOWS ──────────────────────────────────────────── */
.upcoming-shows-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap-sm);
  margin-bottom: var(--gap-md);
}
.upcoming-show-card {
  background: var(--sage);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex; flex-direction: column; gap: 8px;
  position: relative; overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer; text-decoration: none;
}
.upcoming-show-card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 0% 110%, rgba(0,0,0,0.15) 0%, transparent 60%);
  pointer-events: none;
}
.upcoming-show-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.upcoming-show-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: .5rem; min-width: 0;
}
.upcoming-show-top .disc-pills {
  display: flex; flex-wrap: wrap; gap: 4px;
  flex: 1; min-width: 0; overflow: hidden; max-height: 4rem;
}
.upcoming-show-card .disc-pills .disc {
  background: rgba(255,255,255,0.18); color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
}
.upcoming-show-countdown {
  display: flex; flex-direction: column;
  align-items: flex-end; flex-shrink: 0;
}
.upcoming-days-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem; font-weight: 300; color: var(--cream); line-height: 1;
}
.upcoming-days-label {
  font-size: 0.58rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(253,250,245,0.55);
}
.upcoming-show-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem; font-weight: 400; color: var(--cream); line-height: 1.3;
}
.upcoming-show-meta {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-size: 0.68rem; font-weight: 300;
  color: rgba(253,250,245,0.6); letter-spacing: 0.02em;
}
.upcoming-show-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.15);
}
.upcoming-entered {
  font-size: 0.65rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--cream); background: rgba(255,255,255,0.15);
  padding: 3px 8px; border-radius: var(--radius);
}
.upcoming-enter {
  font-size: 0.65rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(253,250,245,0.8); transition: color 0.2s;
}
.upcoming-show-card:hover .upcoming-enter { color: var(--cream); }
.upcoming-entries-count {
  font-size: 0.62rem; font-weight: 300; color: rgba(253,250,245,0.45);
}

/* ── CARD COMMON ─────────────────────────────────────────────── */
.card { overflow: visible; }
.card-link {
  font-size: 0.65rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--terra); transition: color 0.2s;
}
.card-link:hover { color: var(--terra-lt); }
.empty-state {
  font-size: 0.8rem; font-weight: 300;
  color: var(--muted); padding: 1.5rem 0;
  text-align: center; letter-spacing: 0.02em;
}
.empty-state a { color: var(--terra); }
.empty-state a:hover { text-decoration: underline; }

/* ── TABLE SCROLL ────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── HORSE TABLE ─────────────────────────────────────────────── */
.horse-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.horse-table thead th {
  font-size: 0.6rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); text-align: left;
  padding: 0 10px 10px; border-bottom: 1px solid var(--border-dark);
}
.horse-table thead th:first-child { padding-left: 0; }
.horse-row { cursor: pointer; transition: background 0.15s; }
.horse-row:hover td { background: var(--parchment); }
.horse-row td {
  padding: 11px 10px; border-bottom: 1px solid var(--border-dark);
  vertical-align: middle; transition: background 0.15s;
}
.horse-row td:first-child { padding-left: 0; }
.horse-row:last-child td { border-bottom: none; }
.horse-name-cell { display: flex; align-items: center; gap: 10px; }
.horse-dot {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 600; flex-shrink: 0;
}
.horse-name { font-size: 0.85rem; font-weight: 400; color: var(--charcoal); }

/* ── RESULTS TABLE ───────────────────────────────────────────── */
.results-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.results-table thead th {
  font-size: 0.6rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); text-align: left;
  padding: 0 10px 10px; border-bottom: 1px solid var(--border-dark);
}
.results-table thead th:first-child { padding-left: 0; }
.results-table tbody tr:hover td { background: var(--parchment); }
.results-table tbody td {
  padding: 10px 10px; border-bottom: 1px solid var(--border-dark); vertical-align: middle;
}
.results-table tbody td:first-child { padding-left: 0; }
.results-table tbody tr:last-child td { border-bottom: none; }
.result-show { font-weight: 400; color: var(--charcoal); }
.placing { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; padding: 2px 8px; border-radius: var(--radius); }
.placing-gold    { background: #fdf3d0; color: #8a6a00; }
.placing-silver  { background: #f0f0f0; color: #555; }
.placing-bronze  { background: #fce8d8; color: #7a3d10; }
.placing-default { background: var(--parchment); color: var(--muted); }

/* ── NOTIFICATIONS ───────────────────────────────────────────── */
.notif-list { list-style: none; display: flex; flex-direction: column; }
.notif-item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 0.85rem 0; border-bottom: 1px solid var(--border-dark);
}
.notif-item:last-child { border-bottom: none; }
.notif-body { font-size: 0.8rem; font-weight: 300; color: var(--charcoal); line-height: 1.5; }
.notif-body a { color: var(--terra); }
.notif-body a:hover { text-decoration: underline; }
.notif-body strong { font-weight: 500; }
.notif-time { font-size: 0.62rem; letter-spacing: 0.06em; color: var(--muted); }

/* ── WELCOME BANNER ──────────────────────────────────────────── */
.welcome-banner {
  background: var(--charcoal); border-radius: var(--radius);
  padding: 2.5rem; margin-bottom: var(--gap-md);
  position: relative; overflow: hidden;
}
.welcome-banner::before {
  content: ''; position: absolute; inset: 0;
  background:
          radial-gradient(ellipse 60% 80% at 0% 100%, rgba(107,124,94,0.2) 0%, transparent 55%),
          radial-gradient(ellipse 40% 60% at 100% 0%, rgba(184,92,56,0.12) 0%, transparent 50%);
  pointer-events: none;
}
.welcome-banner::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--terra), var(--sage));
}
.welcome-inner {
  position: relative; z-index: 1;
  display: flex; align-items: center;
  justify-content: space-between; gap: var(--gap-lg); flex-wrap: wrap;
}
.welcome-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem; font-weight: 300; color: var(--cream); margin-bottom: 0.4rem;
}
.welcome-body {
  font-size: 0.8rem; font-weight: 300;
  color: rgba(221,229,216,0.55); line-height: 1.8; max-width: 420px;
}

.horse-table-mobile { display: none; }
/* ── DISCIPLINE TAGS ─────────────────────────────────────────── */
.disc-ws { background: rgba(139,90,20,0.12);  color: #7a4f10; }
.disc-dv { background: rgba(60,80,100,0.12);  color: #3a5060; }
.disc-cd { background: rgba(80,60,100,0.12);  color: #4a3860; }

/* ═══════════════════════════════════════════════════════════════
   TABLET — 1024px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .upcoming-shows-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-md);
  }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE — 768px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Page header */
  .dash-header { flex-direction: column; align-items: flex-start; }
  .dash-actions {
    width: 100%; display: grid;
    grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .dash-actions .btn { justify-content: center; font-size: 0.65rem; padding: 10px 8px; }

  /* Stat strip — 2×2 */
  .stat-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-tile  { padding: 1rem; }
  .stat-num   { font-size: 1.8rem; }

  /* Upcoming shows — 2 col */
  .upcoming-shows-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .upcoming-days-num   { font-size: 1.6rem; }
  .upcoming-show-name  { font-size: 0.92rem; }

  /* Main grid — single column */
  .dash-grid { grid-template-columns: 1fr; }

  /* Right column — stack vertically */
  .dash-right {
    display: flex; flex-direction: column;
    gap: var(--gap-sm);
    overflow-x: unset; padding-bottom: 0; scroll-snap-type: unset;
  }
  .dash-right .card { min-width: unset; scroll-snap-align: unset; flex-shrink: unset; }

  /* Mobile notifications — show above horses, hide in sidebar */
  .dash-top-aside   { display: block; }
  .dash-right-notif { display: none; }

  /* Hide desktop table, show mobile cards */
  .horse-table        { display: none; }
  .horse-table-mobile { display: flex; flex-direction: column; gap: 8px; max-width: 768px; }
  .horse-mobile-card {
    display: flex; align-items: center; gap: 12px;
    max-width: 100%; padding: 10px 12px;
    background: var(--parchment); border: 1px solid var(--border-dark);
    border-radius: var(--radius); cursor: pointer; transition: background 0.15s;
  }
  .horse-mobile-card:hover,
  .horse-mobile-card:active { background: var(--sage-pale); }
  .horse-mobile-info { flex: 1; min-width: 0; }
  .horse-mobile-name {
    font-size: 0.9rem; font-weight: 400; color: var(--charcoal);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .horse-mobile-meta {
    font-size: 0.68rem; font-weight: 300; color: var(--muted); margin-top: 3px;
    display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  }
  .horse-mobile-coat {
    font-size: 0.65rem; font-weight: 300; color: var(--muted); margin-top: 2px;
    white-space: normal; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }

  /* Results table */
  .card { overflow: hidden; }
  .results-table thead th:last-child,
  .results-table tbody td:last-child { display: none; }
  .results-table thead th,
  .results-table tbody td { padding: 8px 6px; }
  .results-table thead th:first-child,
  .results-table tbody td:first-child { padding-left: 0; }
  .results-table { min-width: 360px; }

  /* Welcome banner */
  .welcome-banner { padding: 1.5rem; }
  .welcome-inner  { flex-direction: column; gap: var(--gap-sm); }
  .welcome-inner .btn { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════════
   SMALL MOBILE — 400px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 400px) {
  .dash-actions    { grid-template-columns: 1fr; }
  .stat-strip      { grid-template-columns: 1fr 1fr; }
  .stat-num        { font-size: 1.6rem; }
  .dash-grid       { grid-template-columns: 1fr; }
  .upcoming-shows-grid { grid-template-columns: 1fr 1fr; }
}