/* =============================================================
   NejaTech Studio Management Dashboard
   Main Stylesheet
   ============================================================= */

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

/* ---- CSS Variables / Themes ---- */
:root {
  --bg-body:        #0f1117;
  --bg-sidebar:     #161b27;
  --bg-card:        #1a2035;
  --bg-card-hover:  #1e2640;
  --bg-input:       #0f1117;
  --bg-overlay:     rgba(0,0,0,.45);

  --border:         rgba(255,255,255,.07);
  --border-hover:   rgba(255,255,255,.15);

  --text-primary:   #e8eaf6;
  --text-secondary: #8c9bb5;
  --text-muted:     #556070;

  --accent:         #6c63ff;
  --accent-hover:   #7c74ff;
  --accent-glow:    rgba(108,99,255,.25);

  --success:        #10d97e;
  --warning:        #f5a623;
  --danger:         #f84960;
  --info:           #38c3e8;

  --green-soft:     rgba(16,217,126,.12);
  --yellow-soft:    rgba(245,166,35,.12);
  --red-soft:       rgba(248,73,96,.12);

  --sidebar-w:      240px;
  --topbar-h:       60px;
  --radius:         10px;
  --radius-lg:      16px;
  --shadow:         0 4px 24px rgba(0,0,0,.4);
  --shadow-card:    0 2px 16px rgba(0,0,0,.3);
  --transition:     .2s ease;
}

[data-theme="light"] {
  --bg-body:        #f0f2f8;
  --bg-sidebar:     #1a2035;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f6f8ff;
  --bg-input:       #f0f2f8;
  --border:         #e0e5f0;
  --border-hover:   #c8cfdf;
  --text-primary:   #1a2035;
  --text-secondary: #556070;
  --text-muted:     #8c9bb5;
  --shadow-card:    0 2px 16px rgba(26,32,53,.08);
}

/* ---- Reset / Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

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

/* ============================================================
   LAYOUT
   ============================================================ */

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand .brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.brand-logo {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), #9c63ff);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff; font-weight: 800;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.nav-section {
  padding: 8px 0 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 4px 20px 8px;
  text-transform: uppercase;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,.04);
  border-left-color: var(--border-hover);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-item .nav-icon {
  width: 18px; text-align: center; font-size: 15px; flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
}

.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #9c63ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info .user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.sidebar-user-info .user-role { font-size: 11px; color: var(--text-muted); }

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 900;
  gap: 16px;
}

.topbar-title {
  font-size: 16px; font-weight: 700; color: var(--text-primary);
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.btn-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.btn-icon:hover { background: rgba(255,255,255,.12); color: var(--text-primary); }

.notification-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger);
  border: 1px solid var(--bg-sidebar);
}

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

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover { border-color: var(--border-hover); }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.card-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
}

.card-body { padding: 20px; }

/* ---- KPI / Stat Cards ---- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--accent);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-hover); }

.stat-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

.stat-icon.purple { background: rgba(108,99,255,.15); color: var(--accent); }
.stat-icon.green  { background: var(--green-soft);    color: var(--success); }
.stat-icon.orange { background: var(--yellow-soft);   color: var(--warning); }
.stat-icon.red    { background: var(--red-soft);      color: var(--danger); }
.stat-icon.blue   { background: rgba(56,195,232,.15); color: var(--info); }

.stat-info { flex: 1; min-width: 0; }
.stat-value {
  font-size: 22px; font-weight: 800; color: var(--text-primary);
  letter-spacing: -0.5px; line-height: 1;
}
.stat-label {
  font-size: 12px; color: var(--text-secondary); margin-top: 4px;
}
.stat-change {
  font-size: 11px; font-weight: 600; margin-top: 6px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger);  }

/* ============================================================
   TABLE
   ============================================================ */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}

th {
  background: rgba(255,255,255,.03);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

.table-link { color: var(--text-primary); font-weight: 500; }
.table-link:hover { color: var(--accent); }

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success  { background: var(--green-soft);  color: var(--success); }
.badge-warning  { background: var(--yellow-soft); color: var(--warning); }
.badge-danger   { background: var(--red-soft);    color: var(--danger); }
.badge-info     { background: rgba(56,195,232,.12); color: var(--info); }
.badge-purple   { background: var(--accent-glow); color: var(--accent); }
.badge-muted    { background: rgba(255,255,255,.06); color: var(--text-secondary); }

/* Health status badges */
.hs-green  { background: var(--green-soft);  color: var(--success); }
.hs-yellow { background: var(--yellow-soft); color: var(--warning); }
.hs-red    { background: var(--red-soft);    color: var(--danger); }

/* ============================================================
   FORMS
   ============================================================ */

.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: .4px;
}

