@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #ed1b2f;
  --red-dark: #c4101f;
  --red-light: #ffeef0;
  --white: #ffffff;
  --off-white: #f5f4f2;
  --gray-100: #f0efed;
  --gray-200: #e4e3e0;
  --gray-300: #ccc9c4;
  --gray-400: #9a9690;
  --gray-500: #6b6760;
  --gray-700: #3a3835;
  --gray-900: #1a1816;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow: 0 2px 8px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Nunito', sans-serif;
  --mono: 'Nunito', monospace;
}

html, body { height: 100%; font-family: var(--font); color: var(--gray-900); background: var(--off-white); font-size: 15px; line-height: 1.5; }

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  height: 56px;
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; color: var(--gray-900);
  white-space: nowrap;
}
.topbar-brand .badge {
  background: var(--red-light); color: var(--red);
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
}
.topbar-brand svg { width: 32px; height: 32px; }
.topbar-nav { display: flex; gap: 4px; margin-left: 8px; }
.topbar-nav a {
  color: var(--gray-500); font-weight: 700;
  padding: 6px 12px; border-radius: var(--radius);
  font-size: 14px; transition: all .15s;
  text-decoration: none;
}
.topbar-nav a:hover { color: var(--gray-900); background: var(--gray-100); }
.topbar-nav a.active { color: var(--red); background: var(--red-light); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--red); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; cursor: pointer;
  flex-shrink: 0;
}
.cart-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--red); color: white;
  padding: 5px 12px; border-radius: 20px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s;
  border: none;
}
.cart-pill:hover { background: var(--red-dark); }
.cart-pill .count {
  background: white; color: var(--red);
  border-radius: 50%; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.btn-logout {
  background: none; border: 1px solid var(--gray-200);
  color: var(--gray-500); padding: 5px 12px; border-radius: var(--radius);
  font-size: 13px; font-family: var(--font); cursor: pointer;
  transition: all .15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; font-weight: 700;
  cursor: pointer; border: none; transition: all .15s;
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--red); color: white; }
.btn-primary:hover { background: var(--red-dark); color: white; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-ghost { background: none; color: var(--gray-500); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }
.btn-danger { background: none; color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red-light); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.form-control {
  padding: 9px 12px; border: 1px solid var(--gray-200);
  border-radius: var(--radius); font-family: var(--font); font-size: 14px;
  color: var(--gray-900); background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-control:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(237,27,47,.1); }
.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }

/* ── Cards ── */
.card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-hover { cursor: pointer; transition: all .2s; }
.card-hover:hover { border-color: var(--red); box-shadow: var(--shadow); transform: translateY(-1px); }
.card-hover.selected { border-color: var(--red); background: var(--red-light); box-shadow: 0 0 0 2px var(--red); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp .2s ease;
}
.modal-lg { max-width: 720px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 { font-size: 18px; font-weight: 900; }
.modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gray-100); border: none; cursor: pointer;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  color: var(--gray-500); transition: all .15s;
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-900); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex; justify-content: flex-end; gap: 8px;
}
@keyframes slideUp { from { opacity:0; transform: translateY(16px); } to { opacity:1; transform: translateY(0); } }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: var(--gray-100); color: var(--gray-700); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--gray-200); }
td { padding: 11px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: var(--off-white); }
tr:hover td { background: var(--red-light); }

/* ── Status badges ── */
.badge-status {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge-draft { background: var(--gray-100); color: var(--gray-500); }
.badge-sent { background: #e8f4fd; color: #1a7bc4; }
.badge-accepted { background: #e8f8ec; color: #1a7b3a; }
.badge-rejected { background: var(--red-light); color: var(--red); }
.badge-currency { background: var(--gray-100); color: var(--gray-700); margin-left: 6px; font-weight: 700; }

/* ── Konfigurator Wizard ── */
.wizard-steps { display: flex; gap: 8px; padding: 16px 0; overflow-x: auto; }
.wizard-step {
  display: flex; align-items: center; gap: 6px;
  color: var(--gray-400); font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 20px;
  white-space: nowrap; cursor: pointer;
  transition: all .15s;
}
.wizard-step.active { background: var(--red-light); color: var(--red); }
.wizard-step.done { color: var(--gray-700); }
.wizard-step .step-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--gray-200); color: var(--gray-500);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.wizard-step.active .step-num { background: var(--red); color: white; }
.wizard-step.done .step-num { background: var(--gray-700); color: white; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.product-card { padding: 16px; }
.product-card img { width: 100%; aspect-ratio: 3/2; object-fit: contain; background: #fff; padding: 8px; box-sizing: border-box; border-radius: 6px; margin-bottom: 10px; }
.product-card .placeholder-img {
  width: 100%; aspect-ratio: 3/2;
  background: var(--gray-100); border-radius: 6px; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center;
}
.product-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.product-card .desc { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; line-height: 1.4; }
.product-card .price { font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--red); }
.product-card.coming-soon { opacity: .6; cursor: default; }
.coming-soon-label { font-size: 11px; background: var(--gray-200); color: var(--gray-500); padding: 2px 8px; border-radius: 20px; }

/* Config steps */
.config-step { margin-bottom: 12px; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); overflow: hidden; }
.config-step-header {
  padding: 14px 16px; background: var(--white);
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
}
.config-step-header:hover { background: var(--gray-100); }
.config-step-header.open { border-bottom: 1px solid var(--gray-200); }
.config-step-header .step-title { font-weight: 600; font-size: 14px; }
.config-step-header .step-sel { font-size: 13px; color: var(--gray-500); }
.config-step-header .step-sel.chosen { color: var(--red); font-weight: 500; }
.config-step-body { padding: 12px; background: var(--off-white); display: none; }
.config-step-body.open { display: block; }

.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--white);
  border: 2px solid var(--gray-200); border-radius: var(--radius);
  cursor: pointer; transition: all .15s;
}
.opt:hover:not(.disabled) { border-color: var(--red); background: var(--red-light); }
.opt.selected { border-color: var(--red); background: var(--red-light); }
.opt.disabled { opacity: .4; cursor: not-allowed; }
.opt-radio {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--gray-300); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.opt.selected .opt-radio { border-color: var(--red); background: var(--red); }
.opt.selected .opt-radio::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: white; }
.opt-info { flex: 1; }
.opt-name { font-size: 14px; font-weight: 500; }
.opt-size { display: inline-block; font-family: var(--mono); font-size: 11px; color: var(--gray-500); background: var(--gray-100); border-radius: 4px; padding: 1px 6px; margin-top: 3px; }
.opt-desc { font-size: 12px; color: var(--gray-500); }
.opt-price { font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--gray-700); white-space: nowrap; }
.opt-price.plus { color: var(--red); }

