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

:root {
  --primary:    #D89B3C;
  --primary-dk: #A5711F;
  --bg:         #120B18;
  --surface:    #1D1424;
  --surface-2:  #251A2E;
  --surface-3:  #2F2138;
  --border:     rgba(255,255,255,0.08);
  --text:       #EDE3D0;
  --text-muted: #93839A;
  --green:      #74A574;
  --red:        #C9584D;
  --blue:       #5B9BD5;
  --yellow:     #F0C15C;
  --radius:     8px;
  --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, select, textarea { font-family: inherit; }

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

/* ── SIDEBAR ── */
.sidebar {
  width: 240px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 1.5rem 1.2rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.1rem; font-weight: 700; color: var(--primary);
  display: flex; align-items: center; gap: 0.5rem;
}
.sidebar-logo small { display: block; font-size: 0.65rem; color: var(--text-muted); font-weight: 400; margin-top: 0.15rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.75rem 0; }
.nav-group { margin-bottom: 0.5rem; }
.nav-group-label { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-muted); padding: 0.6rem 1.2rem 0.3rem; }
.nav-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 1.2rem; font-size: 0.85rem; font-weight: 500;
  color: var(--text-muted); border-radius: var(--radius); margin: 1px 0.5rem;
  transition: var(--transition); cursor: pointer;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: rgba(198,129,58,0.15); color: var(--primary); }
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--primary); color: white;
  font-size: 0.65rem; font-weight: 700; padding: 0.15rem 0.45rem; border-radius: 10px;
}
.sidebar-footer { padding: 1rem 1.2rem; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 0.6rem; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }
.user-name { font-size: 0.82rem; font-weight: 600; }
.user-role { font-size: 0.68rem; color: var(--text-muted); }

/* ── MAIN ── */
.main-content { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── TOP BAR ── */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 1.5rem; height: 56px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.hamburger-btn { display: none; font-size: 1.3rem; background: transparent; border: none; color: var(--text); padding: 0.2rem 0.4rem; line-height: 1; }
.page-title { font-size: 0.95rem; font-weight: 600; }
.breadcrumb { font-size: 0.78rem; color: var(--text-muted); }
.breadcrumb span { color: var(--primary); }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.topbar-btn {
  padding: 0.45rem 0.9rem; border-radius: var(--radius); font-size: 0.8rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  transition: var(--transition); display: flex; align-items: center; gap: 0.4rem;
}
.topbar-btn:hover { background: var(--surface-3); }
.topbar-btn.primary { background: var(--primary); border-color: var(--primary); color: white; }
.topbar-btn.primary:hover { background: var(--primary-dk); }

/* ── CONTENT ── */
.content-area { padding: 1.5rem; flex: 1; }
.page { display: none; }
.page.active { display: block; }

/* ── STATS CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem; position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-color, var(--primary));
}
.stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-change { font-size: 0.75rem; margin-top: 0.4rem; display: flex; align-items: center; gap: 0.3rem; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }
.stat-icon { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); font-size: 1.8rem; opacity: 0.15; }

/* ── TABLES ── */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; overflow-y: hidden; margin-bottom: 1.5rem; -webkit-overflow-scrolling: touch; }
.table-card table { min-width: 640px; width: 100%; }
.table-card-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); }
.table-card-title { font-size: 0.88rem; font-weight: 600; }
.table-search {
  padding: 0.4rem 0.8rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 0.8rem; width: 200px;
}
.table-search:focus { outline: none; border-color: var(--primary); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 0.7rem 1rem; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
td { padding: 0.75rem 1rem; font-size: 0.82rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
.td-img { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; }
.td-name { font-weight: 600; }
.td-price { color: var(--primary); font-weight: 600; }
.td-badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 20px; font-size: 0.68rem; font-weight: 700; }
.badge-green { background: rgba(82,183,136,0.15); color: var(--green); }
.badge-red { background: rgba(224,92,92,0.15); color: var(--red); }
.badge-yellow { background: rgba(240,196,122,0.15); color: var(--yellow); }
.badge-blue { background: rgba(91,155,213,0.15); color: var(--blue); }
.action-btns { display: flex; gap: 0.4rem; }
.action-btn {
  width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-size: 0.85rem; transition: var(--transition);
}
.action-btn:hover { background: var(--surface-3); }
.action-btn.delete:hover { background: rgba(224,92,92,0.2); color: var(--red); }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.form-input, .form-select, .form-textarea {
  padding: 0.6rem 0.85rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 0.85rem; transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(198,129,58,0.15); }
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.form-select option { background: var(--surface-2); }
.form-hint { font-size: 0.72rem; color: var(--text-muted); }

/* ── MODALS ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 100; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 90%; max-width: 680px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 0.95rem; font-weight: 700; }
.modal-close { font-size: 1.2rem; color: var(--text-muted); padding: 0.2rem; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.75rem; }
.btn-save { padding: 0.55rem 1.2rem; border-radius: var(--radius); font-size: 0.85rem; font-weight: 600; background: var(--primary); color: white; transition: var(--transition); cursor: pointer; border: none; }
.btn-save:hover { background: var(--primary-dk); }
.btn-cancel { padding: 0.55rem 1.2rem; border-radius: var(--radius); font-size: 0.85rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); transition: var(--transition); cursor: pointer; }
.btn-cancel:hover { background: var(--surface-3); }

/* ── DASHBOARD CHARTS ── */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.chart-title { font-size: 0.85rem; font-weight: 600; margin-bottom: 1rem; }
.mini-chart { height: 140px; display: flex; align-items: flex-end; gap: 6px; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; transition: height var(--transition); min-height: 4px; opacity: 0.85; }
.bar:hover { opacity: 1; }
.bar-label { font-size: 0.62rem; color: var(--text-muted); }
.top-products-list { display: flex; flex-direction: column; gap: 0.75rem; }
.tp-item { display: flex; align-items: center; gap: 0.75rem; }
.tp-rank { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); width: 18px; text-align: center; }
.tp-name { font-size: 0.82rem; font-weight: 500; flex: 1; }
.tp-bar-wrap { width: 80px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.tp-bar { height: 100%; background: var(--primary); border-radius: 3px; }
.tp-value { font-size: 0.78rem; font-weight: 600; color: var(--primary); width: 50px; text-align: right; }

/* ── CONTENT CARDS (blog/podcast) ── */
.content-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; gap: 0; margin-bottom: 0.6rem; }
.content-thumb { width: 100px; height: 70px; object-fit: cover; flex-shrink: 0; }
.content-info { padding: 0.8rem 1rem; flex: 1; }
.content-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.content-name { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.25rem; }
.content-meta { font-size: 0.72rem; color: var(--text-muted); }
.content-list { display: flex; flex-direction: column; gap: 0.6rem; }

