/* ============================================================
   StreamTool Dashboard — Dark Theme CSS
   Matches CasinoElements dashboard design from screenshots
   ============================================================ */

:root {
  --bg:        #0d0d0d;
  --surface:   #141414;
  --surface2:  #1a1a1a;
  --surface3:  #222222;
  --border:    #2a2a2a;
  --border2:   #333333;
  --text:      #e8e8e8;
  --muted:     #6b6b6b;
  --muted2:    #444444;
  --red:       #ef5e5e;
  --red-dim:   rgba(239,94,94,0.2);
  --blue:      #3b82f6;
  --blue-dim:  rgba(59,130,246,0.15);
  --green:     #2ecc71;
  --green-dim: rgba(46,204,113,0.15);
  --orange:    #f97316;
  --yellow:    #eab308;
  --purple:    #9147ff;
  --sidebar-w: 210px;
  --topbar-h:  52px;
  --radius:    8px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

/* ── Auth Page ──────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: #0a0a0a;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px;
  width: 380px;
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px; justify-content: center;
}
.logo-mark { font-size: 28px; }
.logo-name { font-size: 20px; font-weight: 700; }
.logo-name span { color: var(--red); }
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.auth-tab {
  flex: 1; padding: 8px; background: none; border: none;
  color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.2s;
}
.auth-tab.active { color: var(--text); border-bottom-color: var(--blue); }
.auth-error { color: var(--red); font-size: 12px; margin-bottom: 10px; min-height: 16px; }

/* ── Layout ─────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  overflow-y: auto; z-index: 100;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 14px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700;
}
.sidebar-nav { padding: 10px 0; flex: 1; }
.nav-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted2); padding: 12px 14px 4px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; color: var(--muted); font-size: 13px;
  cursor: pointer; border-radius: 0; transition: all 0.15s;
  text-decoration: none; border-left: 3px solid transparent;
}
.nav-item:hover { color: var(--text); background: var(--surface2); }
.nav-item.active { color: var(--text); background: var(--surface2); border-left-color: var(--blue); }
.nav-item i { width: 16px; text-align: center; font-size: 12px; }

.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 10px; cursor: pointer;
}
.user-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.user-name  { font-size: 12px; font-weight: 600; }
.user-role  { font-size: 10px; color: var(--muted); }

.content {
  flex: 1; padding: 20px;
}
.app-footer {
  padding: 12px 20px; font-size: 11px; color: var(--muted);
  border-top: 1px solid var(--border); display: flex; justify-content: space-between;
}

/* ── Pages ──────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

.page-header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.center-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.coming-soon-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.coming-soon-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; gap: 12px; color: var(--muted); }

/* ── Grids ──────────────────────────────────────────────────── */
.page-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.page-grid-sr { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
.page-grid-edit-hunt { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
.page-grid-now-playing { display: grid; grid-template-columns: 320px 1fr; gap: 16px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-group label { font-size: 11px; color: var(--muted); text-transform: none; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text); font-size: 13px;
  padding: 8px 12px; outline: none; font-family: inherit;
  transition: border 0.15s; width: 100%;
}
.form-group input:focus, .form-group select:focus { border-color: var(--blue); }
.form-group small { font-size: 11px; color: var(--muted); }
.form-group textarea { resize: vertical; }
.form-input { background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius); color: var(--text); font-size: 12px; padding: 7px 10px; outline: none; font-family: inherit; }
.form-input:focus { border-color: var(--blue); }
.form-input-sm { background: var(--surface3); border: 1px solid var(--border); border-radius: 5px; color: var(--text); font-size: 11px; padding: 4px 8px; outline: none; font-family: inherit; width: 100%; }
.input-suffix { display: flex; align-items: center; }
.input-suffix input { border-radius: var(--radius) 0 0 var(--radius); border-right: none; }
.input-suffix span {
  padding: 8px 10px; background: var(--surface3);
  border: 1px solid var(--border2); border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted); font-size: 13px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: opacity 0.15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-red  { background: var(--red); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-green{ background: var(--green); color: #000; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-yellow { background: var(--yellow); color: #000; }
.btn-outline { background: transparent; border: 1px solid var(--border2); color: var(--text); }
.btn-outline-red { background: transparent; border: 1px solid var(--red); color: var(--red); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon {
  width: 30px; height: 30px; border: none; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px; transition: opacity 0.15s;
}
.btn-icon:hover { opacity: 0.8; }
.btn-icon.btn-blue  { background: var(--blue); color: #fff; }
.btn-icon.btn-green { background: var(--green); color: #000; }
.btn-icon.btn-red   { background: var(--red); color: #fff; }
.btn-icon.btn-yellow{ background: var(--yellow); color: #000; }
.btn-icon.btn-outline { background: var(--surface3); border: 1px solid var(--border); color: var(--muted); }

/* ── Tables ─────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  padding: 8px 12px; text-align: left; font-size: 11px;
  color: var(--muted); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.empty-cell { text-align: center; color: var(--muted); padding: 30px; }

.hunt-game-table td input {
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text); font-size: 12px;
  padding: 5px 8px; width: 100%; outline: none; font-family: inherit;
}
.hunt-game-table td input:focus { border-color: var(--blue); }

.table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; margin-top: 8px;
}
.per-page select { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 4px 8px; border-radius: 5px; font-size: 12px; }
.pagination-info { font-size: 12px; color: var(--muted); }
.pagination { display: flex; gap: 4px; }
.page-btn {
  min-width: 28px; height: 28px; border: none; border-radius: 5px;
  background: var(--surface2); color: var(--text); font-size: 12px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.page-btn.active { background: var(--blue); color: #fff; }
.page-btn:hover { opacity: 0.8; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-active   { background: var(--green); color: #000; }
.badge-inactive { background: var(--red); color: #fff; }
.badge-count    { background: var(--surface3); border: 1px solid var(--border); color: var(--muted); }
.badge-twitch   { background: var(--purple); color: #fff; font-size: 10px; padding: 2px 8px; border-radius: 4px; }
.badge-bonuses  { background: var(--blue-dim); color: var(--blue); border: 1px solid var(--blue); padding: 3px 8px; border-radius: 5px; }

/* ── Manage buttons in table ────────────────────────────────── */
.manage-btns { display: flex; gap: 4px; }

/* ── Search box ─────────────────────────────────────────────── */
.search-box { position: relative; }
.search-box input {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text); font-size: 12px;
  padding: 7px 30px 7px 12px; outline: none; width: 200px;
}
.search-box i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; }

/* ── Section label ──────────────────────────────────────────── */
.section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); font-weight: 600; margin-bottom: 12px;
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.bc-link { color: var(--muted); cursor: pointer; }
.bc-link:hover { color: var(--text); }
.bc-sep { color: var(--muted2); }

/* ── Linked accounts ────────────────────────────────────────── */
.linked-account {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; background: var(--surface2); border-radius: var(--radius);
}
.account-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--surface3); }
.account-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }

/* ── Now Playing ────────────────────────────────────────────── */
.np-casino-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.np-command { font-size: 12px; color: var(--muted); }
.np-game-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.np-thumbnail { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; background: var(--surface3); }
.np-game-name { font-size: 18px; font-weight: 700; }
.np-provider { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Wager Preview ──────────────────────────────────────────── */
.overlay-url-row { display: flex; gap: 6px; margin-bottom: 12px; align-items: center; }
.overlay-url-input { flex: 1; font-size: 11px; color: var(--blue); }
.tab-row { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tab-btn { background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); padding: 6px 12px; font-size: 12px; cursor: pointer; font-family: inherit; }
.tab-btn.active { color: var(--text); border-bottom-color: var(--blue); }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 200; display: none;
  backdrop-filter: blur(4px);
}
.modal-overlay.visible { display: block; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; width: 440px; z-index: 300;
  display: none;
}
.modal.visible { display: block; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.link { color: var(--blue); text-decoration: none; }

/* ── Raffle result ──────────────────────────────────────────── */
.raffle-result {
  background: var(--surface); border: 1px solid var(--yellow);
  border-radius: var(--radius); padding: 14px 18px;
  font-size: 15px; font-weight: 700; color: var(--yellow);
  text-align: center; margin-top: 12px;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .page-grid-2, .page-grid-sr, .page-grid-edit-hunt, .page-grid-now-playing { grid-template-columns: 1fr; }
}

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