
:root {
  color-scheme: dark;
  --bg: #050814;
  --bg-soft: #0b1224;
  --card: rgba(12, 20, 40, .88);
  --card-strong: #101a32;
  --text: #f5f7ff;
  --muted: #9ba8c7;
  --line: rgba(255,255,255,.09);
  --accent: #4dff9c;
  --accent-2: #00b7ff;
  --danger: #ff5268;
  --warning: #ffb74d;
  --success: #45e38b;
  --shadow: 0 18px 55px rgba(0,0,0,.42);
  --theme-image: none;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3fb;
  --bg-soft: #dfe7f4;
  --card: rgba(255,255,255,.92);
  --card-strong: #ffffff;
  --text: #11182a;
  --muted: #65708a;
  --line: rgba(10,20,45,.10);
  --accent: #007a48;
  --accent-2: #006de5;
  --shadow: 0 18px 45px rgba(28,46,80,.16);
}

html[data-theme="bmw"] {
  --bg: #030712;
  --bg-soft: #071d3d;
  --card: rgba(5,18,38,.88);
  --card-strong: #081b39;
  --accent: #1c9bff;
  --accent-2: #734bff;
}

html[data-theme="audi"] {
  --bg: #090909;
  --bg-soft: #271013;
  --card: rgba(24,12,14,.90);
  --card-strong: #261216;
  --accent: #ff304f;
  --accent-2: #ff768b;
}

html[data-theme="amg"] {
  --bg: #020909;
  --bg-soft: #062421;
  --card: rgba(5,28,25,.90);
  --card-strong: #092c28;
  --accent: #22e5bf;
  --accent-2: #6dffe2;
}

html[data-theme="porsche"] {
  --bg: #0d0903;
  --bg-soft: #2d1f08;
  --card: rgba(35,24,8,.90);
  --card-strong: #35240b;
  --accent: #ffc857;
  --accent-2: #ff8c32;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
}

.background-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 15% 5%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 38%),
    radial-gradient(circle at 85% 20%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 40%),
    linear-gradient(rgba(0,0,0,.18), rgba(0,0,0,.68)),
    var(--theme-image),
    var(--bg);
  background-size: cover;
  background-position: center;
  transition: background .25s ease;
}

.background-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 35%, rgba(255,255,255,.035), transparent 65%),
    repeating-linear-gradient(90deg, transparent 0 80px, rgba(255,255,255,.018) 81px);
  pointer-events: none;
}

.app-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 12px calc(92px + env(safe-area-inset-bottom));
}

.loading-screen {
  min-height: 75vh;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
}

.loading-car {
  font-size: 58px;
  animation: drive 1.2s ease-in-out infinite alternate;
}

@keyframes drive {
  from { transform: translateX(-18px) rotate(-2deg); }
  to { transform: translateX(18px) rotate(2deg); }
}

.topbar {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07100c;
  font-size: 23px;
  box-shadow: 0 10px 25px color-mix(in srgb, var(--accent) 25%, transparent);
}

.brand-text {
  min-width: 0;
}

.brand-text strong,
.brand-text span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-text span {
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.small-button,
.primary-button,
.secondary-button,
.danger-button,
.price-button,
.theme-button,
.status-button {
  border: 0;
  border-radius: 13px;
  transition: transform .12s ease, opacity .12s ease, background .12s ease;
}

.icon-button:active,
.small-button:active,
.primary-button:active,
.secondary-button:active,
.danger-button:active,
.price-button:active,
.theme-button:active,
.status-button:active {
  transform: scale(.96);
}

.icon-button {
  min-width: 43px;
  height: 43px;
  padding: 0 12px;
  background: var(--card-strong);
  color: var(--text);
  border: 1px solid var(--line);
}

.cart-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  margin-left: 4px;
  border-radius: 999px;
  color: #07100c;
  background: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.announcement {
  margin: 13px 2px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: color-mix(in srgb, var(--accent) 11%, var(--card));
  font-size: 13px;
  text-align: center;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 250px;
  display: grid;
  align-items: end;
  margin-top: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(110deg, rgba(0,0,0,.78), rgba(0,0,0,.15)),
    var(--theme-image),
    linear-gradient(135deg, var(--bg-soft), var(--card-strong));
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
}

.hero::after {
  content: "🏎️";
  position: absolute;
  right: 8%;
  bottom: 16%;
  font-size: clamp(70px, 20vw, 170px);
  opacity: .28;
  filter: drop-shadow(0 18px 35px rgba(0,0,0,.5));
  transform: rotate(-4deg);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 620px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(31px, 8vw, 64px);
  line-height: .98;
  letter-spacing: -.045em;
}

.hero p {
  max-width: 520px;
  margin: 12px 0 18px;
  color: #d7def2;
  line-height: 1.55;
}

.hero-buttons,
.button-row,
.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.primary-button,
.secondary-button,
.danger-button,
.small-button {
  padding: 11px 15px;
  font-weight: 800;
}

.primary-button {
  color: #07100c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.secondary-button,
.small-button {
  color: var(--text);
  background: var(--card-strong);
  border: 1px solid var(--line);
}

.danger-button {
  color: white;
  background: var(--danger);
}

.section {
  margin-top: 22px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
}

.category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 3px 1px 9px;
  scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.category-chip {
  white-space: nowrap;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--card);
}

.category-chip.active {
  color: #07100c;
  border-color: transparent;
  background: var(--accent);
  font-weight: 900;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 13px;
}

.product-card,
.panel,
.order-card,
.cart-card,
.admin-item {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  backdrop-filter: blur(14px);
  box-shadow: 0 13px 35px rgba(0,0,0,.18);
}

.product-card {
  overflow: hidden;
}

.media-strip {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  background: #02050c;
  scrollbar-width: none;
}

.media-strip::-webkit-scrollbar {
  display: none;
}

.product-media {
  width: 100%;
  min-width: 100%;
  aspect-ratio: 16 / 11;
  object-fit: cover;
  scroll-snap-align: start;
}

.product-placeholder {
  width: 100%;
  aspect-ratio: 16 / 11;
  display: grid;
  place-items: center;
  font-size: 56px;
  background: linear-gradient(135deg, var(--bg-soft), var(--card-strong));
}

.product-body {
  padding: 14px;
}

.product-topline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.product-body h3 {
  margin: 0;
  font-size: 19px;
}

.product-description {
  margin: 8px 0 12px;
  min-height: 38px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.badge,
.availability,
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.badge {
  color: #07100c;
  background: var(--accent);
}

.availability.available {
  color: #062313;
  background: var(--success);
}

.availability.unavailable {
  color: white;
  background: var(--danger);
}

.price-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.price-button {
  min-height: 47px;
  padding: 9px;
  color: var(--text);
  background: var(--card-strong);
  border: 1px solid var(--line);
  font-weight: 900;
}

.price-button span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.price-button:not(:disabled):hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--card-strong));
}

