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

:root {
  --sidebar-w: 240px;
  --sidebar-bg: #3b1a0f;
  --sidebar-hover: #5a2a18;
  --sidebar-active: #e0562b;
  --accent: #e0562b;
  --accent-hover: #c8461f;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --bg: #fdf8f5;
  --white: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

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

/* ─── SIDEBAR ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #f3d9c9;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 24px 20px 16px;
  font-size: 26px; font-weight: 800; letter-spacing: -1px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.logo-pizza { color: #fff; }
.logo-pool  { color: #f2a679; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-group { margin-bottom: 8px; }
.nav-label {
  display: block;
  padding: 10px 20px 4px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: #e0562b; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  color: #f2c9ae; text-decoration: none; font-size: 13px;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: rgba(224,86,43,.3); color: #fff; border-left-color: var(--accent); }

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: #f2c9ae;
}
.user-sair {
  color: #f87171; text-decoration: none; font-size: 12px;
  padding: 4px 8px; border-radius: 4px;
  transition: background .15s;
}
.user-sair:hover { background: rgba(248,113,113,.15); }

/* ─── MAIN CONTENT ────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

/* ─── PAGE HEADER ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ─── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  text-decoration: none; border: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn-primary  { background: var(--accent);  color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--white); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f3f4f6; }
.btn-danger   { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-full     { width: 100%; justify-content: center; }
.btn-sm       { padding: 5px 10px; font-size: 12px; }

button[disabled] { opacity: .4; cursor: not-allowed; }

/* ─── FLASH ───────────────────────────────────────────────────────────────── */
.flash {
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 20px; font-size: 13px; font-weight: 500;
}
.flash-ok  { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-erro { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ─── TABLE ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 13px; }
.data-table th {
  padding: 10px 14px; text-align: left;
  background: #f9fafb; font-weight: 600; font-size: 12px;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9fafb; }
.muted { color: var(--muted); }

/* ─── FORMS ───────────────────────────────────────────────────────────────── */
.form-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  max-width: 560px; box-shadow: var(--shadow);
}
.form-card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; position: relative; }
.field label { font-size: 13px; font-weight: 500; color: #374151; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input-text, .input-search, select.input-text {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; color: var(--text);
  outline: none; transition: border-color .15s;
  background: var(--white);
}
.input-text:focus, .input-search:focus { border-color: var(--accent); }
textarea.input-text { resize: vertical; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }

/* ─── KPI GRID ────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.kpi-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 16px;
  box-shadow: var(--shadow); text-align: center;
}
.kpi-value { font-size: 28px; font-weight: 800; color: var(--accent); line-height: 1.1; }
.kpi-label { font-size: 11px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }

/* ─── AUTOCOMPLETE (busca de cliente) ─────────────────────────────────────── */
.autocomplete-box {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--white); box-shadow: 0 4px 12px rgba(0,0,0,.1);
  max-height: 240px; overflow-y: auto;
  position: absolute; z-index: 100; width: 100%; top: 100%; left: 0;
}
.ac-item {
  padding: 10px 14px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  border-bottom: 1px solid #f3f4f6;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: #fdece3; }
.ac-item strong { font-size: 13px; }
.ac-item small { font-size: 11px; color: var(--muted); }
.ac-empty { padding: 12px 14px; color: var(--muted); font-size: 13px; }
.sel-preview {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; background: #f9fafb; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px;
}
.sel-preview a { font-size: 12px; color: var(--accent); }

/* ─── COMPOSIÇÃO (ingrediente x quantidade) ───────────────────────────────── */
.compose-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.compose-row select, .compose-row input { flex: 1; }
.compose-remove { color: var(--red); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 6px; }

/* ─── STATUS BADGE (pedido) ───────────────────────────────────────────────── */
.status-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.status-recebido      { background: #dbeafe; color: #1e40af; }
.status-preparo        { background: #fef9c3; color: #854d0e; }
.status-saiu_entrega  { background: #ede9fe; color: #5b21b6; }
.status-entregue       { background: #dcfce7; color: #15803d; }
.status-cancelado      { background: #fef2f2; color: #991b1b; }

/* ─── EMPTY STATE ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--muted); font-size: 14px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ─── LOGIN ───────────────────────────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #fdece3; }
.login-box {
  background: var(--white); border-radius: 12px;
  padding: 40px 36px; width: 360px;
  box-shadow: 0 8px 32px rgba(224,86,43,.14);
}
.login-logo { font-size: 36px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }

/* ─── SIDEBAR CONTEXT ─────────────────────────────────────────────────────── */
.sidebar-ctx {
  padding: 10px 20px 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.ctx-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  background: rgba(224,86,43,.3); color: #fde3d5;
  padding: 2px 8px; border-radius: 999px; margin-bottom: 4px;
}
.ctx-nome { display: block; font-size: 12px; color: #fde3d5; font-weight: 600; }

@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .main-content { margin-left: 200px; padding: 20px 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .field-row { grid-template-columns: 1fr; }
}
