/* =========================================================
   CODEMART / CodeNexa — main.css
   Dark purple digital store theme
   ========================================================= */

:root {
  --bg: #07061a;
  --bg2: #0d0b24;
  --card: #12102a;
  --card2: #1a1735;
  --border: #2a2650;
  --primary: #8b5cf6;
  --primary2: #a78bfa;
  --primary-dark: #7c3aed;
  --glow: rgba(139, 92, 246, 0.35);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #eab308;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --nav-h: 58px;
  --bottom-nav-h: 72px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  padding-bottom: var(--bottom-nav-h);
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 900px) {
  body {
    padding-bottom: 0;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

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

ul,
ol {
  list-style: none;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

.container-sm {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 700;
}

.text-muted { color: var(--muted); }
.text-primary { color: var(--primary2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: 0.2s ease;
  text-decoration: none;
  line-height: 1.2;
}

.btn i,
.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 8px 24px var(--glow);
}

.btn-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.08);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 0.8rem;
  border-radius: 10px;
}

.btn-sm i {
  width: 14px;
  height: 14px;
}

.btn-block {
  width: 100%;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  background: #0f0d18;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

input:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

input::placeholder,
textarea::placeholder {
  color: #64748b;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  margin-bottom: 14px;
  line-height: 1.45;
}

.alert-success,
.alert-ok {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.alert-error,
.alert-err {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-warning,
.alert-warn {
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.3);
  color: #fde047;
}

/* ---------- Trust bar (desktop) ---------- */
.trust-bar {
  display: none;
  background: linear-gradient(90deg, #0b0618, #1a0b3a 45%, #0b0618);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  padding: 8px 0;
}

.trust-bar .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.trust-bar .brand-title {
  color: var(--text);
  font-weight: 600;
}

.trust-items {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.trust-items span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trust-items i {
  width: 14px;
  height: 14px;
  color: var(--primary2);
}

@media (min-width: 900px) {
  .trust-bar {
    display: block;
  }
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(7, 6, 26, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.navbar .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  gap: 10px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.logo img {
  height: 30px;
  width: auto;
}

.logo .brand span {
  color: var(--primary2);
}

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

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.15s;
}

.icon-btn:hover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.1);
}

.icon-btn i {
  width: 18px;
  height: 18px;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--card);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-wrap {
  position: relative;
}

.profile-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 48px;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow);
  z-index: 50;
}

.profile-menu.open {
  display: block;
}

.profile-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.profile-menu a:hover {
  background: rgba(139, 92, 246, 0.12);
}

.profile-menu i {
  width: 16px;
  height: 16px;
  color: var(--primary2);
}

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(12, 10, 28, 0.97);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.68rem;
  color: var(--muted);
  min-width: 56px;
  padding: 4px;
}

.bottom-nav a.active {
  color: var(--primary2);
}

.bottom-nav a i {
  width: 20px;
  height: 20px;
}

@media (min-width: 900px) {
  .bottom-nav {
    display: none;
  }
}

/* ---------- Hero Slider ---------- */
.hero-slider {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  margin: 16px 0 28px;
  border: 1px solid var(--border);
  background: #0f0a28;
  width: 100%;
}

.slides {
  position: relative;
  width: 100%;
}

.slide {
  display: none;
  position: relative;
  width: 100%;
  height: 220px;
  background: #0f0a28;
}

.slide.active {
  display: block;
}

.slide-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.slide-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  background: linear-gradient(
    100deg,
    rgba(7, 6, 26, 0.92) 0%,
    rgba(7, 6, 26, 0.55) 45%,
    rgba(7, 6, 26, 0.25) 100%
  );
  padding: 20px 18px;
}

.slide-content {
  max-width: 480px;
  position: relative;
  z-index: 3;
}

.slide-content h1,
.slide-content h2 {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 8px;
}

.slide-content p {
  color: var(--muted);
  margin-bottom: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-badges {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.hero-badges span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
}

.hero-badges i {
  width: 13px;
  height: 13px;
  color: var(--primary2);
}

.slider-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
  z-index: 5;
}

.slider-dots button {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  padding: 0;
  transition: 0.2s;
}

.slider-dots button.active {
  background: var(--primary);
  width: 18px;
  border-radius: 4px;
}

.slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.slider-nav.prev { left: 10px; }
.slider-nav.next { right: 10px; }
.slider-nav i { width: 18px; height: 18px; }

@media (min-width: 640px) {
  .slide { height: 300px; }
  .slide-content h1,
  .slide-content h2 { font-size: 1.55rem; }
  .slide-content p {
    font-size: 0.95rem;
    -webkit-line-clamp: 3;
  }
  .slide-overlay { padding: 28px; }
  .hero-badges { display: flex; }
  .slider-nav { display: flex; }
}

@media (min-width: 900px) {
  .slide { height: 380px; }
  .slide-content { max-width: 520px; }
  .slide-content h1,
  .slide-content h2 { font-size: 2rem; }
  .slide-content p {
    font-size: 1.05rem;
    margin-bottom: 18px;
  }
  .slide-overlay { padding: 40px 36px; }
}

@media (min-width: 1200px) {
  .slide { height: 420px; }
}

/* ---------- Sections ---------- */
.section {
  margin-bottom: 36px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}

.section-head h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.section-head a {
  color: var(--primary2);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.section-head a i {
  width: 16px;
  height: 16px;
}

/* ---------- Product grid ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 700px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

@media (min-width: 1000px) {
  .product-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
  }
}

/* ---------- Product card ---------- */
.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: 0.2s ease;
}

.product-card:hover {
  border-color: rgba(139, 92, 246, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.product-card .thumb-wrap {
  aspect-ratio: 1 / 1;
  background: #0f0a22;
  position: relative;
  overflow: hidden;
}

.product-card .thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.9);
  color: #fff;
}

.product-card .body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.product-card .title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}

.product-card .price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.product-card .price {
  font-weight: 700;
  color: var(--primary2);
  font-size: 0.95rem;
}

.product-card .old {
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: line-through;
}

.product-card .actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
}

.product-card .actions form {
  margin: 0;
}

.product-card .actions .btn {
  width: 100%;
}

/* ---------- Chips / filters ---------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  transition: 0.15s;
}

.chip:hover {
  border-color: var(--primary);
}

.chip.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--primary);
  color: var(--primary2);
  font-weight: 600;
}

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.search-bar input {
  flex: 1;
  border-radius: 12px;
}

.search-bar button {
  padding: 0 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-bar button i {
  width: 18px;
  height: 18px;
}

/* ---------- Empty state ---------- */
.empty,
.empty-box {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 16px;
}

.empty i,
.empty-box i {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  opacity: 0.45;
  display: block;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 24px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer .inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}

.site-footer a:hover {
  color: var(--primary2);
}

@media (max-width: 899px) {
  .site-footer {
    margin-bottom: 8px;
  }
}

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }