:root {
  --bg: #eaeded;
  --panel: #ffffff;
  --text: #0f1111;
  --muted: #565959;
  --border: #d5d9d9;
  --header: #131921;
  --header-2: #232f3e;
  --accent: #ffd814;
  --accent-hover: #f7ca00;
  --accent-text: #0f1111;
  --link: #007185;
  --link-hover: #c7511f;
  --shadow: 0 2px 8px rgba(15, 17, 17, 0.12);
}

[data-theme="dark"] {
  --bg: #11151d;
  --panel: #1a1f2b;
  --text: #f1f3f5;
  --muted: #c7ccd6;
  --border: #31394c;
  --header: #0b0f16;
  --header-2: #162030;
  --accent: #ffca1f;
  --accent-hover: #f3b700;
  --accent-text: #111;
  --link: #79d7ff;
  --link-hover: #ffb26b;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  transition: background .25s ease, color .25s ease;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

.header-wrap {
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.site-header {
  background: var(--header);
  color: #fff;
  display: grid;
  grid-template-columns: 170px 1fr auto;
  gap: .9rem;
  align-items: center;
  padding: .65rem 1rem;
}
.logo {
  color: #fff;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: .2px;
}
.logo:hover { color: #fff; text-decoration: none; }

.header-search {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
}
.header-search input {
  border: none;
  border-radius: 9px 0 0 9px;
  padding: .74rem .8rem;
  outline: none;
}
.search-btn {
  border: none;
  background: #febd69;
  color: #111;
  font-weight: 700;
  padding: .74rem 1rem;
  border-radius: 0 9px 9px 0;
  cursor: pointer;
}
.search-btn:hover { background: #f3a847; }

.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem;
}
.main-nav a {
  color: #fff;
  font-size: .88rem;
  padding: .42rem .56rem;
  border-radius: 4px;
  border: 1px solid transparent;
}
.main-nav a:hover {
  color: #fff;
  text-decoration: none;
  border-color: #fff;
}

.sub-nav {
  display: flex;
  align-items: center;
  gap: .85rem;
  background: var(--header-2);
  padding: .48rem 1rem;
}
.sub-nav a {
  color: #fff;
  font-size: .9rem;
}
.sub-nav a:hover { color: #fff; text-decoration: underline; }
.currency-picker {
  color: #fff;
  font-size: .9rem;
  opacity: .85;
}
.currency-select {
  min-width: 92px;
  border-radius: 7px;
  border: 1px solid #8a96a8;
  padding: .34rem .46rem;
  background: #fff;
  color: #0f1111;
}
.theme-btn {
  margin-left: .35rem;
  min-height: 2rem;
  padding: .38rem .75rem;
}

.container { max-width: 1300px; margin: 0 auto; padding: 1rem; }
.hero, .panel, .card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: var(--shadow);
}
.hero h1 { margin-top: 0; }
.panel { display: grid; gap: .65rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
.cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(15, 17, 17, .18); }
.card img, .product img { width: 100%; border-radius: 8px; display: block; }

.product {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: start;
}
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.product-main {
  display: grid;
  gap: .65rem;
  align-content: start;
}
.product-actions {
  margin-top: .35rem;
}
.qty-control {
  display: inline-grid;
  grid-template-columns: 34px 72px 34px;
  align-items: center;
}
.qty-control input {
  text-align: center;
  border-radius: 0;
  border-left: none;
  border-right: none;
}
.qty-btn {
  background: #f0f2f2;
  border: 1px solid #adb1b8;
  cursor: pointer;
  font-weight: 700;
}
.qty-btn:first-child { border-radius: 8px 0 0 8px; }
.qty-btn:last-child { border-radius: 0 8px 8px 0; }
.review-form {
  display: grid;
  grid-template-columns: 120px minmax(220px, 1fr) auto;
  gap: .55rem;
  align-items: end;
}
.review-form textarea { min-height: 82px; }

input, select, textarea, button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .68rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.2rem;
  padding: .56rem .98rem;
  border-radius: 999px;
  border: 1px solid #fcd200;
  background: var(--accent);
  color: var(--accent-text);
  font-size: .93rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(15,17,17,.1);
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.btn:hover {
  background: var(--accent-hover);
  border-color: #f2c200;
  color: var(--accent-text);
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn.ghost {
  border-color: #adb1b8;
  background: linear-gradient(180deg, #f7f8fa, #e7e9ec);
  color: #0f1111;
}
.btn.ghost:hover { background: linear-gradient(180deg, #f0f2f5, #dde1e6); }
[data-theme="dark"] .btn.ghost {
  background: #262f42;
  border-color: #475472;
  color: #eaf0ff;
}
[data-theme="dark"] .btn.ghost:hover { background: #2d3850; }
.btn.danger {
  border-color: #d93a3a;
  background: #f25555;
  color: #fff;
}

.toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: min(360px, calc(100vw - 1.2rem));
  display: grid;
  gap: .5rem;
  z-index: 110;
}
.toast {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid #4d8ce8;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: .65rem .7rem;
}
.toast.success { border-left-color: #2dbf7c; }
.toast.warning { border-left-color: #f0ad2f; }
.toast.danger { border-left-color: #df4949; }
.toast.info { border-left-color: #4d8ce8; }
.toast-close {
  border-radius: 999px;
  width: 1.3rem;
  height: 1.3rem;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 1020px) {
  .site-header {
    grid-template-columns: 1fr;
  }
  .main-nav { justify-content: flex-start; }
  .sub-nav { flex-wrap: wrap; }
  .theme-btn { margin-left: 0; }
}
@media (max-width: 760px) {
  .container { padding: .7rem; }
  .product { grid-template-columns: 1fr; }
  .review-form { grid-template-columns: 1fr; }
  .toasts { right: .6rem; left: .6rem; width: auto; }
}
