/* ============================================================
   AdManager Pro — Admin Stylesheet
   Theme: Dark Industrial / Precision Dashboard
   ============================================================ */

/* ── Variables ── */
:root {
  --bg-base:       #0d0f14;
  --bg-surface:    #13161e;
  --bg-elevated:   #1a1e2a;
  --bg-hover:      #1f2435;
  --sidebar-w:     260px;
  --border:        #252b3b;
  --border-light:  #2f374f;

  --text-primary:  #e8eaf0;
  --text-secondary:#8b93ab;
  --text-muted:    #4f5775;

  --accent:        #5b8af0;
  --accent-dim:    rgba(91,138,240,.15);
  --accent-hover:  #7ba3f5;

  --success:       #34d399;
  --success-dim:   rgba(52,211,153,.12);
  --warning:       #fbbf24;
  --warning-dim:   rgba(251,191,36,.12);
  --danger:        #f87171;
  --danger-dim:    rgba(248,113,113,.12);

  --font-ui:       'Space Grotesk', sans-serif;
  --font-mono:     'DM Mono', monospace;
  --font-display:  'Playfair Display', serif;

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --shadow:        0 4px 24px rgba(0,0,0,.4);
  --shadow-sm:     0 2px 8px rgba(0,0,0,.25);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ── Sidebar ── */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.logo-icon {
  font-size: 24px; color: var(--accent);
  line-height: 1;
}
.logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text-primary);
  letter-spacing: -.3px;
}
.logo-text em { color: var(--accent); font-style: normal; }

.sidebar-nav {
  flex: 1; overflow-y: auto;
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-section-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 8px 6px;
  display: block;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500; font-size: 13.5px;
  transition: all .15s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}
.nav-item svg { opacity: .7; }
.nav-item.active svg { opacity: 1; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.sidebar-user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span  { font-size: 11px; color: var(--text-muted); }
.logout-btn {
  color: var(--text-muted); padding: 4px;
  border-radius: var(--radius-sm);
  transition: color .15s;
  display: flex;
}
.logout-btn:hover { color: var(--danger); }

/* ── Main Wrapper ── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; gap: 16px;
}
.sidebar-toggle {
  display: none; background: none; border: none;
  color: var(--text-secondary); cursor: pointer; padding: 4px;
}
.page-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ── Page Content ── */
.page-content { padding: 28px; flex: 1; }

/* ── Flash ── */
.flash {
  margin: 0 28px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 13.5px; font-weight: 500;
  animation: slideDown .25s ease;
}
.flash--success { background: var(--success-dim); color: var(--success); border: 1px solid var(--success); }
.flash--error   { background: var(--danger-dim);  color: var(--danger);  border: 1px solid var(--danger); }
.flash--warning { background: var(--warning-dim); color: var(--warning); border: 1px solid var(--warning); }
.flash--info    { background: var(--accent-dim);  color: var(--accent);  border: 1px solid var(--accent); }
.flash-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0; }

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  position: relative; overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.stat-card::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent);
  opacity: 0; transition: opacity .2s;
}
.stat-card:hover::after { opacity: 1; }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); }
.stat-value { font-size: 32px; font-weight: 700; line-height: 1.1; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.stat-sub   { font-size: 12px; color: var(--text-muted); }
.stat-icon  { position: absolute; right: 20px; top: 20px; opacity: .08; font-size: 48px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }
table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 11px; font-weight: 600;
  letter-spacing: .8px; text-transform: uppercase;
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child { border-bottom: none; }
td { padding: 12px 16px; vertical-align: middle; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 50px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge--active   { background: var(--success-dim); color: var(--success); }
.badge--inactive { background: var(--danger-dim);  color: var(--danger); }
.badge--pending  { background: var(--warning-dim); color: var(--warning); }
.badge--alltime  { background: var(--accent-dim);  color: var(--accent); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui); font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn--primary  { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); }
.btn--secondary{ background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn--secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn--danger   { background: var(--danger-dim); color: var(--danger); border: 1px solid var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--success  { background: var(--success-dim); color: var(--success); border: 1px solid var(--success); }
.btn--success:hover { background: var(--success); color: #fff; }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--icon { padding: 7px; border-radius: var(--radius-sm); background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.btn--icon:hover { color: var(--accent); border-color: var(--accent); }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--text-secondary); }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="number"], input[type="datetime-local"],
textarea, select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui); font-size: 13.5px;
  padding: 10px 14px;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select option { background: var(--bg-elevated); }
textarea { resize: vertical; min-height: 80px; }

.form-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── Image Upload Preview ── */
.img-upload-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-md);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--bg-elevated);
  position: relative;
}
.img-upload-zone:hover, .img-upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.img-upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  width: 100%; border: none; background: none; padding: 0;
}
.upload-icon { font-size: 32px; margin-bottom: 8px; opacity: .4; }
.upload-label { font-size: 13px; color: var(--text-secondary); }
.upload-hint  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.img-preview  { max-width: 100%; max-height: 200px; border-radius: var(--radius-sm); margin-top: 12px; display: none; }

/* ── Login Page ── */
.login-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg-base);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center; margin-bottom: 32px;
}
.login-logo .logo-icon { font-size: 40px; color: var(--accent); display: block; margin-bottom: 8px; }
.login-logo h1 { font-family: var(--font-display); font-size: 26px; }
.login-logo h1 em { color: var(--accent); font-style: normal; }
.login-card .form-group { margin-bottom: 16px; }
.login-card .btn--primary { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }

/* ── User Table Avatar ── */
.user-avatar-sm {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}

/* ── Ad Preview Thumbnail ── */
.ad-thumb { width: 80px; height: 44px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-elevated); }

/* ── Embed URL Box ── */
.embed-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--success);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  word-break: break-all;
}

/* ── Progress / Loading ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

/* ── Role Badge ── */
.role-badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 4px; font-size: 11px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase;
}
.role-badge--superadmin { background: var(--accent-dim); color: var(--accent); }
.role-badge--staff      { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Empty State ── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: .3; display: block; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p  { font-size: 13px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .page-content { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ── Animations ── */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}

.page-content { animation: fadeIn .3s ease; }

/* ── Misc ── */
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-accent  { color: var(--accent); }
.mono         { font-family: var(--font-mono); }
.flex-center  { display: flex; align-items: center; gap: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
