/* ============================================
   Buteco Bar — Design System
   app.css v1.0
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  --background: hsl(20 16% 97%);
  --foreground: hsl(20 25% 10%);
  --card: hsl(0 0% 100%);
  --card-foreground: var(--foreground);
  --primary: hsl(25 95% 53%);
  --primary-hover: hsl(25 95% 46%);
  --primary-foreground: #fff;
  --sidebar-bg: hsl(20 20% 8%);
  --sidebar-fg: hsl(30 15% 80%);
  --sidebar-accent: hsl(20 18% 14%);
  --border: hsl(30 12% 89%);
  --muted: hsl(30 12% 94%);
  --muted-foreground: hsl(20 10% 46%);
  --success: hsl(152 60% 36%);
  --success-light: hsl(152 50% 94%);
  --destructive: hsl(0 72% 51%);
  --destructive-light: hsl(0 60% 95%);
  --warning: hsl(45 93% 47%);
  --warning-light: hsl(45 80% 94%);
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --transition: 150ms ease;
  --sidebar-width: 240px;
}

/* --- CSS Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, h5, h6, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

/* --- Base --- */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.25;
  color: var(--foreground);
}
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

/* --- Utility Classes --- */
.flex        { display: flex; }
.inline-flex { display: inline-flex; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-col    { flex-direction: column; }
.flex-1      { flex: 1; }
.flex-wrap   { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.grid        { display: grid; }
.hidden      { display: none; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-sm     { font-size: 0.8125rem; }
.text-xs     { font-size: 0.75rem; }
.text-lg     { font-size: 1.125rem; }
.text-muted  { color: var(--muted-foreground); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold   { font-weight: 700; }
.w-full      { width: 100%; }
.relative    { position: relative; }
.overflow-auto { overflow: auto; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-3 { padding-inline: 0.75rem; }
.py-1 { padding-block: 0.25rem; }

/* --- Card --- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

/* --- KPI Card --- */
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.kpi-card .kpi-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.kpi-card .kpi-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--foreground);
}
.kpi-card .kpi-sub {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  user-select: none;
  line-height: 1.5;
}
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn-outline {
  background: transparent;
  color: var(--foreground);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--muted);
  border-color: var(--border);
}
.btn-destructive {
  background: var(--destructive);
  color: #fff;
  border-color: var(--destructive);
}
.btn-destructive:hover:not(:disabled) {
  background: hsl(0 72% 44%);
}
.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--muted);
  color: var(--foreground);
}
.btn-sm {
  font-size: 0.8125rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
}

/* --- Form Inputs --- */
.input, .select {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px hsla(25, 95%, 53%, 0.15);
}
.input::placeholder {
  color: var(--muted-foreground);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23777' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--foreground);
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  white-space: nowrap;
  background: var(--muted);
  color: var(--muted-foreground);
}
.badge-success {
  background: var(--success-light);
  color: var(--success);
}
.badge-warning {
  background: var(--warning-light);
  color: hsl(35 80% 36%);
}
.badge-destructive {
  background: var(--destructive-light);
  color: var(--destructive);
}
.badge-primary {
  background: hsl(25 90% 94%);
  color: var(--primary);
}

/* --- Status Dots --- */
.dot-success, .dot-warning, .dot-danger {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-success { background: var(--success); }
.dot-warning { background: var(--warning); }
.dot-danger  { background: var(--destructive); }

/* --- Table --- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--muted);
}
.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover {
  background: hsl(30 12% 97%);
}
.table tbody tr:nth-child(even) {
  background: hsl(30 10% 98.5%);
}
.table tbody tr:nth-child(even):hover {
  background: hsl(30 12% 97%);
}

/* --- Page Layout --- */
.page {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow-y: auto;
  transition: transform 300ms ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.125rem;
  color: #fff;
  border-bottom: 1px solid var(--sidebar-accent);
}
.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}
.sidebar-section {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(30 10% 45%);
  padding: 1rem 1rem 0.375rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sidebar-fg);
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  cursor: pointer;
}
.sidebar-link:hover {
  background: var(--sidebar-accent);
  color: #fff;
}
.sidebar-link.active {
  background: var(--sidebar-accent);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.sidebar-link svg,
.sidebar-link i {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-link.active svg,
.sidebar-link.active i {
  opacity: 1;
}
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--sidebar-accent);
  font-size: 0.8125rem;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  min-height: 3.5rem;
}
.header-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--foreground);
  color: #fff;
  box-shadow: var(--shadow-md);
  transform: translateY(0);
  opacity: 1;
  transition: transform 300ms ease, opacity 300ms ease;
  max-width: 24rem;
}
.toast.toast-hidden {
  transform: translateY(1rem);
  opacity: 0;
  pointer-events: none;
}
.toast-success {
  background: var(--success);
  color: #fff;
}
.toast-error {
  background: var(--destructive);
  color: #fff;
}

/* --- Modal / Dialog --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  opacity: 1;
  transition: opacity 200ms ease;
}
.modal-overlay[hidden] {
  display: none;
}
.modal-content {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  padding: 1.5rem;
  width: 90%;
  max-width: 32rem;
  max-height: 85vh;
  overflow-y: auto;
  animation: modal-in 200ms ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.modal-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
}
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted-foreground);
  transition: background var(--transition);
}
.modal-close:hover {
  background: var(--muted);
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--sidebar-accent);
}

/* --- Mobile Toggle --- */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--foreground);
}
.sidebar-toggle:hover {
  background: var(--muted);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: inline-flex;
  }
  .header {
    padding: 0.75rem 1rem;
  }
  .modal-content {
    width: 95%;
    padding: 1.25rem;
  }
}

/* --- Print --- */
@media print {
  .sidebar,
  .header,
  .sidebar-toggle,
  nav,
  .toast {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
  }
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }
}
