/* --- 1. VARIABLES (Theme System) --- */

/* DEFAULT = DARK THEME */
:root {
  --primary: #e82127;
  --primary-gradient: linear-gradient(135deg, #e82127 0%, #ff4b5c 100%);

  --bg-base: #0a0e17;

  --bg-radial-1: radial-gradient(at 10% 10%, rgba(232, 33, 39, 0.12) 0px, transparent 50%);
  --bg-radial-2: radial-gradient(at 90% 0%, rgba(43, 50, 178, 0.12) 0px, transparent 50%);
  --bg-radial-3: radial-gradient(at 50% 100%, rgba(255, 255, 255, 0.03) 0px, transparent 50%);

  --text-main: #ffffff;
  --text-muted: #94a3b8;
  --heading-color: #ffffff;

  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.1);
  --blur-strength: blur(20px);

  --input-bg: rgba(0, 0, 0, 0.3);
  --input-bg-focus: rgba(0, 0, 0, 0.5);
  --input-border: rgba(255, 255, 255, 0.15);
  --input-text: #ffffff;
  --input-placeholder: rgba(148, 163, 184, 0.8);
  --focus-ring: 0 0 0 3px rgba(232, 33, 39, 0.2);

  --tags-wrap-bg: rgba(0,0,0,0.2);

  --tag-bg: rgba(255, 255, 255, 0.05);
  --tag-border: rgba(255, 255, 255, 0.1);
  --tag-text: #cbd5e1;
  --tag-hover-bg: rgba(255, 255, 255, 0.1);
  --tag-hover-border: rgba(255, 255, 255, 0.3);

  --header-bg: rgba(10, 14, 23, 0.85);
  --header-border: rgba(255,255,255,0.1);

  --nav-link: var(--text-muted);
  --nav-link-active: #ffffff;
  --nav-link-glow: 0 0 10px rgba(255,255,255,0.3);

  --mobile-bar-bg: #0f172a;
  --mobile-bar-border: rgba(255,255,255,0.1);
  --mobile-nav-text: #94a3b8;
  --mobile-nav-active: #ef4444;

  --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(232, 33, 39, 0.15);
  --shadow-btn: 0 4px 15px rgba(232, 33, 39, 0.3);
  --shadow-btn-hover: 0 6px 20px rgba(232, 33, 39, 0.5);

  --radius-card: 24px;
  --radius-btn: 50px;

  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* LIGHT THEME (Tesla-like) */
html[data-theme="light"] {
  --primary: #e82127;
  --primary-gradient: linear-gradient(135deg, #e82127 0%, #ff4b5c 100%);

  --bg-base: #f3f4f6;

  --bg-radial-1: radial-gradient(at 10% 10%, rgba(232, 33, 39, 0.08) 0px, transparent 55%);
  --bg-radial-2: radial-gradient(at 90% 0%, rgba(0, 0, 0, 0.06) 0px, transparent 55%);
  --bg-radial-3: radial-gradient(at 50% 100%, rgba(0, 0, 0, 0.05) 0px, transparent 60%);

  --text-main: #0b1220;
  --text-muted: #475569;
  --heading-color: #0b1220;

  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: rgba(2, 6, 23, 0.16);
  --blur-strength: blur(10px);

  --input-bg: rgba(255, 255, 255, 0.97);
  --input-bg-focus: rgba(255, 255, 255, 1);
  --input-border: rgba(2, 6, 23, 0.18);
  --input-text: #0b1220;
  --input-placeholder: rgba(71, 85, 105, 0.85);
  --focus-ring: 0 0 0 3px rgba(232, 33, 39, 0.22);

  --tags-wrap-bg: rgba(2, 6, 23, 0.06);

  --tag-bg: rgba(255, 255, 255, 0.9);
  --tag-border: rgba(2, 6, 23, 0.16);
  --tag-text: #0b1220;
  --tag-hover-bg: rgba(255, 255, 255, 1);
  --tag-hover-border: rgba(2, 6, 23, 0.24);

  --header-bg: rgba(255, 255, 255, 0.92);
  --header-border: rgba(2, 6, 23, 0.12);

  --nav-link: #334155;
  --nav-link-active: #0b1220;
  --nav-link-glow: 0 0 0 rgba(0,0,0,0);

  --mobile-bar-bg: rgba(255, 255, 255, 0.92);
  --mobile-bar-border: rgba(2, 6, 23, 0.12);
  --mobile-nav-text: #475569;
  --mobile-nav-active: #e82127;

  --shadow-soft: 0 20px 50px -28px rgba(2, 6, 23, 0.38);
  --shadow-glow: 0 0 0 rgba(0,0,0,0);
  --shadow-btn: 0 12px 28px -16px rgba(232, 33, 39, 0.45);
  --shadow-btn-hover: 0 16px 34px -18px rgba(232, 33, 39, 0.55);
}

/* --- 2. GLOBAL RESET & BACKGROUND --- */
* { box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  padding-bottom: 0;

  background-color: var(--bg-base);
  background-image: var(--bg-radial-1), var(--bg-radial-2), var(--bg-radial-3);
  background-attachment: fixed;
  background-size: cover;
}

h1, h2, h3, h4 {
  font-family: 'Orbitron', sans-serif;
  margin-top: 0;
  color: var(--heading-color);
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
img { display: block; max-width: 100%; border-radius: 12px; }

/* --- 3. UI COMPONENTS --- */
.btn-tesla {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  background: var(--primary-gradient);
  color: #ffffff;
  border-radius: var(--radius-btn);
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: transform 0.2s, box-shadow 0.2s;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn-tesla:hover { transform: translateY(-2px); box-shadow: var(--shadow-btn-hover); }
.btn-tesla:active { transform: scale(0.96); }

input, select, textarea {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  font-size: 1rem;
  color: var(--input-text);
  transition: 0.3s;
  font-family: 'Inter', sans-serif;
}
input::placeholder, textarea::placeholder { color: var(--input-placeholder); }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  background: var(--input-bg-focus);
  box-shadow: var(--focus-ring);
}
label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 15px;
}

/* --- 4. GLASS CARDS --- */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

.card {
  background: var(--card-bg);
  backdrop-filter: var(--blur-strength);
  -webkit-backdrop-filter: var(--blur-strength);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

/* --- 5. ADMIN TAG BUTTONS --- */
.tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  background: var(--tags-wrap-bg);
  padding: 15px;
  border-radius: 12px;
}
.tag-input { display: none; }

.tag-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 10px;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--tag-text);
  font-size: 0.9rem;
  user-select: none;
  min-height: 50px;
  line-height: 1.3;
}
.tag-btn:hover { background: var(--tag-hover-bg); border-color: var(--tag-hover-border); }
.tag-input:checked + .tag-btn {
  background: var(--primary-gradient);
  color: #ffffff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: var(--shadow-btn);
  transform: translateY(-2px);
}

