/* ==========================================================================
   NOMASOLE Admin Panel Stylesheet
   Pixel-accurate reproduction of reference design (media_1793734490131_ead0b377.jpg)
   ========================================================================== */

:root {
  --admin-bg: #F3F4F8;
  --sidebar-bg: #111625;
  --sidebar-hover: #1E2538;
  --sidebar-active: #273046;
  --card-bg: #FFFFFF;
  --text-main: #111827;
  --text-sub: #6B7280;
  --text-muted: #9CA3AF;
  --border-color: #E5E7EB;
  --primary-dark: #111625;
  --accent-blue: #2563EB;
  --accent-green: #10B981;
  --accent-amber: #F59E0B;
  --accent-red: #EF4444;
  --accent-purple: #8B5CF6;
  --radius-card: 14px;
  --radius-btn: 8px;
  --shadow-card: 0 2px 12px rgba(17, 24, 39, 0.04);
  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--admin-bg);
  color: var(--text-main);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Layout Shell */
.admin-shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
  padding: 12px;
  gap: 18px;
}

/* Sidebar (#111625 Dark Navy rounded panel) */
.admin-sidebar {
  background-color: var(--sidebar-bg);
  color: #FFFFFF;
  border-radius: 16px;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 12px;
  height: calc(100vh - 24px);
}

.sidebar-brand {
  padding: 0 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 14px;
}

.sidebar-brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #FFFFFF;
}

.sidebar-brand-sub {
  font-size: 0.74rem;
  color: #94A3B8;
  margin-top: 2px;
}

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

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 500;
  color: #94A3B8;
  text-align: left;
  transition: all 0.16s ease;
}

.sidebar-link svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

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

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

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.storefront-return-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #E2E8F0;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.storefront-return-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Main Content Area */
.admin-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding-right: 6px;
}

/* Topbar */
.admin-topbar {
  background-color: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.topbar-search {
  position: relative;
  width: 340px;
  max-width: 100%;
}

.topbar-search input {
  width: 100%;
  background-color: #F3F4F6;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 16px 8px 36px;
  font-size: 0.82rem;
}

.topbar-search input:focus {
  outline: none;
  border-color: #CBD5E1;
  background-color: #FFFFFF;
}

.topbar-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #9CA3AF;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #F9FAFB;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #374151;
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #EF4444;
  border: 1.5px solid #FFFFFF;
}

.admin-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: #1E293B;
  color: #FFFFFF;
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-meta-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #111827;
}

.profile-meta-role {
  font-size: 0.7rem;
  color: #6B7280;
}

/* Page Title Row */
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.82rem;
  color: var(--text-sub);
  margin-top: 2px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-pill {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #374151;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-admin-primary {
  background-color: var(--primary-dark);
  color: #FFFFFF;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s ease;
}

.btn-admin-primary:hover {
  opacity: 0.92;
}

.btn-admin-outline {
  background-color: #FFFFFF;
  color: #1F2937;
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* KPI Grid (4 Cards) */
.kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--text-sub);
  font-weight: 500;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 6px;
}

.kpi-trend {
  font-size: 0.75rem;
  font-weight: 700;
  color: #10B981;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.kpi-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* Charts Row (2/3 + 1/3) */
.charts-row {
  display: grid;
  grid-template-columns: 1.85fr 1fr;
  gap: 16px;
}

.admin-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
}

/* Donut Chart & Legend */
.donut-layout {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 16px;
  padding-top: 8px;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 135px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4B5563;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* Best-selling Products Horizontal Strip (Screen 1 Bottom) */
.bestsellers-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.bestseller-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background-color: #F9FAFB;
  border: 1px solid #F3F4F6;
}

.bestseller-item img {
  width: 52px;
  height: 40px;
  object-fit: contain;
  background: #FFFFFF;
  border-radius: 6px;
  padding: 2px;
}

.bestseller-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1F2937;
  line-height: 1.25;
}

.bestseller-sold {
  font-size: 0.74rem;
  color: #6B7280;
  margin-top: 2px;
}

.bestseller-sold strong {
  color: #111827;
  font-weight: 800;
}

/* Tabs Pills (Product Categories & Order Statuses) */
.admin-tabs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-tab-pill {
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background-color: #FFFFFF;
  color: #4B5563;
  border: 1px solid var(--border-color);
  transition: all 0.15s ease;
}

.admin-tab-pill.active {
  background-color: var(--primary-dark);
  color: #FFFFFF;
  border-color: var(--primary-dark);
}

/* Filter Toolbar inside Table Card */
.table-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.table-search-input {
  flex: 1;
  min-width: 220px;
  background: #F9FAFB;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.8rem;
}

.table-select {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #374151;
}

/* Data Table (Responsive Table Compliant) */
.admin-table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  container-type: inline-size;
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}

.admin-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  background-color: #F9FAFB;
}

.admin-table th {
  padding: 11px 14px;
  font-weight: 600;
  color: #6B7280;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: middle;
  color: #1F2937;
}

.admin-table tbody tr:hover {
  background-color: #F9FAFB;
}

.prod-thumb-sm {
  width: 48px;
  height: 36px;
  object-fit: contain;
  background: #F4F4F2;
  border-radius: 6px;
  padding: 2px;
}

