:root {
  --bg: #fbfcfe;
  --text: #10131a;
  --muted: #6b7280;
  --border: #e6e8f0;
  --accent: #3b5bdb; /* soft blue */
  --accent-contrast: #ffffff;
  --accent-2: #7c3aed; /* soft violet */
  /* New softer variants */
  --accent-weak: #dfe6ff;
  --accent-2-weak: #f1e9ff;
  --shadow: rgba(16,19,26,0.06);
  --glass: rgba(255,255,255,0.6);
}
/* Dark theme */
body[data-theme="dark"] {
  --bg: #0f1115;
  --text: #e5e7eb;
  --muted: #9aa0a6;
  --border: #23262d;
  --accent: #4f8cff;
  --accent-contrast: #ffffff;
  --accent-2: #a78bfa;
  --accent-weak: #1c2230;
  --accent-2-weak: #1b1726;
  --shadow: rgba(0,0,0,0.35);
  --glass: rgba(20,20,25,0.4);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg) 0%, #ffffff 100%);
  color: var(--text);
  font-family: "Cal Sans", "Noto Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

/* Brand and headings with subtle italic styling for a refined look */
.topbar .brand { font-style: italic; color: var(--accent-2); }
h2, h3 { font-style: italic; color: var(--text); }

/* Gentle topbar tint using accent-weak */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px; border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(124,58,237,0.06), rgba(59,91,219,0.04));
}
body[data-theme="dark"] .topbar { background: linear-gradient(90deg, rgba(167,139,250,0.08), rgba(79,140,255,0.06)); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px; border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: 0.2px; }
.role-switch { display: flex; gap: 8px; align-items: center; }
.role-btn {
  border: 1px solid var(--border);
  background: #fff; color: var(--text);
  padding: 8px 12px; cursor: pointer; border-radius: 6px;
}
.role-btn.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }

/* Notification icon next to role buttons */
.notif-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(59,91,219,0.06), rgba(124,58,237,0.04));
  color: var(--accent-2);
  cursor: pointer;
  border: 1px solid var(--border);
}
.notif-icon svg { display: block; color: var(--accent-2); }
.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(90deg,var(--accent-2), var(--accent));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(16,19,26,0.12);
}

/* Nav cart dropdown */
.nav-cart { position: relative; display: inline-block; }
.nav-cart .nav-cart-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 320px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16,19,26,0.08);
  padding: 10px;
  z-index: 1200;
}
.nav-cart-dropdown.hidden { display: none; }
.nav-cart-list { max-height: 260px; overflow: auto; display: grid; gap: 8px; padding: 6px 2px; }
.nav-cart-row { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:6px; border-radius:8px; }
.nav-cart-row-left { display:flex; flex-direction:column; gap:4px; }
.nav-cart-title { font-weight:600; }
.nav-cart-row-actions { display:flex; gap:6px; align-items:center; }
.nav-cart-actions { display:flex; justify-content:space-between; gap:8px; padding-top:8px; border-top:1px dashed var(--border); }
.nav-cart .secondary { padding:6px 10px; }
.nav-cart .primary { padding:6px 10px; }

