/* Design tokens mirror Postiz's dark theme (apps/frontend/src/app/colors.scss). */
:root {
  --new-bgColor: #0e0e0e;
  --new-bgColorInner: #1a1919;
  --new-bgLineColor: #212121;
  --new-border: #252525;
  --new-sep: #454444;
  --new-textItemFocused: #1a1919;
  --new-textItemBlur: #999999;
  --new-boxFocused: #ffffff;
  --new-textColor: #ffffff;
  --new-blockSeparator: #272626;
  --new-btn-simple: #313030;
  --new-btn-text: #ffffff;
  --new-btn-primary: #612bd3;
  --new-box-hover: #201f1f;
  --new-table-border: #2b2b2b;
  --new-table-header: #1e1d1d;
  --new-table-text: #9c9c9c;
  --new-table-text-focused: #fc69ff;
  --new-chart-1: #338ced;
  --new-chart-3: #00a888;
  --new-chart-4: #d28e05;
  --danger: #f97066;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--new-bgColor);
  color: var(--new-btn-text);
  font-family: "Plus Jakarta Sans", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
body * { outline: none; }
a { color: inherit; text-decoration: none; }
h2 { font-size: 20px; font-weight: 500; margin: 0; }
h3 { font-size: 16px; font-weight: 600; margin: 0; }
p { margin: 0; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
pre {
  background: var(--new-table-header); border: 1px solid var(--new-table-border); border-radius: 8px;
  padding: 12px 16px; margin: 0; white-space: pre-wrap; word-break: break-all; color: var(--new-textColor);
}
.muted { color: var(--new-textItemBlur); }
.small { font-size: 12px; }
.accent { color: var(--new-table-text-focused); }

/* App shell: icon rail + main area, as in Postiz's LayoutComponent. */
.app { display: flex; gap: 8px; min-height: 100vh; padding: 12px; }
.rail {
  width: 80px; flex: none; background: var(--new-bgColorInner); border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 32px; padding: 20px 8px;
  position: sticky; top: 12px; height: calc(100vh - 24px);
}
.logo {
  width: 44px; height: 44px; border-radius: 12px; background: var(--new-btn-primary);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 22px; color: #fff;
}
.rail-menu { display: flex; flex-direction: column; gap: 8px; width: 64px; flex: 1; }
.rail-bottom { width: 64px; }
.menu-item {
  width: 100%; height: 54px; border-radius: 12px; border: 0; background: none; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--new-textItemBlur); font-weight: 600; transition: background-color .15s, color .15s;
}
.menu-item span { font-size: 10px; line-height: 1.1; }
.menu-item:hover, .menu-item.active { color: var(--new-textItemFocused); background: var(--new-boxFocused); }

.main {
  flex: 1; min-width: 0; background: var(--new-bgLineColor); border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; gap: 1px;
}
.topbar { display: flex; align-items: center; gap: 12px; height: 80px; padding: 0 20px; background: var(--new-bgColorInner); }
.topbar .title { flex: 1; font-size: 24px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .top-actions { display: flex; align-items: center; gap: 20px; color: var(--new-textItemBlur); }
.content { flex: 1; display: flex; gap: 1px; min-width: 0; }

/* Panels: 260px side panel + main panel, as on Postiz's launches and settings pages. */
.side-panel { width: 260px; flex: none; background: var(--new-bgColorInner); padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.panel { flex: 1; min-width: 0; background: var(--new-bgColorInner); padding: 20px; display: flex; flex-direction: column; gap: 20px; }

/* Side-panel list with the purple indicator line used by Postiz's settings tabs. */
.tab-list { display: flex; flex-direction: column; gap: 4px; }
.tab-item {
  display: flex; align-items: center; gap: 12px; height: 44px; padding-inline-end: 12px;
  border-radius: 0 8px 8px 0; cursor: pointer;
}
.tab-item::before {
  content: ""; width: 4px; height: 100%; border-radius: 3px 0 0 3px;
  background: linear-gradient(#662fda, #5720cb); opacity: 0; transition: opacity .15s;
}
.tab-item:hover, .tab-item.active { background: var(--new-box-hover); }
.tab-item:hover::before, .tab-item.active::before { opacity: 1; }
.tab-item .label { flex: 1; }
.tab-item .count { color: var(--new-textItemBlur); font-size: 12px; }

/* Buttons: Postiz's primary (bg-btnPrimary) and simple (bg-btnSimple) buttons. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px;
  border-radius: 8px; border: 0; background: var(--new-btn-simple); color: var(--new-btn-text);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--new-btn-primary); color: #fff; border-radius: 6px; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { height: 36px; padding: 0 14px; }
.btn.link { background: none; height: auto; padding: 0; color: var(--new-textItemBlur); }
.btn.link:hover { color: var(--new-textColor); filter: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions.end { justify-content: flex-end; }
.row { display: flex; gap: 8px; align-items: flex-end; }
.row > .field { flex: 1; max-width: 420px; }

/* Inputs: Postiz's form/input.tsx and textarea.tsx. */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { display: flex; justify-content: space-between; font-size: 14px; }
.field-label .counter { font-size: 12px; color: var(--new-textItemBlur); }
.field-label .counter.over { color: var(--danger); }
input[type="text"], input[type="password"], textarea {
  width: 100%; background: var(--new-bgColorInner); border: 1px solid var(--new-table-border); border-radius: 8px;
  color: var(--new-textColor); font: inherit; font-size: 14px; padding: 0 16px;
}
input[type="text"], input[type="password"] { height: 42px; }
textarea { padding: 12px 16px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--new-textItemBlur); }
input:focus, textarea:focus { border-color: var(--new-btn-primary); }
input:disabled, textarea:disabled { color: var(--new-textItemBlur); }
.was { font-size: 12px; color: var(--new-textItemBlur); background: var(--new-table-header); border: 1px dashed var(--new-table-border); border-radius: 8px; padding: 8px 12px; max-height: 120px; overflow: auto; white-space: pre-wrap; }

/* Tables: Postiz's .table1. */
.table1 { width: 100%; border-collapse: collapse; border: 1px solid var(--new-table-border); border-radius: 8px; overflow: hidden; }
.table1 thead { background: var(--new-btn-simple); height: 44px; font-size: 12px; }
.table1 th { text-align: left; padding: 14px 24px; font-weight: 500; color: var(--new-table-text); }
.table1 td { text-align: left; padding: 16px 24px; font-size: 14px; border-top: 1px solid var(--new-table-border); }
.table1 tbody tr.link { cursor: pointer; }
.table1 tbody tr.link:hover { background: var(--new-box-hover); }
.table1 .title-cell { font-weight: 600; }

/* Status chips. */
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--new-btn-simple); color: var(--new-textItemBlur); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.create { color: #b69dec; }
.chip.update { color: var(--new-chart-1); }
.chip.pending, .chip.queued, .chip.publishing { color: var(--new-chart-4); }
.chip.published { color: var(--new-chart-3); }
.chip.failed { color: var(--danger); }

/* Notices. */
.notice { border-radius: 8px; padding: 12px 16px; background: var(--new-table-header); border: 1px solid var(--new-table-border); }
.notice.error { border-color: rgba(249, 112, 102, .4); color: var(--danger); }
.notice.success { border-color: rgba(0, 168, 136, .4); color: #32d583; }
.notice.info a, .notice a.underline { text-decoration: underline; }
.notes { white-space: pre-wrap; }

/* Empty state, as Postiz's "No channels yet". */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 60px 20px; }
.empty .empty-title { font-weight: 600; font-size: 20px; }

/* Draft editor + preview. */
.editor { display: grid; grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); gap: 20px; align-items: start; }
.editor-fields { display: flex; flex-direction: column; gap: 16px; }
.preview-col { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 12px; }
.preview-box { border: 1px solid var(--new-table-border); border-radius: 8px; background: var(--new-table-header); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.preview-box .preview-label { font-size: 12px; color: var(--new-textItemBlur); }
.serp-url { color: var(--new-textItemBlur); font-size: 12px; }
.serp-title { color: #8ab4f8; font-size: 18px; line-height: 1.3; }
.serp-desc { color: #bdc1c6; font-size: 13px; }
.rte { border: 1px solid var(--new-table-border); border-radius: 8px; background: var(--new-bgColorInner); overflow: hidden; }
.rte:focus-within { border-color: var(--new-btn-primary); }
.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--new-table-border); background: var(--new-table-header); }
.rte-format {
  height: 32px; padding: 0 8px; margin-right: 4px; border-radius: 6px; border: 1px solid var(--new-table-border);
  background: var(--new-bgColorInner); color: var(--new-textColor); font: inherit; font-size: 13px;
}
.rte-btn {
  min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--new-textItemBlur); font: inherit; font-size: 13px; font-weight: 600;
}
.rte-btn:hover { background: var(--new-btn-simple); color: var(--new-textColor); }
.rte-btn[data-cmd="italic"] { font-style: italic; }
.rte-btn[data-cmd="underline"] { text-decoration: underline; }
.rte-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--new-blockSeparator); }
.rte-spacer { flex: 1; }
.rte.html-mode .rte-btn:not([data-toggle-html]), .rte.html-mode .rte-format { opacity: .4; pointer-events: none; }
.rte.html-mode [data-toggle-html] { background: var(--new-btn-simple); color: var(--new-textColor); }
.rte-frame { display: block; width: 100%; min-height: 280px; border: 0; background: transparent; }
.rte-source {
  display: block; width: 100%; min-height: 280px; border: 0; border-radius: 0; padding: 12px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--new-bgColorInner);
}
.rte-source[hidden], .rte-frame[hidden] { display: none; }
details.was summary { cursor: pointer; }
details.was .rte-frame { min-height: 0; margin-top: 8px; border: 1px solid var(--new-table-border); border-radius: 6px; }
.meta { display: flex; flex-direction: column; gap: 12px; }
.meta-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.meta-row > :first-child { color: var(--new-textItemBlur); }
.sep { height: 1px; background: var(--new-blockSeparator); }

