/* =====================================================================
   OfficePlus — stratul MOBIL "ca la lideri" (Amazon/eMAG/Wildberries).
   RO: se incarca DUPA site-responsive.css si adauga doar comportamentul
   de telefon: bara de navigare fixa jos (app-like), antet lipicios cu
   cautarea mereu la indemina, filtrele ca bottom-sheet, bara fixa
   "Adauga in cos" pe fisa produsului, tinte tactile >=44px si insetele
   de siguranta iPhone (notch / home-indicator, env(safe-area-inset-*)).
   EN: mobile-first layer: fixed bottom tab bar, sticky search header,
   filters as a bottom sheet, sticky PDP buy bar, 44px touch targets,
   iOS/Android safe-area support. Desktop ramine neatins.
   ===================================================================== */

/* bara de jos exista DOAR pe telefon */
.bnav { display: none; }
.sheet-overlay { display: none; }

@media (max-width: 640px) {

  /* ── platforma: fara zoom la focus (fonturi >=16px pe inputuri),
        fara flash albastru la tap, fara dublu-tap-zoom pe butoane ── */
  html { -webkit-text-size-adjust: 100%; }
  * { -webkit-tap-highlight-color: transparent; }
  a, button, .fchip, .tab, .pg { touch-action: manipulation; }
  input, select, textarea { font-size: 16px !important; }

  /* loc pentru bara de jos + insetul home-indicator (iPhone X+) */
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }

  /* ── antet lipicios: cautarea ramine mereu sus (stil lider) ──
     .homepage avea overflow:hidden — anuleaza sticky, il deschidem */
  .homepage { overflow: visible; }
  .topbar { display: none; }              /* pe telefon nu aduce nimic */
  .header {
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  }
  .navbar { padding: 8px 12px 10px; gap: 8px 10px; }
  .logo, .logo img { width: 128px; }
  .search-field { height: 44px; border-radius: 12px; }
  .catalog-btn { display: none; }         /* Catalogul e in bara de jos */
  /* pictogramele din dreapta dubleaza bara de jos — lasam doar telefonul */
  .nav-actions .icon-btn { display: none; }

  /* ── bara de navigare fixa jos (app-like) ─────────────────────── */
  .bnav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 70;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding: 4px 2px calc(2px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid #e6e6e6;
  }
  .bnav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 44px;
    color: #8a8a8a;
    font-size: 10.5px;
    font-weight: 600;
    position: relative;
  }
  .bnav a.on { color: #194681; }
  .bnav svg { width: 23px; height: 23px; }
  .bnav .badge {
    top: -2px;
    right: calc(50% - 20px);
    min-width: 16px; height: 16px;
    line-height: 16px; font-size: 10px;
  }

  /* ── catalog: filtrele ca BOTTOM-SHEET (nu impinge continutul) ── */
  .plp-side.open {
    position: fixed;
    /* RO: `width` bate `right` la pozitionare fixa, iar blocul <style> din
       site_base (width:280px) vine DUPA site-responsive — de aceea sheet-ul
       ramasese ingust. Selectorul .plp-side.open are specificitate mai mare.
       EN: width beats right on fixed elements; reset it so left/right rule. */
    width: auto;
    left: 0; right: 0; bottom: 0;
    top: auto;
    max-height: 78vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 80;
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.25);
    padding: 10px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  }
  /* spatiu pentru butonul de inchidere, ca sa nu acopere primul filtru */
  .plp-side.open > .fbox:first-of-type { margin-top: 6px; }
  /* minerul si butonul de inchidere (injectate din site.js) */
  .sheet-grip {
    width: 44px; height: 5px;
    border-radius: 99px;
    background: #d8d8d8;
    margin: 4px auto 10px;
  }
  .sheet-close {
    position: absolute;
    top: 10px; right: 14px;
    width: 34px; height: 34px;
    border: 0; border-radius: 50%;
    background: #f1f1f1;
    font-size: 16px;
    cursor: pointer;
    z-index: 2;
  }
  .sheet-overlay.on {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 75;
    background: rgba(15, 23, 42, 0.45);
  }
  body.sheet-open { overflow: hidden; }
  .ftree { max-height: none; }
  .fchip { min-height: 34px; display: inline-flex; align-items: center; }

  /* RO: coloanele NU trebuie sa depaseasca ecranul. `1fr` = minmax(auto,1fr)
     si nu coboara sub min-content: codurile lungi (barcod/articol) umflau
     grila pina la 1460px intr-un container de 343px, iar pagina se putea
     trage lateral. `minmax(0,1fr)` + min-width:0 pe containere rezolva.
     EN: use minmax(0,1fr) so tracks may shrink below content width. */
  .plp, .plp-main, .plp-top { min-width: 0; max-width: 100%; }
  .plp-main { width: 100%; }
  .product-grid, .product-grid.five, .plp .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* RO: cardurile trebuie sa aiba aceeasi inaltime, ca la magazinele mari:
     denumirea se taie la 3 rinduri, codul la unul. Regulile stau AICI (nu in
     styles.css) ca sa se aplice pe orice instanta, indiferent de ramura.
     EN: uniform cards — clamp the name to 3 lines, the code to one. */
  .product-card .product-name {
    font-size: 13px; line-height: 1.3; min-height: 0;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .product-card .product-code {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .product-card { min-height: 0; }

  /* butonul "Filtre" — plutitor linga sortare, mereu vizibil */
  .plp-ftoggle {
    height: 40px;
    border-radius: 10px;
    font-size: 14px;
  }

  /* ── fisa produsului: bara fixa "Adauga in cos" jos (stil lider) ── */
  .pdp-qty {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    z-index: 60;
    margin: 0;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.97);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid #e6e6e6;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.10);
    gap: 10px;
  }
  .pdp-qty > span { display: none; }       /* eticheta "Cantitate" — evidenta */
  .pdp-qty input { width: 62px; height: 44px; flex: none; }
  .pdp-qty .btn-big { flex: 1; width: auto; height: 46px; margin: 0; }
  /* continutul nu se ascunde sub bara */
  .pdp { padding-bottom: 84px; }

  /* hero pe telefon: mai scund, titlul nu se sparge in cuvinte-turn */
  .hero { padding-top: 8px; }
  .hero-slide-visual { height: 300px; border-radius: 14px; }
  .hero-slide-content { left: 18px; top: 20px; right: 18px; }
  .hero-title { font-size: 23px; margin-bottom: 10px; }
  .hero-sub { font-size: 13px; margin-bottom: 16px; }
  .btn-orange { height: 42px; padding: 0 20px; font-size: 14.5px; }
  .hero-slide-art { width: 220px; height: 220px; right: -70px; bottom: -70px; }
  .slider-controls { margin-top: 10px; }

  /* fisa produsului: poza nu iese din ecran, titlul lung se rupe */
  /* latimea 520px vine din blocul <style> (desktop) si iesea din ecran */
  .pdp-img { width: 100%; max-width: 100%; min-height: 0; height: 260px;
    padding: 12px; }
  .pdp-img img { max-width: 100%; max-height: 236px; }
  .pdp-name { font-size: 19px; overflow-wrap: anywhere; }
  .pdp-code { overflow-wrap: anywhere; }
  .pdp-price { font-size: 24px; margin: 6px 0 2px; }
  .pdp-cols { flex-direction: column; gap: 16px; }
  .pdp-sec, .pdp-credit { min-width: 0; }
  .pdp-desc, .pdp-desc * { max-width: 100%; overflow-wrap: anywhere; }
  .pdp-desc img, .pdp-desc table { max-width: 100% !important; height: auto; }

  /* ── tinte tactile: minimum 44px inaltime pentru orice legatura pe
     care se apasa cu degetul (recomandarea Apple HIG / Material).
     Legaturile de text aveau 14-20px — greu de nimerit pe telefon. ── */
  .see-all { min-height: 44px; display: inline-flex; align-items: center; }
  .footer-col a, .footer-links a, .footer-nav a {
    display: inline-flex; align-items: center; min-height: 40px;
  }
  .footer-col li { margin: 0; }
  .breadcrumbs a { padding: 6px 0; display: inline-block; }
  .lang-item { min-height: 40px; display: inline-flex; align-items: center;
    padding: 0 6px; }

  /* ── marunte de finete ────────────────────────────────────────── */
  .breadcrumbs { font-size: 12px; overflow-x: auto; white-space: nowrap;
    scrollbar-width: none; }
  .breadcrumbs::-webkit-scrollbar { display: none; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; }
  .toast { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
  /* RO: butonul plutitor al ghidului (#opGuideBtn, alta echipa) statea peste
     fila "Cont" din bara de jos — il ridicam deasupra barei.
     EN: floating guide button must clear the bottom tab bar. */
  #opGuideBtn { bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important; }
  /* pe fisa produsului mai exista bara "Adauga in cos" — urcam si mai sus */
  body:has(.pdp-qty) #opGuideBtn {
    bottom: calc(132px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body:has(.pdp-qty) #opGuide {
    bottom: calc(198px + env(safe-area-inset-bottom, 0px)) !important;
  }
  #opGuide { bottom: calc(134px + env(safe-area-inset-bottom, 0px)) !important;
    max-height: 60vh; }
  .pager .pg { min-width: 42px; height: 42px; }
  .row-nav .nav-pill { width: 42px; height: 42px; }
  .footer { padding-bottom: 8px; }
}

/* ── DESKTOP: cardurile compacte (cerinta owner 27.08.2026) ────────────
   RO: regula sta AICI, nu in blocul <style> din site_base.html, pentru ca
   sablonul e rescris periodic de cealalta echipa si atunci cardurile
   redeveneau uriase (repeat(4,1fr) + coduri lungi = coloane de 900px).
   Fisierul acesta e al nostru si se incarca ultimul.
   EN: keep the compact-card rule in our own last-loaded file; the shared
   template gets overwritten by the other team from time to time. */
@media (min-width: 1025px) {
  .plp .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  }
}
.product-card { min-width: 0; }
.product-card .product-name,
.product-card .product-code { overflow-wrap: anywhere; }

/* tableta: doar antetul lipicios, fara bara de jos */
@media (min-width: 641px) and (max-width: 1024px) {
  .homepage { overflow: visible; }
  .header { position: sticky; top: -40px; z-index: 50;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06); }
}
