/* Party Rental Platform — design system + themes (hand-authored port of globals.css). */

:root {
  --brand-50: 245 243 255;  --brand-100: 237 233 254; --brand-500: 139 92 246;
  --brand-600: 124 58 237;  --brand-700: 109 40 217;
  --accent-500: 236 72 153; --accent-600: 219 39 119;
  --ink: 17 24 39; --muted: 107 114 128; --line: 229 231 235;
  --bg: 249 250 251; --card: 255 255 255;
  --ok: 16 185 129; --warn: 245 158 11; --info: 59 130 246; --danger: 244 63 94;
}
[data-theme="emerald"] { --brand-500:16 185 129; --brand-600:5 150 105; --brand-700:4 120 87; --accent-500:245 158 11; --accent-600:217 119 6; }
[data-theme="sapphire"]{ --brand-500:59 130 246; --brand-600:37 99 235; --brand-700:29 78 216; --accent-500:14 165 233; --accent-600:2 132 199; }
[data-theme="slate"]   { --brand-500:100 116 139; --brand-600:71 85 105; --brand-700:51 65 85; --accent-500:20 184 166; --accent-600:13 148 136; }
[data-theme="crimson"] { --brand-500:244 63 94; --brand-600:225 29 72; --brand-700:190 18 60; --accent-500:249 115 22; --accent-600:234 88 12; }
[data-theme="midnight"]{
  --brand-500:129 140 248; --brand-600:99 102 241; --brand-700:79 70 229; --accent-500:236 72 153; --accent-600:219 39 119;
  --ink: 226 232 240; --muted: 148 163 184; --line: 51 65 85; --bg: 15 23 42; --card: 30 41 59;
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body {
  margin: 0; background: rgb(var(--bg)); color: rgb(var(--ink));
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}
a { color: rgb(var(--brand-600)); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.2rem; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 1rem; }
.section { padding: 2.5rem 0; }
.muted { color: rgb(var(--muted)); }
.small { font-size: .85rem; }
.center { text-align: center; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.stack > * + * { margin-top: 1rem; }
.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}.mb-2{margin-bottom:1rem}
.hide { display: none; }

/* Cards */
.card { background: rgb(var(--card)); border: 1px solid rgb(var(--line)); border-radius: 14px; padding: 1.25rem; }
.card.pad-0 { padding: 0; overflow: hidden; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  padding: .6rem 1rem; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  font-weight: 600; font-size: .95rem; text-decoration: none; transition: filter .15s, background .15s; }
.btn:hover { text-decoration: none; }
.btn-primary { background: rgb(var(--brand-600)); color: #fff; }
.btn-primary:hover { filter: brightness(1.07); color:#fff; }
.btn-accent { background: rgb(var(--accent-600)); color: #fff; }
.btn-outline { background: transparent; border-color: rgb(var(--line)); color: rgb(var(--ink)); }
.btn-outline:hover { background: rgb(var(--bg)); }
.btn-danger { background: rgb(var(--danger)); color: #fff; }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; border-radius: 8px; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* Forms */
label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
.input, input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid rgb(var(--line)); border-radius: 10px;
  background: rgb(var(--card)); color: rgb(var(--ink)); font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
.input:focus, input:focus, select:focus, textarea:focus { outline: 2px solid rgb(var(--brand-500) / .5); border-color: rgb(var(--brand-500)); }
.err { color: rgb(var(--danger)); font-size: .82rem; margin-top: .25rem; }
.inline-form { display: inline; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 40; background: rgb(var(--card) / .95);
  backdrop-filter: blur(6px); border-bottom: 1px solid rgb(var(--line)); }
.site-header .container { display: flex; align-items: center; gap: 1rem; height: 64px; }
.logo { font-weight: 800; font-size: 1.15rem; color: rgb(var(--brand-700)); }
.logo:hover { text-decoration: none; }
.nav { display: flex; gap: 1.1rem; align-items: center; margin-left: 1rem; }
.nav a { color: rgb(var(--ink)); font-weight: 600; font-size: .95rem; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: .8rem; }
.cart-link { position: relative; font-weight: 700; }
.cart-badge { background: rgb(var(--accent-600)); color: #fff; border-radius: 999px;
  font-size: .7rem; padding: .05rem .4rem; margin-left: .2rem; }
.menu-toggle { display: none; background: none; border: 1px solid rgb(var(--line)); border-radius: 8px; padding: .4rem .6rem; font-size: 1.1rem; cursor:pointer; }
@media (max-width: 860px) {
  .nav.desktop, .header-right .desktop { display: none; }
  .menu-toggle { display: inline-block; }
}
.mobile-menu { display: none; border-top: 1px solid rgb(var(--line)); background: rgb(var(--card)); }
.mobile-menu.open { display: block; }
.mobile-menu a { display: block; padding: .8rem 1rem; border-bottom: 1px solid rgb(var(--line)); color: rgb(var(--ink)); font-weight: 600; }

/* Hero */
.hero { background: linear-gradient(135deg, rgb(var(--brand-600)), rgb(var(--accent-600)));
  color: #fff; border-radius: 18px; padding: 3rem 2rem; }
.hero h1 { color: #fff; font-size: 2.4rem; }
.hero p { color: #fff; opacity: .95; max-width: 640px; }

/* Badges */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-emerald { background: #d1fae5; color: #065f46; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f3f4f6; color: #374151; }
.badge-rose { background: #ffe4e6; color: #9f1239; }
.badge-brand { background: rgb(var(--brand-500) / .15); color: rgb(var(--brand-700)); }

/* Item cards */
.item-card { display: flex; flex-direction: column; }
.item-card .thumb { aspect-ratio: 4/3; background: rgb(var(--bg)); overflow: hidden; }
.item-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-card .body { padding: .9rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.price { font-weight: 800; color: rgb(var(--brand-700)); }
.stars { color: #f59e0b; letter-spacing: 1px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th, table.data td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid rgb(var(--line)); font-size: .92rem; }
table.data th { color: rgb(var(--muted)); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }

/* Alerts / flash */
.alert { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* Chips / filters */
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip { padding: .35rem .8rem; border-radius: 999px; border: 1px solid rgb(var(--line)); font-size: .85rem; font-weight: 600; color: rgb(var(--ink)); }
.chip.active { background: rgb(var(--brand-600)); color: #fff; border-color: rgb(var(--brand-600)); }

/* Summary panel */
.summary-row { display: flex; justify-content: space-between; padding: .3rem 0; }
.summary-total { font-weight: 800; font-size: 1.1rem; border-top: 1px solid rgb(var(--line)); margin-top: .4rem; padding-top: .6rem; }

/* Footer */
.site-footer { background: rgb(var(--card)); border-top: 1px solid rgb(var(--line)); margin-top: 3rem; padding: 2rem 0; color: rgb(var(--muted)); font-size: .9rem; }
.site-footer a { color: rgb(var(--muted)); }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1.5rem; }

/* Admin layout */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-side { background: rgb(var(--card)); border-right: 1px solid rgb(var(--line)); padding: 1rem; }
.admin-side .brand { font-weight: 800; color: rgb(var(--brand-700)); margin-bottom: 1rem; display:block; }
.admin-nav a { display: block; padding: .5rem .7rem; border-radius: 8px; color: rgb(var(--ink)); font-weight: 600; font-size: .92rem; }
.admin-nav a.active, .admin-nav a:hover { background: rgb(var(--brand-500) / .12); text-decoration: none; }
.admin-main { padding: 1.5rem; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 1rem; }
.stat { font-size: 1.8rem; font-weight: 800; color: rgb(var(--brand-700)); }
@media (max-width: 780px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: sticky; top: 0; z-index: 30; }
  .admin-nav { display: flex; gap: .3rem; overflow-x: auto; }
  .admin-nav a { white-space: nowrap; }
}

/* Blog article typography (clean, readable prose) */
.lead { font-size: 1.2rem; color: rgb(var(--muted)); line-height: 1.6; margin-top: .8rem; max-width: 68ch; }
.prose { max-width: 68ch; font-size: 1.06rem; line-height: 1.75; }
.prose > * + * { margin-top: 1.1rem; }
.prose h2 { font-size: 1.5rem; margin-top: 2rem; text-wrap: balance; }
.prose h3 { font-size: 1.2rem; margin-top: 1.5rem; }
.prose h2 + p, .prose h3 + p, .prose h2 + ul, .prose h3 + ul, .prose h2 + ol, .prose h3 + ol { margin-top: .55rem; }
.prose p { margin: 0; }
.prose ul, .prose ol { margin: 0; padding-left: 1.4rem; }
.prose li { margin: .35rem 0; padding-left: .2rem; }
.prose li::marker { color: rgb(var(--brand-600)); font-weight: 700; }
.prose blockquote { margin: 1.3rem 0; padding: .7rem 1.1rem; border-left: 4px solid rgb(var(--brand-500));
  background: rgb(var(--brand-500) / .06); border-radius: 0 10px 10px 0; }
.prose a { color: rgb(var(--brand-600)); text-decoration: underline; }
.prose img { border-radius: 12px; margin: 1.3rem 0; }
.prose hr { border: 0; border-top: 1px solid rgb(var(--line)); margin: 2rem 0; }
.prose strong { font-weight: 700; }
.prose-cta { max-width: 68ch; margin-top: 2.5rem; padding: 1.4rem 1.5rem; border: 1px solid rgb(var(--line));
  border-radius: 14px; background: rgb(var(--brand-500) / .06); }
.prose-cta strong { font-size: 1.1rem; display: block; }
.prose-cta p { color: rgb(var(--muted)); margin: .3rem 0 .9rem; }

@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  body { background: #fff; }
}

/* --- Mobile (phones / small tablets) ------------------------------------
   Force every two-column page body to stack. Views set the columns via an
   INLINE style, which normally beats a media query, so !important is required
   here to override it. One rule covers all storefront + admin two-col pages. */
@media (max-width: 768px) {
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Roomier spacing + smaller headings so nothing overflows a ~375px screen. */
  .container { padding: 0 .85rem; }
  .section { padding: 1.5rem 0; }
  .admin-main { padding: 1rem; }
  h1 { font-size: 1.55rem; }
  h2 { font-size: 1.3rem; }
  .hero { padding: 2rem 1.25rem; }
  .hero h1 { font-size: 1.85rem; }
  .hero p { font-size: .98rem; }
  /* Summary/side panels sit below content once stacked — remove sticky offset. */
  .card[style*="align-self:start"] { align-self: stretch !important; }

  /* --- Admin: stop grid/flex children from expanding past the screen --------
     CSS grid/flex items default to min-width:auto, so .admin-side/.admin-main
     (and the inner .grid/.card) grow to fit the wide nav + wide tables, blowing
     the layout past the viewport (then body{overflow-x:hidden} clips it). Force
     them to min-width:0 so they clamp, and let inner scrollers do their job. */
  .admin-shell,
  .admin-side,
  .admin-main,
  .admin-main .grid,
  .admin-main .card,
  .stat-cards { min-width: 0; }
  /* Every grid ITEM must be allowed to shrink, or a wide table/nav inside it
     (via .stack or a bare wrapper div) blows the column past the screen. */
  .grid > * { min-width: 0; }
  .admin-main { max-width: 100%; overflow-x: hidden; }

  /* Stat cards stack (don't rely on auto-fill inside an over-wide track). */
  .stat-cards { grid-template-columns: 1fr; }

  /* Admin nav wraps so every link shows — no hidden sideways scroll to fight. */
  .admin-nav { flex-wrap: wrap; overflow-x: visible; }
  .admin-nav a { font-size: .85rem; padding: .4rem .6rem; }

  /* Wide tables now scroll horizontally *inside their own card*. */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
