/**
 * takeKONTROL — Shop Mobile UX
 * ============================================================
 * Amazon/Zalando-style mobile experience:
 * - Full-width product cards stacked vertically
 * - Large tap targets (min 48px)
 * - Sticky add-to-cart bar that appears when scrolling past the product
 * - Swipeable image carousel with touch feel
 * - Bottom-sheet for product details (items list)
 * - Prominent price and CTA above the fold on mobile
 * - Category pills for quick navigation
 * - Trust signals always visible
 * ============================================================
 */

/* ── Mobile-first base ─────────────────────────────────────── */
@media (max-width: 768px) {

  /* Container padding tighter on mobile */
  .container { padding: 0 12px; }

  /* ── Hero ─────────────────────────────────────────────────── */
  .hero {
    height: 70vh;
    min-height: 480px;
  }

  .hero-content {
    text-align: center;
    padding: 0 20px;
  }

  .hero-content h1 {
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 12px;
  }

  .hero-content p {
    font-size: 1rem;
    margin-bottom: 20px;
  }

  .hero-content .btn {
    width: 100%;
    max-width: 320px;
    padding: 16px 24px;
    font-size: 1rem;
  }

  /* ── Sticky category pills ────────────────────────────────── */
  .category-pills {
    position: sticky;
    top: 60px;
    z-index: 100;
    background: var(--primary-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -12px;
  }

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

  .category-pill {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
  }

  .category-pill.active,
  .category-pill:active {
    background: var(--primary-red);
    color: #fff;
    border-color: var(--primary-red);
  }

  /* ── Scenario cards — fixed 2-column grid on mobile ──────── */
  .scenario-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 24px 0;
    overflow: visible;
  }

  .scenario-card {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
  }

  .scenario-card h3 { font-size: 0.95rem; }
  .scenario-card p { font-size: 0.8rem; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .scenario-card .icon-wrapper { width: 40px; height: 40px; margin-bottom: 10px; }

  /* ── Section headings ────────────────────────────────────── */
  .section-title {
    font-size: 1.5rem;
    margin-bottom: 6px;
  }

  .section-subtitle {
    font-size: 0.9rem;
    margin-bottom: 20px;
  }

  /* ── Home Kit (shelf card) — full width on mobile ─────────── */
  .shelf-card {
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
  }

  .shelf-card .product-image-container {
    max-width: 100%;
    width: 100%;
    border-radius: 16px 16px 0 0;
  }

  .shelf-card .shelf-info {
    padding: 20px;
  }

  .shelf-card .shelf-info h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
  }

  .shelf-card .shelf-info .price {
    font-size: 1.8rem;
    margin-bottom: 4px;
  }

  .shelf-card .shelf-info .actions {
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 16px;
  }

  .shelf-card .shelf-info .actions .btn {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    border-radius: 50px;
    text-align: center;
  }

  /* ── Product grid — single column on mobile ───────────────── */
  .product-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* ── Product card — vertical stack on mobile (no row layout) ─ */
  .product-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
  }

  .product-card .product-image-container {
    width: 100%;
    height: 260px;
    border-radius: 0;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    display: block;
  }

  /* Force carousel to fill the container correctly */
  .product-card .product-image-container .carousel-track {
    display: flex;
    height: 260px;
    width: 100%;
  }

  .product-card .product-image-container .carousel-slide {
    min-width: 100%;
    width: 100%;
    height: 260px;
    object-fit: cover;
    object-position: center top;
    display: block;
    flex-shrink: 0;
  }

  /* Show carousel buttons on mobile too */
  .product-card .carousel-btn {
    display: flex;
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .product-card .carousel-dots {
    display: flex;
  }

  /* Badge sits below image, inline */
  .product-card .product-badge {
    font-size: 0.68rem;
    padding: 4px 10px;
    margin: 12px 12px 0;
  }

  .product-card h3 {
    font-size: 1.1rem;
    padding: 6px 12px 0;
    margin-bottom: 4px;
  }

  .product-card .product-quote {
    font-size: 0.9rem;
    padding: 0 12px;
    margin-bottom: 8px;
  }

  .product-card .description {
    font-size: 0.85rem;
    padding: 0 12px;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Ideal-for box and coverage bar sit inside the padded body too —
     product-card-bottom only wraps price/CTA, everything above it
     needs its own horizontal padding on mobile since the card itself
     has none (the image bleeds edge-to-edge). */
  .product-card .ideal-for-box {
    margin: 12px 12px 14px;
    padding: 14px 16px;
  }

  .product-card .category-progress {
    margin: 0 12px 14px;
  }

  .product-card-bottom {
    padding: 0 12px 16px;
  }

  .product-card .price {
    font-size: 1.4rem;
    margin-top: 4px;
  }

  .product-card .price-note {
    margin-bottom: 12px;
  }

  .product-card .view-content-link {
    width: 100%;
    justify-content: center;
    padding: 13px 14px;
    border-radius: 50px;
    background: var(--secondary-bg);
    text-decoration: none;
  }

  /* Safety disclaimer compact */
  .safety-disclaimer {
    font-size: 0.75rem;
    margin-top: 10px;
    padding: 6px 8px;
  }

  /* ── Sticky add-to-cart bar ──────────────────────────────── */
  .sticky-cart-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .sticky-cart-bar.visible {
    transform: translateY(0);
  }

  .sticky-cart-bar .sticky-product-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sticky-cart-bar .sticky-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-red);
    flex-shrink: 0;
  }

  .sticky-cart-bar .btn {
    flex-shrink: 0;
    padding: 12px 20px;
    font-size: 0.9rem;
    border-radius: 50px;
    white-space: nowrap;
  }

  /* ── Level selector cards — single column ────────────────── */
  .level-selector {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .level-card {
    padding: 16px;
  }

  .level-card h4 { font-size: 1rem; }

  /* ── Individual accessories ──────────────────────────────── */
  .individual-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .individual-card {
    padding: 14px;
  }

  .individual-card h4 { font-size: 0.9rem; }
  .individual-card .ind-price { font-size: 1.1rem; }
  .individual-card .btn { padding: 10px; font-size: 0.8rem; }

  /* ── Comparison table — horizontal scroll ────────────────── */
  .comparison-section {
    margin: 0 -12px;
    padding: 24px 12px;
    border-radius: 0;
  }

  .comparison-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }

  .comparison-table {
    min-width: 480px;
    font-size: 0.8rem;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 10px 12px;
  }

  /* ── Trust section ───────────────────────────────────────── */
  .trust-section {
    padding: 24px 0;
  }

  .trust-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .trust-item {
    font-size: 0.8rem;
    padding: 10px;
    border-radius: 10px;
    background: var(--secondary-bg);
  }

  /* ── Navbar mobile fix ────────────────────────────────────── */
  .tesla-header { padding: 10px 16px; gap: 8px; }
  .tesla-header .logo { font-size: 0.95rem; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
  .tesla-header .logo img { width: 32px; height: 32px; flex-shrink: 0; }
  .right-nav { gap: 4px; flex-shrink: 0; }
  .controls-wrapper { gap: 4px; }
  .lang-toggle { font-size: 0.75rem; padding: 4px 6px; }
  .theme-toggle { padding: 4px; }
  .theme-toggle svg { width: 18px; height: 18px; }

  /* ── Section padding ─────────────────────────────────────── */
  .section-padding {
    padding: 40px 0;
  }
}

