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

:root {
  --bg:        #080808;
  --surface:   #111111;
  --surface2:  #1c1c1c;
  --border:    #272727;
  --border2:   #333333;

  --gold:      #F5A623;
  --gold-lt:   #FFD060;
  --gold-dk:   #C87D0E;
  --gold-glow: rgba(245,166,35,0.18);

  --text:      #F2F2F2;
  --muted:     #7a7a7a;
  --muted2:    #555;

  --green:     #22c55e;
  --red:       #ef4444;
  --yellow:    #eab308;
  --blue:      #3b82f6;

  --radius:    10px;
  --radius-sm: 6px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── LOGIN ── */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(245,166,35,.12) 0%, transparent 65%);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 44px 40px;
  width: 360px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(245,166,35,.08);
}
.login-logo {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px;
}
.login-logo img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.login-card h1 {
  font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 4px;
  background: linear-gradient(90deg, var(--gold-lt), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.login-card p { color: var(--muted); margin-bottom: 28px; font-size: 13px; text-align: center; }

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 228px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo img {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-dk);
  flex-shrink: 0;
}
.sidebar-logo-text { overflow: hidden; }
.sidebar-logo-text h2 {
  font-size: 14px; font-weight: 700; line-height: 1.2;
  background: linear-gradient(90deg, var(--gold-lt), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-logo-text span { font-size: 11px; color: var(--muted); }

nav { flex: 1; padding: 10px 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; cursor: pointer;
  color: var(--muted); font-size: 13px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s; user-select: none;
}
.nav-item:hover { color: var(--text); background: var(--surface2); }
.nav-item.active {
  color: var(--gold-lt);
  border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(245,166,35,.1), transparent);
}
.nav-item .icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 14px 18px; border-top: 1px solid var(--border); }

.main { flex: 1; overflow-y: auto; padding: 28px 32px; }

/* ── STATUS BAR ── */
.status-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-dot.running { background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 2s infinite; }
.status-dot.stopped { background: var(--muted2); }
.status-dot.waiting { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.status-dot.error   { background: var(--red); box-shadow: 0 0 8px var(--red); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.status-text  { font-weight: 600; font-size: 14px; }
.status-sub   { color: var(--muted); font-size: 12px; margin-top: 2px; }
.status-actions { margin-left: auto; display: flex; gap: 8px; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 14px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px; color: var(--text);
}

/* ── FORMS ── */
.form-row { margin-bottom: 14px; }
label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number],
input[type=time], input[type=url], input[type=file], select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text); padding: 8px 12px;
  font-size: 13px; font-family: inherit; outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
textarea { resize: vertical; min-height: 80px; }
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: none; cursor: pointer; font-size: 13px; font-weight: 600;
  font-family: inherit; transition: all .15s; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dk) 100%);
  color: #000; box-shadow: 0 2px 12px rgba(245,166,35,.3);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 4px 20px rgba(245,166,35,.45); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { border-color: var(--gold); color: var(--gold-lt); }