/* Status Badges matching reference screenshots */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.73rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-green { background: #DCFCE7; color: #15803D; }
.badge-orange { background: #FFEDD5; color: #C2410C; }
.badge-yellow { background: #FEF3C7; color: #B45309; }
.badge-blue { background: #DBEAFE; color: #1D4ED8; }
.badge-purple { background: #EDE9FE; color: #6D28D9; }
.badge-red { background: #FEE2E2; color: #B91C1C; }
.badge-pink { background: #FCE7F3; color: #BE185D; }
.badge-gray { background: #F3F4F6; color: #4B5563; }

.action-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6B7280;
  transition: background 0.15s ease, color 0.15s ease;
}

.action-icon-btn:hover {
  background: #F3F4F6;
  color: #111827;
}

/* Native Dialog in Admin */
dialog.admin-dialog {
  margin: auto;
  border: none;
  border-radius: 14px;
  background: #FFFFFF;
  color: var(--text-main);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 640px;
  width: calc(100% - 32px);
  padding: 0;
}

dialog.admin-dialog::backdrop {
  background: rgba(17, 22, 37, 0.55);
  backdrop-filter: blur(2px);
}

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

.admin-dialog-body {
  padding: 20px 22px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-field {
  margin-bottom: 12px;
}

.admin-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.admin-field input,
.admin-field select,
.admin-field textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 0.84rem;
}

/* Toast */
.admin-toast-wrap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-toast {
  background: #111625;
  color: #FFFFFF;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  border-left: 4px solid #10B981;
}

@media (max-width: 1100px) {
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .bestsellers-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { height: auto; position: relative; top: 0; }
}

/* ==========================================================================
   NOMA STUDIO ADMIN PRO — VISUAL BUILDER, RBAC & AI CONTROL CENTER
   Compliant with `interactions-in-complex-layouts` & `responsive-table`
   ========================================================================== */

.builder-workspace {
  display: grid;
  grid-template-columns: 290px 1fr 330px;
  gap: 14px;
  align-items: start;
}

.builder-column-isolated,
.dashboard-widget-isolated {
  content-visibility: auto;
  contain-intrinsic-size: auto 300px auto 800px;
}

@supports not (content-visibility: auto) {
  .builder-column-isolated,
  .dashboard-widget-isolated {
    contain: layout style paint;
  }
}

.builder-section-item {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  background: #FFFFFF;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.builder-section-item:hover {
  border-color: #94A3B8;
}

.builder-section-item.active {
  border-color: var(--accent-blue);
  background: #EFF6FF;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.builder-viewport-shell {
  background: #E2E8F0;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 640px;
}

.builder-preview-frame {
  background: #FAF9F6;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.14);
  overflow: hidden;
  transition: width 0.25s ease;
  width: 100%;
  border: 1px solid #CBD5E1;
}

.builder-preview-frame.viewport-desktop { width: 100%; }
.builder-preview-frame.viewport-tablet { width: 768px; max-width: 100%; }
.builder-preview-frame.viewport-mobile { width: 390px; max-width: 100%; }

/* Container Query Responsive Table (`responsive-table` pattern) */
@container (width < 40em) {
  .admin-table thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .admin-table tbody tr {
    display: grid;
    gap: 0.25rem;
    padding-block: 0.75rem;
    border-block-end: 2px solid var(--border-color);
  }
  .admin-table td {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: 0.5rem;
    padding-block: 0.2rem;
    border: none;
  }
  .admin-table td:nth-of-type(1)::before { content: var(--label-1, ''); font-weight: 600; }
  .admin-table td:nth-of-type(2)::before { content: var(--label-2, ''); font-weight: 600; }
  .admin-table td:nth-of-type(3)::before { content: var(--label-3, ''); font-weight: 600; }
  .admin-table td:nth-of-type(4)::before { content: var(--label-4, ''); font-weight: 600; }
}

@media (max-width: 1280px) {
  .builder-workspace {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   FORM VALIDATION (:user-invalid / :user-valid per `validate-input-after-interaction`),
   RICH SEO PRO EDITOR & DYNAMIC CHARTS
   ========================================================================== */
.admin-field input:user-invalid,
.admin-field select:user-invalid,
.admin-field textarea:user-invalid {
  border-color: #DC2626;
  background-color: #FEF2F2;
}

.admin-field input:user-valid,
.admin-field textarea:user-valid {
  border-color: #10B981;
}

.seo-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 10px;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  align-items: center;
}

.seo-tool-btn {
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  color: #1E293B;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.seo-tool-btn:hover {
  background: #111625;
  color: #FFFFFF;
  border-color: #111625;
}

.seo-editor-surface {
  min-height: 290px;
  max-height: 440px;
  overflow-y: auto;
  padding: 16px 18px;
  border: 1px solid #CBD5E1;
  border-radius: 0 0 10px 10px;
  background: #FFFFFF;
  font-size: 0.92rem;
  line-height: 1.7;
  color: #1F2937;
  outline: none;
}

.seo-editor-surface:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.seo-editor-surface h1 { font-size: 1.6rem; font-weight: 800; margin: 14px 0 8px; color: #111827; }
.seo-editor-surface h2 { font-size: 1.3rem; font-weight: 800; margin: 12px 0 6px; color: #111827; border-bottom: 1px solid #F1F5F9; padding-bottom: 4px; }
.seo-editor-surface h3 { font-size: 1.08rem; font-weight: 700; margin: 10px 0 6px; color: #1E293B; }
.seo-editor-surface p { margin-bottom: 10px; }
.seo-editor-surface blockquote { border-left: 4px solid #AD7A59; background: #FAF8F5; padding: 10px 14px; margin: 10px 0; font-style: italic; }
.seo-editor-surface img { max-width: 100%; height: auto; border-radius: 8px; margin: 10px 0; }
.seo-editor-surface ul, .seo-editor-surface ol { padding-left: 22px; margin-bottom: 10px; }

.img-import-box {
  border: 2px dashed #94A3B8;
  border-radius: 10px;
  padding: 12px;
  background: #F8FAFC;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.img-import-box:hover {
  border-color: #2563EB;
  background: #EFF6FF;
}

.dynamic-donut-ring {
  width: 152px;
  height: 152px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  transition: background 0.35s ease;
}

.dynamic-donut-hole {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.06);
}
