/* ─── Edge Platform ─── */
:root {
  --bg: #0a0e17;
  --bg2: #111827;
  --bg3: #1f2937;
  --text: #e5e7eb;
  --text2: #9ca3af;
  --accent: #3b82f6;
  --accent2: #60a5fa;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --orange: #f97316;
  --border: #374151;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--accent), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-item {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--text2);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { 
  color: var(--accent2); 
  background: rgba(59, 130, 246, 0.1);
  border-left-color: var(--accent);
}

/* ─── Content ─── */
.content {
  margin-left: 220px;
  padding: 2rem 2rem;
  flex: 1;
  width: calc(100vw - 220px);
  max-width: none;
}

h1 { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.subtitle { color: var(--text2); margin-bottom: 2rem; font-size: 1.1rem; }

/* ─── Cards ─── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card.wide { 
  grid-column: 1 / -1; 
  overflow-x: auto;
}
.card h3 { margin-bottom: 1rem; font-size: 1.1rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  text-align: center;
}

.num, .big-num { font-weight: 700; }
.num { font-size: 1.3rem; color: var(--accent2); }
.big-num { font-size: 2.5rem; }
.green { color: var(--green); }
.red { color: var(--red); }
.meta { color: var(--text2); font-size: 0.85rem; margin-top: 0.5rem; }

/* ─── Tables ─── */
table {
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

th, td {
  padding: 0.4rem 0.4rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th { 
  color: var(--text2); 
  font-weight: 600; 
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.4rem 0.3rem;
}

td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover { background: rgba(255,255,255,0.03); }

/* Resizable columns */
th .resize-handle {
  background: transparent;
  transition: all 0.2s;
  z-index: 10;
}
th:hover .resize-handle {
  background: rgba(59, 130, 246, 0.2);
}
th .resize-handle:hover {
  background: rgba(59, 130, 246, 0.4) !important;
}
th .resize-handle:hover > div {
  opacity: 1 !important;
  background: var(--accent) !important;
  width: 4px !important;
  height: 30px !important;
}
/* Show resize cursor on entire header when hovering near edge */
th {
  position: relative;
  user-select: none;
}
th:hover {
  background: rgba(59, 130, 246, 0.03);
}

/* Compact column widths */
table th:nth-child(1), table td:nth-child(1) { width: 25px; text-align: center; font-size: 0.7rem; } /* # */
table th:nth-child(2), table td:nth-child(2) { width: 100px; white-space: normal; font-size: 0.75rem; } /* Igrač */
table th:nth-child(3), table td:nth-child(3) { width: 40px; text-align: center; font-size: 0.7rem; } /* Tim */
table th:nth-child(4), table td:nth-child(4) { width: 120px; white-space: normal; font-size: 0.7rem; line-height: 1.2; } /* Utakmica */
table th:nth-child(5), table td:nth-child(5) { width: 55px; text-align: center; font-size: 0.7rem; } /* Crobet linija */
table th:nth-child(6), table td:nth-child(6) { width: 55px; font-size: 0.7rem; } /* Pinnacle */
table th:nth-child(7), table td:nth-child(7) { width: 45px; } /* PPG */
table th:nth-child(8), table td:nth-child(8) { width: 45px; } /* L10 */
table th:nth-child(9), table td:nth-child(9) { width: 55px; font-size: 0.7rem; } /* Hit% */
table th:nth-child(10), table td:nth-child(10) { width: 45px; } /* Crobet vs Pinnacle */
table th:nth-child(11), table td:nth-child(11) { width: 50px; } /* Edge */
table th:nth-child(12), table td:nth-child(12) { width: 65px; font-size: 0.7rem; } /* Score */
table th:nth-child(13), table td:nth-child(13) { width: 50px; } /* Soft */
table th:nth-child(14), table td:nth-child(14) { width: 35px; } /* σ */
table th:nth-child(15), table td:nth-child(15) { width: 40px; } /* FG% */
table th:nth-child(16), table td:nth-child(16) { width: 70px; font-size: 0.7rem; } /* Verdict */
table th:nth-child(17), table td:nth-child(17) { width: 100px; white-space: normal; font-size: 0.65rem; line-height: 1.25; padding: 0.3rem; } /* Brave */

/* ─── Upload Zone ─── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}

.upload-icon { font-size: 3rem; margin-bottom: 1rem; }
.upload-zone h3 { margin-bottom: 0.5rem; }
.upload-zone p { color: var(--text2); margin-bottom: 1rem; }

/* ─── Buttons ─── */
.btn {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn:hover { background: var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover { background: var(--accent2); }

/* ─── Forms ─── */
.form-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.form-row label { color: var(--text2); font-weight: 600; }

input[type="date"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  color: var(--text);
  font-size: 0.9rem;
}

/* ─── Progress ─── */
.progress-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s;
  width: 0%;
}

/* ─── Image Grid ─── */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.image-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.2s;
}

.image-card img:hover { transform: scale(1.05); }

.image-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text2);
  margin-top: 0.4rem;
}

/* ─── Game Rows ─── */
.game-row {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.game-row .teams {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.game-row .score { font-weight: 700; font-size: 1.3rem; }
.game-row .team { font-weight: 600; }
.game-row.finished { border-left: 3px solid var(--green); }
.game-row.live { border-left: 3px solid var(--yellow); }
.game-row.scheduled { border-left: 3px solid var(--text2); }

.performers {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text2);
}

.performer strong { color: var(--accent2); }

/* ─── Badges ─── */
.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-badge.finished, .status-badge.won { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.status-badge.live { background: rgba(245, 158, 11, 0.15); color: var(--yellow); }
.status-badge.scheduled, .status-badge.pending { background: rgba(156, 163, 175, 0.15); color: var(--text2); }
.status-badge.lost { background: rgba(239, 68, 68, 0.15); color: var(--red); }

.badge { padding: 0.3rem 0.6rem; border-radius: 4px; font-size: 0.8rem; margin-right: 0.5rem; }
.badge.strong { background: rgba(16, 185, 129, 0.2); color: var(--green); }
.badge.solid { background: rgba(59, 130, 246, 0.2); color: var(--accent2); }
.badge.play { background: rgba(245, 158, 11, 0.2); color: var(--yellow); }
.badge.fail { background: rgba(249, 115, 22, 0.2); color: var(--orange); }
.badge.skip { background: rgba(239, 68, 68, 0.1); color: var(--text2); }

.filter-legend { margin-bottom: 1rem; }

/* ─── Alerts ─── */
.success { color: var(--green); padding: 1rem; background: rgba(16, 185, 129, 0.1); border-radius: 8px; margin-top: 1rem; }
.error { color: var(--red); padding: 1rem; background: rgba(239, 68, 68, 0.1); border-radius: 8px; margin-top: 1rem; }
.empty { color: var(--text2); text-align: center; padding: 2rem; }
.hidden { display: none !important; }

.upload-thumb { display: inline-block; margin: 0.5rem 0.5rem 0 0; }
.upload-thumb img { height: 60px; border-radius: 4px; border: 1px solid var(--border); }

/* ─── Lightbox ─── */
.lightbox {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; cursor: pointer;
}

.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { 
    width: 100%; height: auto; position: relative;
    flex-direction: row; overflow-x: auto;
    padding: 0.75rem;
  }
  .logo { padding: 0 1rem; border: none; margin: 0; }
  .nav-item { padding: 0.5rem 0.75rem; border-left: none; white-space: nowrap; }
  .content { margin-left: 0; padding: 1rem; }
  body { flex-direction: column; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