/* Cart */
.cart-item { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.cart-item-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cart-item-name { font-weight: 600; font-size: 14px; }
.cart-item-variant { font-size: 12px; color: var(--gray-500); }
.cart-item-options { font-size: 12px; color: var(--gray-500); }
.cart-item-footer { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.qty-input { width: 60px; font-family: var(--mono); }
.cart-item-price { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--gray-900); margin-left: auto; }
.discount-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--off-white); border-top: 1px solid var(--gray-200); }
.total-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px; }
.total-label { font-weight: 600; font-size: 14px; }
.total-amount { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--red); }

/* Search bar */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 8px 14px;
}
.search-bar input { border: none; outline: none; font-family: var(--font); font-size: 14px; flex: 1; background: transparent; }

/* Page layout */
.page { min-height: calc(100vh - 56px); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-header { padding: 24px 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-title { font-size: 22px; font-weight: 900; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-400); padding: 12px 0; }
.breadcrumb span { cursor: pointer; transition: color .15s; }
.breadcrumb span:hover { color: var(--red); }
.breadcrumb span.current { color: var(--gray-900); font-weight: 500; cursor: default; }
.breadcrumb-sep { color: var(--gray-300); }

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--off-white); }
.login-card { width: 100%; max-width: 400px; padding: 40px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-text { font-size: 28px; font-weight: 900; color: var(--gray-900); }
.login-logo .logo-sub { font-size: 13px; color: var(--gray-400); margin-top: 4px; }
.login-title { font-size: 20px; font-weight: 900; margin-bottom: 24px; text-align: center; }

/* Admin tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; }
.tab {
  padding: 10px 16px; font-size: 14px; font-weight: 700;
  color: var(--gray-500); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s;
}
.tab:hover { color: var(--gray-900); }
.tab.active { color: var(--red); border-bottom-color: var(--red); }

/* Alert */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert-error { background: var(--red-light); color: var(--red); border: 1px solid #f5c0c5; }
.alert-success { background: #e8f8ec; color: #1a7b3a; border: 1px solid #b8e6c2; }
.alert-info { background: #e8f4fd; color: #1a5fa0; border: 1px solid #b8d9f5; }

/* Number display */
.offer-number { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--gray-500); }
.price-display { font-family: var(--mono); }

/* Drag handle */
.drag-handle { cursor: grab; color: var(--gray-300); font-size: 18px; padding: 0 4px; }
.drag-handle:active { cursor: grabbing; }
.dragging { opacity: .5; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--gray-300); border-radius: 22px; cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: white; left: 3px; top: 3px;
  transition: transform .2s;
}
.toggle input:checked + .toggle-slider { background: var(--red); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-red { color: var(--red); }
.text-muted { color: var(--gray-400); }
.text-right { text-align: right; }
.font-mono { font-family: var(--mono); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.spinner { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Admin image-upload overlay button (visible on card hover for admins) */
.admin-img-btn {
  position: absolute; bottom: 8px; right: 8px; z-index: 10;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: white;
  border: 2px solid rgba(255,255,255,.35);
  cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
  flex-shrink: 0;
}
.card-hover:hover .admin-img-btn { opacity: 1; }
.admin-img-btn:hover { background: var(--red) !important; opacity: 1 !important; border-color: white; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* Import preview */
.import-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.import-row.error { color: var(--red); background: var(--red-light); padding: 6px 8px; border-radius: 4px; }
.import-row.new { color: #1a7b3a; }
.import-row.update { color: #1a5fa0; }

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr 1fr; }
  .container { padding: 0 16px; }
}