/* ── SETTINGS ── */
.settings-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 1.5rem; }
.settings-nav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.settings-nav-item { padding: 0.8rem 1.2rem; font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; gap: 0.6rem; border-bottom: 1px solid var(--border); transition: var(--transition); }
.settings-nav-item:last-child { border-bottom: none; }
.settings-nav-item:hover, .settings-nav-item.active { background: rgba(198,129,58,0.1); color: var(--primary); }
.settings-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.settings-section-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 1.2rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }

/* ── TOAST ── */
.admin-toast { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 500; background: var(--surface-3); border: 1px solid var(--border); border-left: 3px solid var(--primary); color: var(--text); padding: 0.75rem 1.1rem; border-radius: var(--radius); font-size: 0.83rem; display: flex; align-items: center; gap: 0.6rem; transform: translateY(80px); opacity: 0; transition: var(--transition); box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.admin-toast.show { transform: translateY(0); opacity: 1; }

/* ── TOGGLE ── */
.toggle-wrap { display: flex; align-items: center; gap: 0.75rem; }
.toggle { position: relative; width: 40px; height: 22px; }
.toggle input { display: none; }
.toggle-slider { position: absolute; inset: 0; background: var(--surface-3); border-radius: 22px; cursor: pointer; transition: var(--transition); }
.toggle-slider::after { content: ''; position: absolute; width: 16px; height: 16px; background: white; border-radius: 50%; top: 3px; left: 3px; transition: var(--transition); }
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::after { transform: translateX(18px); }
.toggle-label { font-size: 0.82rem; }

/* ── RESPONSIVE ── */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 45; }
.sidebar-backdrop.open { display: block; }

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .hamburger-btn { display: block; }
  .sidebar { transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0,0,0,0.4); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .content-area { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .page-title { font-size: 0.85rem; }
  .breadcrumb { display: none; }
  .topbar-btn span, .topbar-btn { font-size: 0.75rem; padding: 0.4rem 0.65rem; }
  .modal-box { width: 94vw; margin: 0 3vw; }
  .table-card-header { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .table-search { width: 100%; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-actions .topbar-btn:not(.primary) span { display: none; }
}

/* ── IMAGE PREVIEW ── */
.img-preview {
  display: block; width: 100%; max-width: 220px; height: 140px; object-fit: cover;
  border-radius: var(--radius); margin-top: 0.6rem; border: 1px solid var(--border);
}

/* ── LOGIN OVERLAY ── */
.login-overlay {
  position: fixed; inset: 0; z-index: 2000; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 2rem;
}
.login-box .login-logo { font-size: 1.6rem; text-align: center; margin-bottom: 0.3rem; }
.login-box .login-sub { text-align: center; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.login-box label { display: block; font-size: 0.78rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text); }
.login-box input {
  width: 100%; padding: 0.75rem 0.9rem; margin-bottom: 1rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-family: inherit; font-size: 0.9rem;
}
.login-box button {
  width: 100%; padding: 0.8rem; border-radius: var(--radius); background: var(--primary); color: #fff;
  font-weight: 600; font-size: 0.92rem; transition: var(--transition);
}
.login-box button:hover { background: var(--primary-dk); }
.login-error { color: var(--red); font-size: 0.82rem; margin-bottom: 0.9rem; display: none; }
.login-error.show { display: block; }
.admin-layout.hidden { display: none; }