/* Product cards, laid out like Shopify's product page. */
.card { border: 1px solid var(--new-table-border); border-radius: 8px; background: var(--new-table-header); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card-title { font-weight: 600; }
.copy-field { display: flex; gap: 8px; }
.copy-field input {
  flex: 1; min-width: 0; height: 42px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--new-border);
  background: var(--new-bgColor); color: var(--new-textColor); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
}
.ask { padding: 10px 14px; border-radius: 8px; background: var(--new-bgLineColor, rgba(255,255,255,.04)); font-style: italic; }
.card .rte, .card input[type="text"], .card textarea, .card .preview-box { background: var(--new-bgColorInner); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.checks { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--new-chart-4); font-size: 13px; }
.check-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow: auto; border: 1px solid var(--new-table-border); border-radius: 8px; background: var(--new-bgColorInner); padding: 6px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.check-row:hover { background: var(--new-box-hover); }
input[type="checkbox"] { accent-color: var(--new-btn-primary); width: 16px; height: 16px; margin: 0; cursor: pointer; }
select.select { height: 42px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--new-table-border); background: var(--new-bgColorInner); color: var(--new-textColor); font: inherit; }
.side-heading { font-size: 12px; color: var(--new-textItemBlur); margin-top: 8px; }
.side-bottom { margin-top: auto; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-item .label.ellipsis { min-width: 0; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.underline { text-decoration: underline; }
.bulkbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.table1 .check-cell { width: 44px; padding-right: 0; }
.table1 a.title-cell { font-weight: 600; }
.table1 td.product-cell { width: 100%; min-width: 260px; }
.product-row { display: flex; align-items: center; gap: 12px; }
.thumb { width: 40px; height: 40px; flex: none; border-radius: 6px; object-fit: cover; background: var(--new-table-header); border: 1px solid var(--new-table-border); }
.image-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.image-strip img { width: 72px; height: 72px; border-radius: 6px; object-fit: cover; border: 1px solid var(--new-table-border); background: var(--new-table-header); }
.variant-table input { min-width: 80px; }
.table1 td:not(.product-cell):not(.wrap) { white-space: nowrap; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--new-bgColorInner); }
.section.wide { max-width: 980px; }
ul.plain { margin: 0; padding-left: 18px; color: var(--new-textItemBlur); display: flex; flex-direction: column; gap: 4px; }

/* Settings sections. */
.section { display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.section-box { border: 1px solid var(--new-table-border); border-radius: 8px; background: var(--new-table-header); padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* Auth: Postiz's split auth layout. */
.auth { display: flex; gap: 12px; padding: 12px; min-height: 100vh; }
.auth-card { width: 600px; flex: none; background: var(--new-bgColorInner); border-radius: 12px; padding: 40px 20px; display: flex; }
.auth-inner { width: 100%; max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.auth-inner h1 { font-size: 32px; font-weight: 600; margin: 0; }
.auth-side { flex: 1; display: flex; flex-direction: column; align-items: center; padding-top: 88px; font-size: 36px; text-align: center; }
.auth-side .big { font-size: 42px; color: var(--new-table-text-focused); }

@media (max-width: 1025px) {
  .app { flex-direction: column; padding: 8px; }
  .rail { width: 100%; height: auto; position: static; flex-direction: row; padding: 8px; gap: 12px; }
  .rail-menu { flex-direction: row; width: auto; }
  .rail-menu .menu-item { width: 64px; }
  .content { flex-direction: column; }
  .side-panel { width: 100%; }
  .editor, .product-page { grid-template-columns: 1fr; }
  .auth-card { width: 100%; }
  .auth-side { display: none; }
}