.price-button:disabled {
  cursor: not-allowed;
  opacity: .4;
}

.panel {
  padding: 15px;
}

.empty-state {
  padding: 35px 18px;
  text-align: center;
  color: var(--muted);
}

.cart-list,
.order-list,
.admin-list {
  display: grid;
  gap: 10px;
}

.cart-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
}

.cart-thumb {
  width: 72px;
  height: 72px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--bg-soft);
}

.cart-thumb img,
.cart-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-info strong {
  display: block;
}

.cart-info span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.cart-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}

.quantity-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--card-strong);
}

.cart-total {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.total-line {
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

.total-line.grand {
  font-size: 20px;
  font-weight: 950;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  padding: 12px;
  color: var(--text);
  background: var(--card-strong);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 0;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.order-card {
  padding: 14px;
}

.order-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.order-items {
  margin: 10px 0;
  padding: 10px;
  border-radius: 13px;
  background: var(--card-strong);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.status-badge {
  color: var(--text);
  background: var(--card-strong);
  border: 1px solid var(--line);
}

.status-badge.confirmed,
.status-badge.delivered {
  color: #062313;
  background: var(--success);
}

.status-badge.cancelled {
  color: white;
  background: var(--danger);
}

.status-badge.preparing,
.status-badge.on_the_way {
  color: #2a1800;
  background: var(--warning);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.theme-button {
  min-height: 76px;
  padding: 10px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--card-strong);
  font-weight: 900;
}

.theme-button.active {
  color: #07100c;
  border-color: transparent;
  background: var(--accent);
}

.social-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.social-link {
  display: block;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--card-strong);
  text-decoration: none;
  text-align: center;
  font-weight: 850;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.admin-tab {
  white-space: nowrap;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--card-strong);
}

.admin-tab.active {
  color: #07100c;
  background: var(--accent);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, .85fr) minmax(320px, 1.15fr);
  gap: 13px;
}

.admin-item {
  padding: 12px;
}

.admin-item h4 {
  margin: 0 0 5px;
}

.admin-item p {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 12px;
}

.admin-item .button-row {
  margin-top: 9px;
}

.status-button {
  padding: 8px 10px;
  color: var(--text);
  background: var(--card-strong);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.status-button[data-status="confirmed"],
.status-button[data-status="delivered"] {
  border-color: var(--success);
}

.status-button[data-status="cancelled"] {
  border-color: var(--danger);
}

.upload-progress {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(9px, env(safe-area-inset-bottom));
  z-index: 50;
  width: min(calc(100% - 18px), 720px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.nav-button {
  min-width: 0;
  padding: 8px 3px;
  border: 0;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}

.nav-button b {
  display: block;
  margin-bottom: 2px;
  font-size: 20px;
}

.nav-button.active {
  color: #07100c;
  background: var(--accent);
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  top: max(16px, env(safe-area-inset-top));
  z-index: 100;
  max-width: calc(100% - 30px);
  transform: translate(-50%, -130%);
  padding: 11px 16px;
  border-radius: 14px;
  background: var(--card-strong);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform .22s ease;
  text-align: center;
  font-weight: 800;
}

.toast.show {
  transform: translate(-50%, 0);
}

.error-box {
  padding: 18px;
  border-radius: 18px;
  color: white;
  background: rgba(170,25,45,.88);
}

@media (max-width: 760px) {
  .admin-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .field.full {
    grid-column: auto;
  }

  .theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    min-height: 225px;
    padding: 20px;
  }

  .hero::after {
    right: -8px;
    bottom: 22%;
  }
}

@media (max-width: 430px) {
  .brand-text span {
    display: none;
  }

  .price-buttons {
    grid-template-columns: 1fr 1fr;
  }

  .social-grid {
    grid-template-columns: 1fr 1fr;
  }

  .nav-button {
    font-size: 9px;
  }

  .nav-button b {
    font-size: 18px;
  }
}