.container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  padding: 24px;
}
@media (max-width: 900px) {
  .container { grid-template-columns: 1fr; }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: linear-gradient(180deg,#ffffff, #fbfbfe);
  box-shadow: 0 6px 18px var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 36px rgba(16,19,26,0.09); }
.card img {
  width: 100%; height: 140px; object-fit: cover; background: var(--accent-weak);
}
.card .info {
  padding: 12px; display: grid; gap: 8px;
}
.card .info .edit-btn {
  align-self: start; border: 1px solid transparent; background: linear-gradient(180deg, var(--accent-2-weak), #fff);
  color: var(--accent-2); padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.card .info .edit-btn:hover { border-color: var(--accent-2); }
.price { font-weight: 700; font-size: 1.05rem; color: var(--accent-2); }
.meta { color: var(--muted); font-size: 12px; }

.primary, .secondary {
  padding: 10px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}
.primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: var(--accent-contrast); box-shadow: 0 6px 18px rgba(59,91,219,0.08); }
.primary:hover { transform: translateY(-2px); filter: brightness(1.02); }
.secondary { background: #fff; color: var(--text); }
.primary:active, .secondary:active { transform: scale(0.99); }

.cart {
  border: 1px solid var(--border); border-radius: 12px; padding: 16px; height: fit-content;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), #ffffff);
}
.cart-items { display: grid; gap: 8px; margin-bottom: 12px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed var(--border); padding: 8px 0; }
.cart-summary { display: flex; justify-content: space-between; align-items: center; }

.product-form { display: grid; gap: 12px; margin-bottom: 20px; }
.field { display: grid; gap: 6px; }
input, select {
  padding: 10px; border: 1px solid var(--border); border-radius: 8px; outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
  background: #fff; color: var(--text);
}
body[data-theme="dark"] input, body[data-theme="dark"] select { background: #0f1115; }

input:focus, select:focus { border-color: var(--accent-2); box-shadow: 0 6px 18px rgba(124,58,237,0.06); }

.notifications {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding-top: 16px; margin-top: 8px;
}
.notif-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.notif-list { display: grid; gap: 10px; }
.notif {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: linear-gradient(180deg,#fff,#fbfbff); display: grid; gap: 6px;
}
.notif-top { display: flex; justify-content: space-between; align-items: baseline; }
.badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-weight: 600; }
.badge.unread { background: linear-gradient(90deg,var(--accent-2), var(--accent)); color: #fff; border-color: transparent; }
.badge.active { background: linear-gradient(90deg,#6ea8fe,#9b63ff); color: #fff; border-color: transparent; }
.badge.danger { background: linear-gradient(90deg,#fca5a5,#f87171); color:#fff; border-color: transparent; }
.order-actions { display: flex; gap: 8px; }

.order-details { display: none; border-top: 1px dashed var(--border); margin-top: 8px; padding-top: 8px; }
.order-details.open { display: block; }

/* Map section */
.map-section { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-top: 12px; background: #fff; box-shadow: 0 6px 18px var(--shadow); }
body[data-theme="dark"] .map-section { background: #0f1115; }
.map-wrap { width: 100%; height: 260px; overflow: hidden; border-radius: 8px; margin-top: 8px; }
.map-wrap iframe { width: 100%; height: 100%; border: 0; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(10px);
  background: linear-gradient(90deg,var(--accent),var(--accent-2));
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16,19,26,0.18);
  font-weight: 600;
  z-index: 1200;
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.hidden { display: none; }

/* Ensure map is visible for clients and hidden for owners if desired; keep client-only rule */
.client .map-section { display: block; }
.owner .map-section { display: none; }

/* Floating Action Button (modern, minimal, accessible) */
.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(90deg,var(--accent), var(--accent-2));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(16,19,26,0.18);
  transition: transform 160ms ease, box-shadow 160ms ease;
  z-index: 1400;
  border: 1px solid rgba(255,255,255,0.08);
}
.fab:focus { outline: 3px solid rgba(59,91,219,0.18); transform: translateY(-3px); }
.fab:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(16,19,26,0.2); }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }
.modal-content {
  width: 100%; max-width: 520px; background: rgba(255,255,255,0.98); backdrop-filter: blur(6px);
  border-radius: 12px; padding: 20px; border: 1px solid var(--border);
}
body[data-theme="dark"] .modal-content { background: rgba(20,22,26,0.98); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.hidden-block { display: none; }

/* Role visibility: allow clients to see order status but keep editing controls hidden */
.client .owner-only { display: none; }
.owner .client-only { display: none; }
/* hide notifications entirely for clients */
.client .notifications { display: none; }
/* show notifications to owners */
.owner .notifications { display: block; }

/* Catalog controls */
.controls {
  display:flex; gap:10px; align-items:center; margin: 8px 0 16px;
}
.controls .grow { flex: 1; }