/* --- 6. DESKTOP HEADER --- */
header {
  background: var(--header-bg);
  backdrop-filter: blur(15px);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--header-border);
}
.logo { font-size: 1.5rem; font-weight: 800; color: var(--heading-color); }
.logo span { color: var(--primary); }

.desktop-nav a {
  margin-left: 25px;
  font-weight: 500;
  color: var(--nav-link);
  transition: 0.3s;
  font-size: 0.95rem;
}
.desktop-nav a:hover,
.desktop-nav a.active {
  color: var(--nav-link-active);
  text-shadow: var(--nav-link-glow);
}

/* --- 7. LAYOUT & SIDEBAR --- */
.catalog-layout { display: flex; gap: 30px; align-items: flex-start; }

.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--card-bg);
  padding: 25px;
  border-radius: var(--radius-card);
  border: 1px solid var(--card-border);
  position: sticky;
  top: 100px;
}
.sidebar h3 {
  font-size: 1rem;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--header-border);
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.badge {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.reveal { animation: fadeInUp 0.6s ease-out forwards; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- 8. MOBILE OPTIMIZATIONS --- */
.mobile-scroll-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

/* Hidden on desktop */
.bottom-nav { display: none; }
.mobile-top-bar { display: none; }

/* --- MOBILE (<768px) --- */
@media (max-width: 768px) {

  header { display: none !important; }
  .desktop-nav { display: none; }

  .mobile-top-bar {
    display: block;
    padding: 15px;
    text-align: center;
    background: var(--mobile-bar-bg);
    font-family: 'Orbitron';
    color: var(--heading-color);
    font-size: 1.2rem;
    border-bottom: 1px solid var(--mobile-bar-border);
  }

  /* space for floating dock */
  body { padding-bottom: 120px !important; }

  .container { padding: 15px; }
  .catalog-layout { flex-direction: column; }
  .sidebar { width: 100%; position: relative; top: 0; margin-bottom: 20px; }
  .tags-grid { grid-template-columns: repeat(2, 1fr); }

  .mobile-scroll-container {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 15px;
    padding-bottom: 10px;
    scrollbar-width: none;
  }
  .mobile-scroll-container::-webkit-scrollbar { display: none; }

  .mobile-scroll-container > div,
  .mobile-scroll-container > a,
  .product-card {
    min-width: 85%;
    scroll-snap-align: center;
    flex-shrink: 0;
  }

  .ad-row-scroll {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    scroll-snap-type: x mandatory;
  }
  .ad-row-scroll .ts-ad-container {
    min-width: 90%;
    scroll-snap-align: center;
  }

  /* ✅ WhatsApp-like floating dock */
  .bottom-nav{
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;

    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    bottom: 10px !important;
    width: auto !important;
    height: 74px !important;

    padding: 10px 12px !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;

    border-radius: 28px !important;
    background: rgba(15, 23, 42, 0.72) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;

    box-shadow: 0 18px 40px rgba(0,0,0,0.55) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;

    z-index: 99999 !important;
    box-sizing: border-box !important;
  }

  html[data-theme="light"] .bottom-nav{
    background: rgba(255,255,255,0.86) !important;
    border: 1px solid rgba(2,6,23,0.14) !important;
    box-shadow: 0 18px 40px rgba(2,6,23,0.20) !important;
  }

  .bottom-nav .nav-item{
    flex: 1 !important;
    min-width: 0 !important;

    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;

    gap: 6px !important;
    padding: 8px 6px !important;
    border-radius: 18px !important;

    text-decoration: none !important;
    color: rgba(148,163,184,0.95) !important;

    transition: transform .14s ease, color .14s ease, background .14s ease !important;
    user-select: none !important;
  }

  html[data-theme="light"] .bottom-nav .nav-item{
    color: rgba(51,65,85,0.95) !important;
  }

  .bottom-nav button.nav-item{
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    font: inherit !important;
  }

  /* ensure icons + labels inherit properly */
  .bottom-nav .nav-item svg{ width: 24px !important; height: 24px !important; fill: currentColor !important; }
  .bottom-nav .nav-toggle svg{ fill: none !important; stroke: currentColor !important; }

  .nav-label, .nav-text{
    font-size: 10px !important;
    line-height: 1 !important;
    opacity: .95 !important;
    white-space: nowrap !important;
    color: inherit !important;
  }

  .bottom-nav .nav-item.active{
    color: #ffffff !important;
    background: rgba(255,255,255,0.12) !important;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset !important;
  }

  html[data-theme="light"] .bottom-nav .nav-item.active{
    color: #0b1220 !important;
    background: rgba(2,6,23,0.06) !important;
    box-shadow: 0 0 0 1px rgba(2,6,23,0.10) inset !important;
  }

  .bottom-nav .nav-item.active::after{
    content:"" !important;
    width: 28px !important;
    height: 3px !important;
    border-radius: 999px !important;
    background: var(--primary) !important;
    box-shadow: 0 0 14px rgba(232,33,39,0.55) !important;
    margin-top: 2px !important;
  }

  .bottom-nav .nav-item:active{
    transform: scale(0.96) !important;
    color: var(--primary) !important;
  }
}

/* --------------------------------------------------------- */
/* ✅ FINAL FIX: LIGHT THEME TEXT CONTRAST INSIDE ALL BOXES   */
/* --------------------------------------------------------- */
/* ამ ბლოკმა უნდა ჩაახშოს ნებისმიერი "ღია" ფერი/opacity, რაც ტექსტს აქრობს */

html[data-theme="light"] .card,
html[data-theme="light"] .sidebar,
html[data-theme="light"] .tags-grid,
html[data-theme="light"] .ts-ad-container,
html[data-theme="light"] .product-card,
html[data-theme="light"] .service-card,
html[data-theme="light"] .charger-card,
html[data-theme="light"] .box,
html[data-theme="light"] .panel,
html[data-theme="light"] .item,
html[data-theme="light"] .listing,
html[data-theme="light"] .tile {
  color: #0b1220 !important;
}

/* ALL text inside those containers becomes readable */
html[data-theme="light"] .card *,
html[data-theme="light"] .sidebar *,
html[data-theme="light"] .tags-grid *,
html[data-theme="light"] .ts-ad-container *,
html[data-theme="light"] .product-card *,
html[data-theme="light"] .service-card *,
html[data-theme="light"] .charger-card *,
html[data-theme="light"] .box *,
html[data-theme="light"] .panel *,
html[data-theme="light"] .item *,
html[data-theme="light"] .listing *,
html[data-theme="light"] .tile * {
  color: #0b1220 !important;
  opacity: 1 !important;
}

/* Muted text still readable */
html[data-theme="light"] .muted,
html[data-theme="light"] .text-muted,
html[data-theme="light"] small,
html[data-theme="light"] .meta,
html[data-theme="light"] .sub,
html[data-theme="light"] .subtitle,
html[data-theme="light"] .secondary,
html[data-theme="light"] .hint {
  color: #334155 !important;
  opacity: 1 !important;
}

/* Icons inherit too */
html[data-theme="light"] svg {
  stroke: currentColor;
}

/* --------------------------------------------------
   Mobile fix: Product detail description must not
   overflow viewport (long URLs/part numbers, etc.)
   Scope: product detail only
--------------------------------------------------- */
.product-detail-wrapper .description-content {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.product-detail-wrapper .description-content img,
.product-detail-wrapper .description-content video,
.product-detail-wrapper .description-content iframe,
.product-detail-wrapper .description-content table {
  max-width: 100%;
}

.product-detail-wrapper .description-content pre,
.product-detail-wrapper .description-content code {
  white-space: pre-wrap;
  word-break: break-word;
}
