/* ==========================================================================
   Mo'tabar Nurziyo — Atelier CMS Admin Dashboard
   ========================================================================== */

:root {
  --sidebar-bg: #14110f;
  --sidebar-hover: rgba(250, 247, 242, 0.06);
  --sidebar-active: rgba(200, 162, 106, 0.16);
  --canvas: #f8f4ee;
  --surface: #ffffff;
  --sand: #efe8dd;
  --border: #e5dccf;
  --obsidian: #161311;
  --cognac: #9a5b32;
  --cognac-hover: #7c4724;
  --gold: #c8a26a;
  --text: #1d1916;
  --text-muted: #6c6157;
  --danger: #b03030;
  --success: #246b48;
  --warning: #9a6012;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 10px rgba(18, 16, 14, 0.04);
  --shadow-md: 0 12px 28px rgba(18, 16, 14, 0.09);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--canvas);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.panel-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.panel-sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: #e9e2d8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 120;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
}

.sidebar-brand__name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.1;
}

.sidebar-brand__sub {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: #bdb3a7;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-link.active {
  background: var(--sidebar-active);
  color: var(--gold);
  font-weight: 600;
}

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

.nav-badge {
  background: var(--cognac);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Main Content */
.panel-main {
  flex: 1;
  margin-left: 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.panel-topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(248, 244, 238, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.role-pill.demo {
  background: #fdf3e1;
  color: #8b540f;
  border: 1px solid #ebd09d;
}

.role-pill.owner {
  background: #e8f5ee;
  color: #1f5c3e;
  border: 1px solid #b5dcc6;
}

.lang-pill {
  display: inline-flex;
  background: var(--sand);
  border-radius: 999px;
  padding: 2px;
  border: 1px solid var(--border);
}

.lang-pill a {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.lang-pill a.active {
  background: var(--obsidian);
  color: #fff;
}

.panel-content {
  padding: 28px;
  max-width: 1320px;
  width: 100%;
}

/* Demo Notice Banner */
.demo-banner {
  background: linear-gradient(90deg, #fff8eb 0%, #f9eed8 100%);
  border: 1px solid #e7c98f;
  color: #6b4108;
  border-radius: var(--radius-md);
  padding: 13px 18px;
  margin-bottom: 22px;
  font-size: 0.87rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Alerts */
.panel-alert {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-alert.success { background: #e8f5ee; color: #1b5639; border: 1px solid #b8dec8; }
.panel-alert.warning { background: #fdf4e4; color: #7c4e12; border: 1px solid #eed2a3; }
.panel-alert.error { background: #fbecec; color: #8a2323; border: 1px solid #ebbbbb; }

/* Page Header */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.page-head h1 {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.1;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Buttons */
.p-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.p-btn-primary { background: var(--cognac); color: #fff; }
.p-btn-primary:hover { background: var(--cognac-hover); }
.p-btn-dark { background: var(--obsidian); color: #fff; }
.p-btn-dark:hover { background: #2d2621; }
.p-btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.p-btn-outline:hover { background: var(--sand); }
.p-btn-danger { background: #fbecec; color: var(--danger); border-color: #f0c2c2; }
.p-btn-danger:hover { background: var(--danger); color: #fff; }
.p-btn-sm { padding: 6px 12px; font-size: 0.78rem; }

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.kpi-card__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-card__value {
  font-family: var(--font-display);
  font-size: 2.35rem;
  font-weight: 700;
  color: var(--obsidian);
  line-height: 1.1;
  margin-top: 6px;
}

.kpi-card__sub {
  font-size: 0.78rem;
  color: var(--cognac);
  margin-top: 4px;
}

/* Panels & Cards */
.p-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.p-section__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--sand);
}

.p-section__head h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin: 0;
}

.p-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.item-card {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.item-card__img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--sand);
}

.item-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.item-card__title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.item-card__meta {
  font-size: 0.8rem;
  color: var(--cognac);
  font-weight: 600;
  margin-bottom: 6px;
}

.item-card__text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 14px;
  flex: 1;
}

.item-card__actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Tables */
.p-table-wrap {
  overflow-x: auto;
}

.p-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.p-table th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.p-table td {
  padding: 12px;
  border-bottom: 1px solid var(--sand);
  vertical-align: top;
}

.badge-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-unread { background: #fdeee0; color: var(--cognac); }
.badge-read { background: var(--sand); color: var(--text-muted); }

/* Forms & Modals */
.p-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(18, 16, 14, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.p-modal.open {
  display: flex;
}

.p-modal__box {
  background: var(--surface);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.p-modal__head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.p-modal__head h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0;
}

.p-modal__body {
  padding: 20px 22px;
}

.p-modal__foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.f-group {
  margin-bottom: 14px;
}

.f-group label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.f-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--canvas);
  font-family: inherit;
  font-size: 0.9rem;
}

.f-input:focus {
  outline: none;
  border-color: var(--cognac);
  background: #fff;
}

.f-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Search Bar */
.panel-search {
  display: flex;
  gap: 8px;
  max-width: 420px;
}

/* Login Page */
.login-page {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, #2a2018 0%, #12100e 65%);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 460px;
  background: var(--canvas);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(200, 162, 106, 0.35);
}

.demo-cred-box {
  background: #fff8eb;
  border: 1px dashed #d8b272;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 22px;
}

.demo-cred-box code {
  background: #f0e4cc;
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 700;
  color: var(--obsidian);
}

@media (max-width: 960px) {
  .panel-sidebar {
    transform: translateX(-100%);
  }
  .panel-sidebar.open {
    transform: translateX(0);
  }
  .panel-main {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: inline-flex;
  }
  .panel-content {
    padding: 18px;
  }
  .f-row {
    grid-template-columns: 1fr;
  }
}
