/* Shared layout for the operator panel: variables, sidebar, top bar and buttons.
   Loaded by templates/operator/base.html before each page's own stylesheet. */

:root {
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --bg: #f4f7fb;
  --border: #e5e7eb;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --accent: #2563eb;
  --warning: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 12px 34px rgba(15, 23, 42, 0.09);
  --radius: 16px;
  --sidebar-width: 250px;

  /* Text */
  --text-secondary: #334155;
  --text-tertiary: #475569;
  --text-faint: #94a3b8;
  --text-inverse: #fff;
  --text-inverse-muted: rgba(255,255,255,.74);

  /* Sidebar */
  --navy: #0f172a;
  --sidebar-bg: var(--navy);
  --sidebar-text: #cbd5e1;
  --sidebar-active-bg: rgba(255,255,255,.08);
  --backdrop: rgba(15, 23, 42, 0.45);

  /* Page, panels and borders */
  --page-top: #eef4fb;
  --page-gradient: linear-gradient(to bottom, var(--page-top), var(--surface-soft) 260px);
  --surface-glass: rgba(255,255,255,.92);
  --topbar-bg: rgba(255,255,255,.88);
  --topbar-border: rgba(255,255,255,.7);
  --panel-border: rgba(226, 232, 240, .95);
  --border-strong: #cbd5e1;
  --divider: #eef2f7;

  /* Hero boxes (dark gradients) */
  --hero-dark: rgba(15, 23, 42, .94);
  --hero-blue: rgba(37, 99, 235, .82);
  --hero-blue-deep: rgba(30, 64, 175, .82);
  --hero-green: rgba(22, 163, 74, .82);
  --hero-green-deep: rgba(22, 101, 52, .84);
  --hero-shadow-color: rgba(15, 23, 42, .18);
  --on-dark-fill: rgba(255,255,255,.14);
  --on-dark-border: rgba(255,255,255,.22);

  /* Status colours (badges, messages) */
  --success-bg: #ecfdf5;
  --success-bg-strong: #dcfce7;
  --success-text: #166534;
  --success-border: #bbf7d0;
  --warning-bg: #fff7ed;
  --warning-text: #9a3412;
  --warning-border: #fed7aa;
  --danger-bg: #fef2f2;
  --danger-bg-strong: #fee2e2;
  --danger-text: #991b1b;
  --danger-strong: #b91c1c;
  --danger-border: #fecaca;
  --info-bg: #eef2ff;
  --info-text: #3730a3;
  --info-border: #c7d2fe;
  --neutral-bg: #f1f5f9;
  --neutral-border: #e2e8f0;
  --notice-bg: #eff6ff;
  --notice-text: #1e40af;
  --notice-border: #dbeafe;
  --notice-border-strong: #bfdbfe;

  /* Focus ring */
  --focus-ring-color: rgba(34, 197, 94, .16);
}

* { box-sizing: border-box; }

/* Keep the hidden attribute working even when a class sets display (e.g. .chart-empty). */
[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }

/* Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--text-inverse);
  padding: 20px;
  transform: translateX(-100%);
  transition: transform .28s ease;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 20px 40px rgba(0,0,0,.25);
}

.sidebar-header h2 { margin: 0; font-size: 20px; }
.close-btn { cursor: pointer; font-size: 20px; color: var(--sidebar-text); }
.sidebar-nav { display: flex; flex-direction: column; gap: 8px; }
.sidebar-nav a { padding: 12px 14px; border-radius: 12px; color: var(--sidebar-text); transition: .2s ease; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: var(--sidebar-active-bg); color: var(--text-inverse); }

.backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  opacity: 0;
  visibility: hidden;
  transition: .25s ease;
  z-index: 1000;
}

#menu-toggle:checked + .sidebar { transform: translateX(0); }
#menu-toggle:checked ~ .backdrop { opacity: 1; visibility: visible; }

/* Top bar */
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }

.eyebrow {
  margin: 0 0 2px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 600;
}

/* Buttons */
.btn {
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: .2s ease;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 42px;
}

.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: var(--text-inverse); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }

/* Shared page layout and components (moved from the page stylesheets) */
.pager-btn {
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: .2s ease;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 42px;
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.pager-btn:hover { transform: translateY(-1px); }
.filters { gap: 12px; align-items: end; }
.detail-grid { display: grid; }
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
}
.page-indicator { color: var(--muted); padding: 0 6px; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; }
.table-wrap { overflow-x: auto; }
.panel-link { color: var(--accent); font-weight: 600; }

