/* Restaurant Management & Accounting System — app styles */
:root {
  --brand: #b02a37;
  --brand-dark: #8c1f2b;
  --sidebar-bg: #1e1e2f;
  --sidebar-width: 240px;
  --content-bg: #f4f6f9;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--content-bg); }

/* ---- Login ---- */
.login-page { background: linear-gradient(135deg, #1e1e2f 0%, #3a1f2b 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrap { width: 100%; max-width: 420px; padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 36px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-brand h4 { margin: 0 0 4px; color: var(--brand-dark); font-weight: 700; }
.login-brand p { color: #6b7280; margin-bottom: 24px; }

/* ---- App shell ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--sidebar-bg); color: #cbd5e1; flex-shrink: 0; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 100; transition: transform .2s; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.brand-text { color: #fff; font-weight: 600; }
.sidebar-nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: 10px; color: #cbd5e1; padding: 10px 12px; border-radius: 8px; text-decoration: none; font-size: .92rem; margin-bottom: 2px; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--brand); color: #fff; }
.ni { width: 18px; text-align: center; }

.main-area { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; width: calc(100% - var(--sidebar-width)); }
.topbar { background: #fff; border-bottom: 1px solid #e5e7eb; padding: 12px 24px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-weight: 600; font-size: 1.05rem; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user { color: #374151; font-weight: 500; }

.content { padding: 24px; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; width: 100%; }
}

/* ---- Cards & stats ---- */
.stat-card { border: 0; border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.05); overflow: hidden; }
.stat-card .stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: #6b7280; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.stat-green { background: #ecfdf5; color: #059669; }
.stat-red { background: #fef2f2; color: #dc2626; }
.stat-blue { background: #eff6ff; color: #2563eb; }
.stat-amber { background: #fffbeb; color: #d97706; }
.stat-purple { background: #f5f3ff; color: #7c3aed; }
.stat-cyan { background: #ecfeff; color: #0891b2; }

.table { font-size: .9rem; }
.table thead th { background: #f8fafc; font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: #6b7280; }
.table td { vertical-align: middle; }
.badge-status { font-size: .72rem; }

.card { border: 0; border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.05); }
.card-header { background: #fff; border-bottom: 1px solid #f1f5f9; font-weight: 600; }

/* ---- Forms ---- */
.form-label { font-size: .85rem; font-weight: 500; }
.form-control, .form-select { border-radius: 8px; }
.filter-bar { background: #fff; border-radius: 14px; padding: 14px 16px; margin-bottom: 18px; box-shadow: 0 4px 16px rgba(0,0,0,.04); }

.pagination { margin: 0; }

.small-muted { font-size: .78rem; color: #6b7280; }
.money-right { text-align: right; }
.total-row td { font-weight: 700; background: #f8fafc; }

/* Report tables: keep cells on one line so columns stay readable and aligned;
   wide tables scroll horizontally instead of crumpling text. */
.table-responsive .table th, .table-responsive .table td { white-space: nowrap; }
.table-responsive .table td { vertical-align: middle; }

/* Restaurant letterhead: only shown when printing a report */
.report-print-header { display: none; }

/* Built-in image lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(15,17,21,.85); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox-img { max-width: 100%; max-height: 92vh; border-radius: 6px; box-shadow: 0 12px 48px rgba(0,0,0,.55); cursor: zoom-out; }
.lightbox-close { position: absolute; top: 16px; right: 22px; width: 44px; height: 44px; border-radius: 50%; border: none; background: rgba(255,255,255,.14); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.lightbox-close:hover { background: rgba(255,255,255,.32); }

.searchable { position: relative; }
.searchable .dropdown-list { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; max-height: 220px; overflow-y: auto; z-index: 1050; display: none; }
.searchable .dropdown-list.show { display: block; }
.searchable .dropdown-item { cursor: pointer; }

/* Upload thumbnails + crop (see js/upload-cropper.js) */
.upload-thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.upload-thumb { width: 96px; text-align: center; }
.upload-thumb img { width: 96px; height: 72px; object-fit: cover; border: 1px solid #dee2e6; border-radius: 6px; display: block; background: #f8f9fa; }
.upload-thumb-name { font-size: .68rem; color: #6c757d; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 3px 0 4px; }
.upload-thumb .crop-btn { width: 100%; padding: 2px 6px; font-size: .72rem; }
.crop-stage { max-height: 65vh; overflow: auto; text-align: center; }
#cropImage { display: block; max-width: 100%; margin: 0 auto; }

.line-items-table input { min-width: 70px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; }

/* ==========================================================================
   Clean, professional print output for reports.
   Hides app chrome (sidebar/topbar/buttons/filters) and prints just the
   report table in a compact, black-and-white layout.
   ========================================================================== */
@media print {
  body { background: #fff !important; }

  /* Hide application chrome and controls */
  .sidebar, .topbar, .filter-bar, .btn, .no-print,
  form, nav, .dropdown-list, .searchable { display: none !important; }

  /* Flatten the layout so the report uses the full page width */
  .app-shell { display: block !important; min-height: auto !important; }
  .main-area { margin: 0 !important; width: 100% !important; display: block !important; min-height: auto !important; }
  .content { padding: 0 !important; width: auto !important; }

  /* Keep only the report heading and its table */
  .card { border: none !important; box-shadow: none !important; background: #fff !important; }
  .card-header { background: #fff !important; border: none !important; font-weight: 700; }
  .table-responsive { overflow: visible !important; }

  /* Compact, crisp table */
  .table { font-size: 10.5px !important; color: #000 !important; border-collapse: collapse !important; width: 100% !important; }
  .table th, .table td { padding: 3px 6px !important; border-color: #999 !important; background: #fff !important; color: #000 !important; vertical-align: top !important; }
  .table-responsive .table th, .table-responsive .table td { white-space: normal !important; } /* wrap text in print so wide tables fit */
  .table .text-end, .table .money-right { white-space: nowrap !important; }  /* keep money on one line */
  .table tbody tr { page-break-inside: avoid !important; }                    /* don't split a row across pages */
  .table thead { display: table-header-group; }                               /* repeat header on each page */
  .table thead th { border-bottom: 2px solid #000 !important; }
  .total-row td { font-weight: 700 !important; border-top: 2px solid #000 !important; background: #fff !important; }
  .small-muted, .text-muted, .badge { color: #333 !important; background: #fff !important; }
  a { color: #000 !important; text-decoration: none !important; }

  /* Remove bootstrap accents for a clean monochrome print */
  .alert { display: none !important; }
  h5, h6 { page-break-after: avoid; }
  .card, .card-header { page-break-inside: auto !important; }

  /* Restaurant letterhead: logo in a circle beside the name/address */
  .report-print-header { display: flex !important; align-items: center; gap: 14px; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 2px solid #000; }
  .report-logo { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; }
  .report-org-name { font-size: 17px; font-weight: 700; line-height: 1.15; }
  .report-org-line { font-size: 11px; color: #333; }
  @page { margin: 10mm; }
}