/* ── Extra small (iPhone SE etc) ────────────────────────────── */
@media (max-width: 390px) {
  .product-card .product-image-container {
    width: 110px;
    min-width: 110px;
  }

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

  .hero-content h1 { font-size: 1.7rem; }
}

/* ── Tablet (769px - 1024px) ────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .shelf-card {
    flex-direction: row;
  }
}

/* ── Touch-friendly tap targets everywhere ──────────────────── */
@media (hover: none) {
  .btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .product-card:hover {
    transform: none;
  }

  .scenario-card:hover {
    transform: none;
  }

  /* Larger carousel buttons for touch */
  .carousel-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  /* Bigger dots */
  .carousel-dots .dot {
    width: 10px;
    height: 10px;
  }
}

/* ── Critical image fixes — must be at end to override ─────────── */
@media (max-width: 768px) {

  /* Force full-width images — overrides any inherited constraints */
  .product-card .product-image-container {
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
  }

  .product-card .carousel-track {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
  }

  .product-card .carousel-slide {
    min-width: 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    height: 260px !important;
    object-fit: cover !important;
    object-position: center !important;
    flex-shrink: 0 !important;
    display: block !important;
  }

  /* Navbar — hide logo text on very small screens, keep icon */
  .tesla-header .logo span,
  .tesla-header .logo-text {
    display: none;
  }

  .tesla-header .logo {
    max-width: 40px;
  }

  /* Hide lang toggle text on mobile — just show icon or nothing */
  .lang-toggle {
    display: none !important;
  }
}

/* ── Fix object-position: images were anchored top, crops subject ── */
@media (max-width: 768px) {
  .product-card .carousel-slide,
  .product-card .product-image-container img {
    object-position: center center !important;
  }
}