/* Design tokens - Updated for a Behrouz/Royal Aesthetic */
:root {
  /* New Colors: Deep Purple/Maroon (Primary), Gold (Accent), Cream/Off-White (Background) */
  --primary: #5d3f6a; /* Deep Royal Purple */
  --primary-600: #4a3253; /* Darker Purple */
  --danger: #e74c3c;
  --danger-600: #cf3d2e;
  --accent: #d4af37; /* Consistent Gold accent */
  --warm-red: #8b0000; /* Deep Maroon/Regal Red */

  --bg: #f9f4e8; /* Creamy off-white background */
  --surface: #ffffff;
  --text: #2c3e50; /* Dark, sophisticated text */
  --muted: #7f8c8d; /* Muted gray */

  --border: #e0d7c7; /* Softer border color */
  --border-strong: #c7beae;

  --radius: 16px; /* Slightly larger radius for elegance */
  --radius-sm: 10px;
  --shadow-sm: 0 4px 12px rgba(0,0,0,.08); /* Stronger, softer shadows */
  --shadow: 0 10px 30px rgba(0,0,0,.15);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.20);

  --grid-gap: 20px; /* Slightly larger gap */
}

/* Base */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  /* Using a more elegant font stack */
  font-family: 'Georgia', serif, ui-sans-serif, system-ui; 
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* Background pattern for body */
body {
  background-attachment: fixed;
  background-blend-mode: soft-light; /* Changed blend mode for subtlety */
}

.container { width: 94%; max-width: 1100px; margin: 0 auto; }

/* Header / Nav - Elevated Style */
.header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; /* More vertical padding */
  background: var(--surface);
  border-bottom: 2px solid var(--border-strong); /* Stronger bottom line */
  backdrop-filter: saturate(120%) blur(4px);
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-link, .brand h1 {
  font-weight: 900; font-size: 24px; margin: 0;
  letter-spacing: 1px;
  /* Use the royal purple and gold gradient */
  background: linear-gradient(45deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo { 
  width: 45px; height: 45px; object-fit: cover; 
  border-radius: 50%; /* Make the logo circular for a crest-like feel */
  border: 2px solid var(--accent); /* Gold ring around logo */
}

/* Buttons - Royal Primary */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: #f3f4f6;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  font-weight: 600; /* Slightly bolder text */
}
.btn.primary {
  /* Purple gradient */
  background: linear-gradient(90deg, var(--primary), #8e44ad);
  color: #fff;
  border-color: var(--primary);
}
.btn.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn.outline {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary);
}
.btn:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.02);
  filter: brightness(1.05);
  box-shadow: var(--shadow);
}
.btn.primary:hover:not(:disabled) { 
  background: linear-gradient(90deg, var(--primary-600), #9b59b6); 
  box-shadow: 0 8px 22px rgba(93, 63, 106, .4); /* Purple shadow */
}
.btn.danger:hover:not(:disabled) { background: var(--danger-600); border-color: var(--danger-600); box-shadow: 0 8px 22px rgba(231,76,60,.24); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid rgba(59,130,246,.35); outline-offset: 2px; }

/* Sections */
.hero {
  text-align: center; padding: 64px 0;
  /* Subtle radial gradient for lighting */
  background: radial-gradient(1200px 400px at 50% -100px, rgba(93, 63, 106,.12), transparent 60%);
}
.center { text-align: center; padding: 40px 0; }

.section { padding: 32px 0; } /* More padding for breathing room */
.section h2 { 
  margin: 0 0 8px 0; font-size: 28px; 
  color: var(--warm-red); /* Maroon headings */
  border-bottom: 2px solid var(--border); /* Underline for elegance */
  padding-bottom: 4px;
  display: inline-block;
  font-weight: 800;
}
.section-lead { color: var(--muted); margin: 0 0 16px 0; font-size: 16px; }

/* Hero banner - Dramatic Look */
.hero-banner {
  position: relative;
  padding: 100px 0;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background-size: cover;
  background-position: center;
}
.hero-banner::before {
  content: '';
  position: absolute; inset: 0;
  /* Deep purple overlay */
  background: linear-gradient(180deg, rgba(44, 62, 80,.5), rgba(93,63,106,0.6)); 
}
.hero-banner .hero-content {
  position: relative; z-index: 1; color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,.4); /* Stronger shadow for drama */
}
.hero-actions { margin-top: 16px; display: inline-flex; gap: 12px; }

/* Features - Elevated Cards */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--grid-gap);
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: grid; gap: 8px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
}
.feature-icon {
  width: 60px; height: 60px; margin: 0 auto 12px;
  object-fit: cover; border-radius: 50%;
  border: 2px solid var(--accent); /* Gold ring around icon */
}
.feature-card h3 { margin: 0; font-size: 18px; color: var(--primary); font-weight: 700; }
.feature-card p { margin: 0; color: var(--muted); font-size: 14px; }

