/* Admin Panel Styles — inherits CSS vars from /css/style.css */

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-main, #0a1118);
  color: var(--text, #e8eef4);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* ── Login Page ── */
.admin-login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.admin-login-card {
  background: var(--bg-panel, #111d27);
  border: 1px solid var(--border, #1e3040);
  border-radius: 12px; padding: 40px; width: 100%; max-width: 400px;
}
.admin-login-card h1 {
  font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; text-align: center;
}
.admin-login-card .subtitle {
  font-size: 0.85rem; color: var(--text-dim, #6a7d8e); text-align: center; margin-bottom: 28px;
}
.admin-login-card .form-group { margin-bottom: 16px; }
.admin-login-card label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: var(--text-dim, #6a7d8e); text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 6px;
}
.admin-login-card input {
  width: 100%; padding: 10px 14px; font-size: 0.95rem;
  background: var(--bg-card, #182530); border: 1px solid var(--border, #1e3040);
  border-radius: 6px; color: var(--text, #e8eef4); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.admin-login-card input:focus {
  border-color: var(--accent, #22dd44);
  box-shadow: 0 0 0 2px rgba(34, 221, 68, 0.25);
}
.admin-login-card .btn-login {
  width: 100%; padding: 12px; font-size: 0.95rem; font-weight: 700;
  background: var(--accent, #22dd44); color: #000; border: none;
  border-radius: 6px; cursor: pointer; margin-top: 8px;
  transition: filter 0.15s;
}
.admin-login-card .btn-login:hover { filter: brightness(1.12); }
.admin-login-card .btn-login:disabled { opacity: 0.5; cursor: not-allowed; }
.error-msg { color: #ff3b4a; font-size: 0.85rem; margin-top: 12px; text-align: center; }
.hidden { display: none; }

/* ── Dashboard Layout ── */
.admin-app { display: flex; flex-direction: column; min-height: 100vh; }

.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: var(--bg-panel, #111d27);
  border-bottom: 1px solid var(--border, #1e3040);
  flex-shrink: 0;
}
.admin-header h1 { font-size: 1.15rem; font-weight: 700; }
.admin-header-right { display: flex; align-items: center; gap: 12px; }
.admin-header-right .username { font-size: 0.85rem; color: var(--text-dim, #6a7d8e); }

.admin-layout { display: grid; grid-template-columns: 220px 1fr; flex: 1; }

.admin-sidebar {
  background: var(--bg-panel, #111d27);
  border-right: 1px solid var(--border, #1e3040);
  padding: 16px 0; display: flex; flex-direction: column; gap: 2px;
}
.nav-item {
  display: block; padding: 10px 24px; color: var(--text-dim, #6a7d8e);
  font-size: 0.88rem; font-weight: 500; transition: all 0.15s;
  border-left: 3px solid transparent; cursor: pointer;
}
.nav-item:hover { color: var(--text, #e8eef4); background: rgba(255,255,255,0.03); }
.nav-item.active {
  color: var(--accent, #22dd44); border-left-color: var(--accent, #22dd44);
  background: rgba(34, 221, 68, 0.05);
}

.admin-content { padding: 24px; overflow-y: auto; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Role Badge ── */
.role-badge {
  font-size: 0.7rem; padding: 3px 10px; border-radius: 4px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.role-badge.admin { background: var(--accent, #22dd44); color: #000; }
.role-badge.operator { background: #ffcc00; color: #000; }

/* ── Buttons ── */
.btn {
  padding: 8px 16px; font-size: 0.85rem; font-weight: 600;
  border: none; border-radius: 6px; cursor: pointer;
  transition: filter 0.15s, opacity 0.15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent, #22dd44); color: #000; }
.btn-secondary {
  background: var(--bg-card, #182530); color: var(--text, #e8eef4);
  border: 1px solid var(--border, #1e3040);
}
.btn-danger { background: #ff3b4a; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }

/* ── Stats Cards ── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card, #182530); border: 1px solid var(--border, #1e3040);
  border-radius: 10px; padding: 20px;
}
.stat-card-label {
  font-size: 0.72rem; color: var(--text-dim, #6a7d8e);
  text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600;
}
.stat-card-value { font-size: 1.8rem; font-weight: 800; margin-top: 6px; }
.stat-card-value.positive { color: var(--accent, #22dd44); }
.stat-card-value.negative { color: #ff3b4a; }

/* ── Filter Bar ── */
.filter-bar {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap;
}
.filter-bar label {
  font-size: 0.75rem; color: var(--text-dim, #6a7d8e);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.filter-bar input, .filter-bar select {
  padding: 7px 12px; font-size: 0.85rem;
  background: var(--bg-card, #182530); border: 1px solid var(--border, #1e3040);
  border-radius: 6px; color: var(--text, #e8eef4); outline: none;
}
.filter-bar input:focus, .filter-bar select:focus {
  border-color: var(--accent, #22dd44);
}

/* ── Tables ── */
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 0.83rem;
}
.admin-table th {
  text-align: left; padding: 10px 12px; font-size: 0.72rem;
  color: var(--text-dim, #6a7d8e); text-transform: uppercase;
  letter-spacing: 0.8px; font-weight: 600;
  border-bottom: 1px solid var(--border, #1e3040);
}
.admin-table td {
  padding: 10px 12px; border-bottom: 1px solid rgba(30, 48, 64, 0.5);
}
.admin-table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.admin-table .text-green { color: var(--accent, #22dd44); }
.admin-table .text-red { color: #ff3b4a; }
.admin-table .text-dim { color: var(--text-dim, #6a7d8e); }
.admin-table .text-gold { color: #ffcc00; }
.admin-table .mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.78rem; }

/* ── Pagination ── */
.pagination {
  display: flex; gap: 6px; justify-content: center; align-items: center;
  margin-top: 16px; font-size: 0.85rem;
}
.pagination button {
  padding: 6px 12px; background: var(--bg-card, #182530);
  border: 1px solid var(--border, #1e3040); border-radius: 4px;
  color: var(--text, #e8eef4); cursor: pointer; font-size: 0.83rem;
}
.pagination button:hover { border-color: var(--accent, #22dd44); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }
.pagination .page-info { color: var(--text-dim, #6a7d8e); }

/* ── Section Headers ── */
.section-title {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 16px;
}
.section-subtitle {
  font-size: 0.85rem; color: var(--text-dim, #6a7d8e); margin-bottom: 16px;
}

/* ── Game Breakdown ── */
.game-breakdown { margin-bottom: 24px; }
.game-bar-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.game-bar-label { width: 120px; font-size: 0.83rem; font-weight: 600; }
.game-bar-track {
  flex: 1; height: 24px; background: var(--bg-card, #182530);
  border-radius: 4px; overflow: hidden; position: relative;
}
.game-bar-fill {
  height: 100%; border-radius: 4px; transition: width 0.5s ease;
  min-width: 2px;
}
.game-bar-fill.green { background: var(--accent, #22dd44); }
.game-bar-fill.red { background: #ff3b4a; }
.game-bar-value { width: 100px; text-align: right; font-size: 0.83rem; font-weight: 700; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: none; align-items: center; justify-content: center; z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--bg-panel, #111d27); border: 1px solid var(--border, #1e3040);
  border-radius: 12px; padding: 28px; width: 100%; max-width: 500px;
  max-height: 85vh; overflow-y: auto;
}
.modal-box h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; }
.modal-box .form-group { margin-bottom: 14px; }
.modal-box label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: var(--text-dim, #6a7d8e); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 6px;
}
.modal-box input, .modal-box select {
  width: 100%; padding: 9px 12px; font-size: 0.9rem;
  background: var(--bg-card, #182530); border: 1px solid var(--border, #1e3040);
  border-radius: 6px; color: var(--text, #e8eef4); outline: none;
}
.modal-box input:focus, .modal-box select:focus {
  border-color: var(--accent, #22dd44);
}
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;
}

/* ── Checkbox Group ── */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-group label {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.85rem; color: var(--text, #e8eef4);
  text-transform: none; letter-spacing: 0; font-weight: 500;
  cursor: pointer;
}
.checkbox-group input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--accent, #22dd44);
}

/* ── Status Badges ── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
}
.badge-active { background: rgba(34, 221, 68, 0.15); color: var(--accent, #22dd44); }
.badge-inactive { background: rgba(255, 59, 74, 0.15); color: #ff3b4a; }
.badge-game { background: rgba(255, 204, 0, 0.15); color: #ffcc00; }

/* ── Empty State ── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-dim, #6a7d8e);
}
.empty-state .icon { font-size: 2rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 0.9rem; }

/* ── Toolbar ── */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}

/* ── Game Cards ── */
.games-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px; margin-top: 20px;
}
.game-card {
  background: var(--bg-card, #182530); border: 1px solid var(--border, #1e3040);
  border-radius: 12px; overflow: hidden; transition: border-color 0.2s;
}
.game-card:hover { border-color: var(--accent, #22dd44); }
.game-card-image {
  width: 100%; height: 180px; background: var(--bg-main, #0a1118);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.game-card-image img {
  width: 100%; height: 100%; object-fit: cover;
}
.game-card-placeholder {
  color: var(--text-dim, #6a7d8e); font-size: 0.85rem; font-weight: 600;
}
.game-card-info { padding: 16px; }
.game-card-name { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.game-card-desc {
  font-size: 0.8rem; color: var(--text-dim, #6a7d8e);
  margin-bottom: 12px; line-height: 1.4;
}
.game-card-meta {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.game-card-updated {
  font-size: 0.72rem; color: var(--text-dim, #6a7d8e);
}
.game-card-actions {
  display: flex; gap: 8px;
}

/* ── Toast Notifications ── */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none; max-width: 420px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 8px;
  font-size: 0.85rem; font-weight: 500;
  pointer-events: auto; cursor: default;
  opacity: 0; transform: translateX(100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  border: 1px solid transparent;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.hide { opacity: 0; transform: translateX(100%); }
.toast-error {
  background: rgba(40, 15, 15, 0.95); border-color: #ff3b4a;
  color: #ffb3b8;
}
.toast-success {
  background: rgba(15, 40, 20, 0.95); border-color: var(--accent, #22dd44);
  color: #b3ffc4;
}
.toast-warning {
  background: rgba(40, 35, 10, 0.95); border-color: #ffcc00;
  color: #ffe680;
}
.toast-info {
  background: rgba(15, 25, 40, 0.95); border-color: #4da6ff;
  color: #b3d9ff;
}
.toast-icon {
  font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center;
}
.toast-error .toast-icon { color: #ff3b4a; }
.toast-success .toast-icon { color: var(--accent, #22dd44); }
.toast-warning .toast-icon { color: #ffcc00; }
.toast-info .toast-icon { color: #4da6ff; }
.toast-message { flex: 1; line-height: 1.4; }
.toast-close {
  background: none; border: none; color: inherit; font-size: 1.2rem;
  cursor: pointer; opacity: 0.6; padding: 0 2px; flex-shrink: 0;
  transition: opacity 0.15s;
}
.toast-close:hover { opacity: 1; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    flex-direction: row; overflow-x: auto; padding: 8px 16px;
    border-right: none; border-bottom: 1px solid var(--border, #1e3040);
  }
  .nav-item { border-left: none; border-bottom: 3px solid transparent; padding: 8px 16px; white-space: nowrap; }
  .nav-item.active { border-left-color: transparent; border-bottom-color: var(--accent, #22dd44); }
  .admin-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card-value { font-size: 1.4rem; }
}