.form-control, .form-select, textarea.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 9px 13px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus, .form-select:focus, textarea.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder { color: var(--text-muted); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23556070' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 6px 20px var(--accent-glow); transform: translateY(-1px); color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #0dc070; color: #fff; }

.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover { background: #e83352; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #e09520; color: #fff; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--border-hover); color: var(--text-primary); background: rgba(255,255,255,.04); }

.btn-sm  { padding: 5px 11px; font-size: 12px; }
.btn-lg  { padding: 11px 22px; font-size: 15px; }
.btn-icon-sm { width: 28px; height: 28px; border-radius: 6px; padding: 0; justify-content: center; }

/* ============================================================
   HEALTH SCORE RING
   ============================================================ */

.health-ring {
  position: relative; display: inline-flex;
  align-items: center; justify-content: center;
}

.health-ring svg { transform: rotate(-90deg); }
.health-ring .ring-value {
  position: absolute; text-align: center;
}
.health-ring .ring-num { font-size: 24px; font-weight: 800; line-height: 1; }
.health-ring .ring-lbl { font-size: 9px; color: var(--text-muted); letter-spacing: .8px; }

/* ============================================================
   CHART CONTAINERS
   ============================================================ */

.chart-container { position: relative; width: 100%; }
.chart-container canvas { max-height: 280px; }

/* ============================================================
   ALERTS / FLASH
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid transparent;
}

.alert-success { background: var(--green-soft);  color: var(--success); border-color: rgba(16,217,126,.2); }
.alert-danger   { background: var(--red-soft);    color: var(--danger);  border-color: rgba(248,73,96,.2); }
.alert-warning  { background: var(--yellow-soft); color: var(--warning); border-color: rgba(245,166,35,.2); }
.alert-info     { background: rgba(56,195,232,.1); color: var(--info);  border-color: rgba(56,195,232,.2); }

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  margin-top: 20px;
}

.page-link {
  padding: 6px 12px; border-radius: 7px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  transition: all var(--transition);
}

.page-link:hover, .page-link.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ============================================================
   PROGRESS BARS
   ============================================================ */

.progress-bar-wrap {
  background: rgba(255,255,255,.06);
  border-radius: 4px; height: 6px; overflow: hidden;
}

.progress-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #9c63ff);
  transition: width .6s ease;
}

.progress-bar-fill.green  { background: var(--success); }
.progress-bar-fill.yellow { background: var(--warning); }
.progress-bar-fill.red    { background: var(--danger); }

/* ============================================================
   FUNNEL CHART
   ============================================================ */

.funnel-item {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px;
}

.funnel-label { width: 120px; font-size: 12px; color: var(--text-secondary); text-align: right; flex-shrink: 0; }
.funnel-bar-wrap { flex: 1; background: rgba(255,255,255,.06); border-radius: 4px; height: 28px; overflow: hidden; position: relative; }
.funnel-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #9c63ff);
  border-radius: 4px;
  display: flex; align-items: center; padding-left: 10px;
  font-size: 12px; font-weight: 600; color: #fff;
  transition: width .6s ease;
}
.funnel-pct { width: 48px; font-size: 12px; font-weight: 600; color: var(--text-secondary); text-align: right; flex-shrink: 0; }

/* ============================================================
   NOTIFICATION DROPDOWN
   ============================================================ */

.notif-dropdown {
  position: absolute; top: calc(var(--topbar-h) + 4px); right: 16px;
  width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 9999;
  display: none;
}

.notif-dropdown.open { display: block; }

.notif-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.notif-item:hover { background: rgba(255,255,255,.03); }
.notif-item:last-child { border-bottom: none; }

.notif-item.unread { background: rgba(108,99,255,.05); }

.notif-type { font-size: 11px; font-weight: 600; color: var(--accent); margin-bottom: 3px; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.notif-msg { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   UTILITY
   ============================================================ */

.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info)    !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-primary-c { color: var(--text-primary) !important; }

.fw-700 { font-weight: 700 !important; }
.fw-600 { font-weight: 600 !important; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}

.page-header h1 { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.page-header p  { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.section-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 16px; }

.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: .4; }
.empty-state p { font-size: 14px; }

.avatar-initials {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #9c63ff);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
}

/* ============================================================
   AUTH PAGE
   ============================================================ */

.auth-page {
  background: var(--bg-body);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-logo {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), #9c63ff);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px var(--accent-glow);
}

.auth-title  { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.auth-subtitle { text-align: center; font-size: 13px; color: var(--text-secondary); margin-bottom: 28px; }

/* ============================================================
   PRIORITY COLORS
   ============================================================ */

.priority-critical { color: var(--danger);  font-weight: 700; }
.priority-high     { color: var(--warning); font-weight: 600; }
.priority-medium   { color: var(--info); }
.priority-low      { color: var(--text-muted); }

/* ============================================================
   THEME TOGGLE
   ============================================================ */

.theme-toggle {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px;
  display: flex; gap: 2px; cursor: pointer;
}

.theme-opt {
  padding: 4px 10px; border-radius: 14px;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  transition: all var(--transition);
}

.theme-opt.active {
  background: var(--accent);
  color: #fff;
}

/* Platform icon colors */
.platform-meta     { color: #1877f2; }
.platform-google   { color: #ea4335; }
.platform-tiktok   { color: #ff0050; }
.platform-unity    { color: #222c37; }
.platform-applovin { color: #f78e1e; }

/* Status line indicator for games table */
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
  margin-right: 6px;
}
.status-dot.live       { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.soft_launch { background: var(--info); }
.status-dot.development { background: var(--warning); }
.status-dot.concept    { background: var(--text-muted); }
.status-dot.retired    { background: var(--danger); opacity: .5; }
.status-dot.internal_testing { background: var(--accent); }
.status-dot.maintenance { background: var(--warning); }

/* Sidebar mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 999;
}

@media (max-width: 768px) {
  .sidebar.open + .main-content .sidebar-overlay,
  .sidebar-overlay.visible { display: block; }
}