.btn-danger { background: rgba(239,68,68,.15); color: #f87171; border: 1px solid rgba(239,68,68,.25); }
.btn-danger:hover { background: rgba(239,68,68,.28); }
.btn-green { background: rgba(34,197,94,.15); color: #4ade80; border: 1px solid rgba(34,197,94,.25); }
.btn-green:hover { background: rgba(34,197,94,.28); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ── BADGES ── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-program    { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-ad         { background: rgba(245,166,35,.15); color: var(--gold-lt); }
.badge-id         { background: rgba(34,197,94,.12); color: #4ade80; }
.badge-ready      { background: rgba(34,197,94,.12); color: #4ade80; }
.badge-downloading { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-error      { background: rgba(239,68,68,.15); color: #f87171; }

/* ── DAYS ── */
.days-row { display: flex; gap: 8px; flex-wrap: wrap; }
.day-cb { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); cursor: pointer; }
.day-cb input { accent-color: var(--gold); }

/* ── TOGGLE ── */
.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border2); border-radius: 24px;
  transition: .2s; cursor: pointer;
}
.toggle-slider:before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; top: 3px;
  background: white; border-radius: 50%; transition: .2s;
}
.toggle input:checked + .toggle-slider { background: var(--gold); }
.toggle input:checked + .toggle-slider:before { transform: translateX(18px); background: #000; }

/* ── UPLOAD AREA ── */
.upload-area {
  border: 2px dashed var(--border2); border-radius: var(--radius);
  padding: 36px; text-align: center; cursor: pointer; transition: .15s;
}
.upload-area:hover { border-color: var(--gold); background: var(--gold-glow); }
.upload-area .icon { font-size: 36px; margin-bottom: 10px; }
.upload-area p { color: var(--muted); font-size: 13px; }

/* ── MODAL ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 14px; padding: 28px; width: 500px;
  max-width: 95vw; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 32px 100px rgba(0,0,0,.7);
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── DASHBOARD ── */
.dashboard-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-lt));
}
.stat-value { font-size: 36px; font-weight: 800; color: var(--gold-lt); line-height: 1; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ── NOW PLAYING ── */
.now-playing {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(245,166,35,.06) 100%);
  border: 1px solid rgba(245,166,35,.25);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.now-playing .label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); font-weight: 700; margin-bottom: 8px; }
.now-playing .title { font-size: 20px; font-weight: 800; }

/* ── MISC ── */
.empty { text-align: center; padding: 48px; color: var(--muted); font-size: 13px; }
.error-msg   { color: #f87171; font-size: 12px; margin-top: 6px; }
.success-msg { color: var(--green); font-size: 12px; margin-top: 6px; }
.page-title  { font-size: 22px; font-weight: 800; margin-bottom: 22px; letter-spacing: -.02em; }
.flex        { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2  { gap: 8px; }
.mt-2   { margin-top: 8px; }
.mt-4   { margin-top: 16px; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 12px; }

.progress-bar  { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-lt)); animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0%{transform:translateX(-100%)} 100%{transform:translateX(300%)} }

/* ── BATCH UPLOAD ── */
.upload-file-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-rows: auto 4px;
  gap: 4px 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.upload-file-row:last-child { border-bottom: none; }
.upload-file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-file-size { color: var(--muted); font-size: 11px; white-space: nowrap; }
.upload-file-status { font-size: 11px; font-weight: 600; white-space: nowrap; }
.upload-file-bar { grid-column: 1 / -1; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.upload-file-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-lt)); transition: width .2s; border-radius: 2px; }

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── MODE BADGE ── */
.mode-badge { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface2); border: 1px solid var(--border2); border-radius: 999px; padding: 3px 10px; }

/* ── BREAK WARNING ── */
.break-warning {
  background: rgba(245,166,35,.12); border: 1px solid rgba(245,166,35,.35);
  border-radius: var(--radius); padding: 10px 16px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 600;
  color: var(--gold-lt);
}
.break-warning .btn { margin-left: auto; }

/* ── DECK ── */
.deck-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.deck-item:last-child { border-bottom: none; }
.deck-item--current { background: rgba(245,166,35,.06); border-radius: 6px; padding: 10px 12px; margin: 0 -12px; }
.deck-item.played { opacity: .45; }
.deck-pos { font-size: 13px; font-weight: 700; color: var(--muted); min-width: 24px; text-align: center; }
.deck-info { flex: 1; overflow: hidden; }
.deck-info strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-clean { display: inline-block; padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; background: rgba(34,197,94,.12); color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.align-center { align-items: center; }

/* ── CATEGORIES ── */
.categories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
}
.cat-color { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.cat-info { flex: 1; }

/* ── CLOCKS ── */
.card-hint { color: var(--muted); font-size: 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
.clock-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.clock-item:last-child { border-bottom: none; }
.clock-pos { font-size: 12px; font-weight: 700; color: var(--muted); min-width: 20px; }

/* ── GRAPHICS ── */
.graphic-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.graphic-row:last-child { border-bottom: none; }

/* ── CAMPAIGNS / SPOTS ── */
.spot-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.spot-row:last-child { border-bottom: none; }

/* ── BREAK PRIORITIES ── */
.priorities-table { display: flex; flex-direction: column; gap: 2px; }
.priority-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--radius-sm); }
.priority-1 { background: rgba(245,166,35,.08); border: 1px solid rgba(245,166,35,.2); }
.priority-2 { background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.2); }
.priority-3 { background: rgba(255,255,255,.03); border: 1px solid var(--border); }
.prio-badge { font-size: 11px; font-weight: 800; min-width: 28px; text-align: center; padding: 3px 6px; border-radius: 4px; background: var(--surface2); color: var(--gold-lt); }

/* ── DAYS DISPLAY ── */
.days-display { display: flex; gap: 3px; }
.day-on  { font-size: 11px; font-weight: 700; color: var(--gold-lt); }
.day-off { font-size: 11px; color: var(--muted2); }

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