/* Empty state */
.empty {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

/* Footer - Primary Color */
.footer { 
  margin-top: 50px; 
  background: var(--primary); 
  border-top: 1px solid var(--primary-600); 
  color: #fff;
}
.foot-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0; }
.footer strong { color: var(--accent); } /* Gold accent on name */
.footer small { color: #e0d7c7; } /* Lighter muted text */

/* Cards & Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--grid-gap); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--primary); }
.card img {
  width: 100%;
  aspect-ratio: 16/12; /* Taller image to display product better */
  object-fit: cover;
  background: #f3f4f6;
}
.card-body { padding: 16px; display: grid; gap: 8px; }
.card-body strong { font-size: 18px; color: var(--warm-red); } /* Maroon name */
.price { font-weight: 800; }

/* Table (Admin) */
.table { width: 100%; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table .row {
  display: grid;
  grid-template-columns: 60px 180px 120px 140px 160px 1fr 200px;
  gap: 10px; padding: 14px 12px; border-bottom: 1px solid var(--border);
  align-items: start; font-size: 14px;
}
.table .row.head {
  font-weight: 800; background: #f9f4e8; position: sticky; top: 52px; z-index: 1;
}
.table .row:nth-child(even):not(.head) { background: #fcfaf3; }
.items div { font-size: 12px; color: var(--muted); }

/* Forms */
.form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--text); }
input[type="text"], input[type="tel"], input[type="number"], input[type="password"], input[type="file"] {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(93, 63, 106,.2); }

/* Notices */
.notice {
  background: #e8f5e9;
  padding: 12px 14px; border: 1px solid #c8e6c9; border-radius: var(--radius-sm); margin: 12px 0; color: #2e7d32;
}
.alert {
  background: #ffebee;
  padding: 12px 14px; border: 1px solid #ffcdd2; border-radius: var(--radius-sm); margin: 12px 0; color: #c62828;
}
.muted { color: var(--muted); font-size: 14px; }

/* Badges */
.badge { display:inline-block; padding:4px 10px; border-radius: 999px; font-size:12px; border:1px solid var(--border); background: #f7f7fa; }
.badge.ok { background: #e8f5e9; border-color:#c8e6c9; color:#2e7d32; }
.badge.err { background: #ffebee; border-color:#ffcdd2; color:#c62828; }
.badge.warn { background: #fff8e1; border-color:#ffecb3; color:#8d6e63; }

/* Cart */
.cart-list { display: grid; gap: 16px; }
.cart-item {
  display: grid; grid-template-columns: 100px 1fr 120px; gap: 16px; align-items: center;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.cart-item img { width: 100px; height: 100px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.cart-details h3 { margin: 0; font-size: 18px; color: var(--warm-red); }
.inline { display: inline-flex; gap: 8px; align-items: center; margin-right: 8px; }
.cart-summary { display: flex; align-items: center; gap: 16px; justify-content: flex-end; padding: 16px 0; }
.total { font-size: 24px; font-weight: 900; color: var(--warm-red); }

/* Checkout */
.qr { width: 260px; max-width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px; background: #fff; box-shadow: var(--shadow-sm); }
.checkout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--grid-gap); }
.checkout-panel { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }

/* Invoice */
.invoice {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin: 20px auto;
  max-width: 820px;
}
.invoice-header { display:flex; align-items:center; justify-content:space-between; margin-bottom: 12px; }
.invoice-brand { font-weight: 900; font-size: 24px; color: var(--primary); }
.invoice-meta, .invoice-to { color: var(--muted); font-size: 14px; }
.invoice-items { margin-top: 16px; border-top:1px solid var(--border); }
.invoice-items .i-head,
.invoice-items .i-row {
  display:grid; grid-template-columns: 1fr 140px; gap: 8px; padding: 12px 0; border-bottom:1px solid var(--border);
}
.invoice-items .i-head {
  font-weight: 800; background: #f9f4e8; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); margin-top: 12px;
}
.invoice-items .i-row:last-child { border-bottom: none; }
.invoice-total { display:flex; justify-content:flex-end; gap:16px; align-items:center; font-size: 20px; font-weight: 900; padding-top: 16px; color: var(--warm-red); }
.invoice-actions { display:flex; justify-content:flex-end; gap:8px; margin-top: 16px; }

/* Utilities */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 900px) {
  .table .row { grid-template-columns: 50px 150px 100px 120px 140px 1fr 160px; }
  .checkout-grid { grid-template-columns: 1fr; }
  .invoice-items .i-head, .invoice-items .i-row { grid-template-columns: 1fr 120px; }
}
@media (max-width: 700px) {
  .container { width: 92%; }
  .table .row { grid-template-columns: 50px 120px 90px 110px 120px 1fr 140px; }
  .cart-item { grid-template-columns: 80px 1fr; }
  .cart-details h3 { font-size: 16px; }
  .cart-line-total { justify-self: end; font-weight: 700; }
  .brand-link, .brand h1 { font-size: 20px; }
  .logo { width: 40px; height: 40px; }
}

/* Print */
@media print {
  body { background: #fff; }
  header, nav, .hero, .notice, .alert, .btn:not(#print-btn) { display: none !important; }
  .invoice { box-shadow: none; border: 0; margin: 0; max-width: 100%; }
  .invoice-actions { display: none !important; }
}