@media (max-width: 760px) {
  .orders-table thead { display: none; }
  .orders-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
  }
}

@media (min-width: 1100px) {
  .sidebar { transform: translateX(0); }
  .backdrop, .close-btn { display: none; }
}

/* Shared look for all operator pages: layout, hero, panels, lists, forms, messages */
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--page-gradient);
}
.main { min-height: 100vh; padding: 18px; margin: 0 auto; max-width: 1400px; }
.topbar {
  background: var(--topbar-bg);
  box-shadow: var(--shadow);
  position: sticky;
  top: 14px;
  z-index: 20;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: rise-in .42s ease both;
  backdrop-filter: blur(12px);
  padding: 14px 18px;
  border: 1px solid var(--topbar-border);
  border-radius: var(--radius);
}
.topbar h1 { margin: 0; line-height: 1.1; font-size: clamp(20px, 3vw, 28px); }
.actions, .filter-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.menu-btn {
  cursor: pointer;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 28px;
  width: 50px;
  height: 50px;
  border-radius: 14px;
}
.hero-strip {
  padding: 24px;
  border-radius: 20px;
  color: var(--text-inverse);
  box-shadow: 0 24px 50px var(--hero-shadow-color);
  animation: rise-in .42s ease both;
  animation-delay: .04s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(135deg, var(--hero-dark), var(--hero-blue-deep)), linear-gradient(135deg, var(--navy), var(--accent));
  margin-bottom: 18px;
  overflow: hidden;
  position: relative;
}
.hero-strip .eyebrow { color: var(--text-inverse-muted); }
.hero-strip h2 {
  margin: 0;
  line-height: 1.1;
  font-size: clamp(30px, 5vw, 52px);
  margin-bottom: 8px;
}
.hero-strip p { margin: 0; color: var(--text-inverse-muted); }
.panel {
  padding: 18px;
  animation: rise-in .42s ease both;
  background: var(--surface-glass);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.panel-header h2 { margin: 0; line-height: 1.1; font-size: 20px; }
.filter-panel {
  animation: rise-in .42s ease both;
  background: var(--surface-glass);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation-delay: .08s;
  padding: 16px;
  margin-bottom: 18px;
}
.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
  color: var(--muted);
}
.empty-state h3 { margin: 0; color: var(--text); }
.empty-state p { margin: 0 0 8px; }
.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}
.status-ny {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}
.status-ferdig {
  background: var(--neutral-bg);
  color: var(--text-secondary);
  border-color: var(--neutral-border);
}
.date-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: var(--text-secondary);
}
.orders-table { width: 100%; border-collapse: separate; border-spacing: 0 10px; min-width: 900px; }
.orders-table th {
  padding: 0 14px 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.orders-table td {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px;
  vertical-align: middle;
}
.pager-btn.disabled {
  color: var(--text-faint);
  background: var(--surface-soft);
  cursor: not-allowed;
}
.pager-btn.disabled:hover { transform: none; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label { font-size: 15px; line-height: 1.35; color: var(--muted); font-weight: 600; }
.field input,
.field select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  min-height: 44px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring-color);
}
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  min-height: 44px;
  resize: vertical;
  line-height: 1.45;
}
.field-error, .form-alert { color: var(--danger); font-size: 13px; }
.field-error ul, .form-alert ul { margin: 0; padding-left: 18px; }
.field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.messages { margin-bottom: 18px; }
.message {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
  font-weight: 600;
}

@media (max-width: 1120px) {
  .filter-actions { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .topbar, .hero-strip, .panel-header { flex-direction: column; align-items: stretch; }
  .actions .btn, .filter-actions .btn, .form-actions .btn { flex: 1; }
  .menu-btn { width: 56px; height: 56px; font-size: 32px; border-radius: 16px; }
  .filter-actions { grid-column: auto; }
  .orders-table { display: block; width: 100%; min-width: 0; border-spacing: 0; }
  .orders-table td {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
    border-radius: 0;
    padding: 8px 0;
    box-shadow: none;
  }
  .orders-table tbody { display: block; width: 100%; min-width: 0; }
  .orders-table tr {
    display: block;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 12px;
    min-width: 0;
    background: var(--surface);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
  }
  .field input, .field select { min-height: 48px; font-size: 16px; }
  .field textarea { min-height: 48px; font-size: 15px; line-height: 1.55; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
}

@media (min-width: 1100px) {
  .main { margin-left: calc(var(--sidebar-width) + 18px); padding: 18px; max-width: none; }
  .menu-btn { display: none; }
}
