:root{
    --bg:#0b3c5d;
    --bg-soft:#0f4c75;
    --text:#ffffff;
    --muted:#b7d9ee;

    --accent:#1fa2dc;
    --accent2:#e63946;

    --ok:#2bb673;
    --warn:#ffb703;
    --err:#ff5d5d;

    --line:rgba(255,255,255,.18);
    --shadow:0 12px 30px rgba(0,0,0,.35);
    --r:18px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
    margin:0;
    font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial;
    background:var(--bg);
    color:var(--text);
}

a{color:var(--accent);text-decoration:none}

.wrap{max-width:1100px;margin:0 auto;padding:18px 14px 100px}

.topbar{
    display:flex;
    gap:14px;
    align-items:center;
    justify-content:space-between;
    flex-wrap:wrap;
    margin-bottom:18px;
}

.brand{display:flex;gap:16px;align-items:center}

.logo{
    width:220px;
    height:80px;
    background:url("logo.png") no-repeat center / contain;
}

.sub{color:var(--muted);font-size:12px}

.card{
    background:rgba(255,255,255,.08);
    border:1px solid var(--line);
    border-radius:var(--r);
    box-shadow:var(--shadow);
}

.inner{padding:16px}

.row{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
    align-items:center;
}

.actions{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    justify-content:flex-end;
}

.btn,button{
    appearance:none;
    border:none;
    background:var(--accent);
    color:#fff;
    padding:10px 14px;
    border-radius:14px;
    font-weight:800;
    cursor:pointer;
    white-space:nowrap;
}

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

.btn.danger{
    background:var(--accent2);
}

.small{color:var(--muted);font-size:12px}

input,select,textarea{
    width:100%;
    padding:12px;
    border-radius:14px;
    border:1px solid var(--line);
    background:rgba(0,0,0,.25);
    color:var(--text);
}

textarea{min-height:110px}

.badge{
    padding:6px 12px;
    border-radius:999px;
    font-size:12px;
    font-weight:800;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    line-height:1;
}
.badge.ok{background:rgba(43,182,115,.3)}
.badge.warn{background:rgba(255,183,3,.3)}
.badge.err{background:rgba(255,93,93,.3)}

.thumb{
    width:64px;
    height:64px;
    border-radius:14px;
    border:1px solid var(--line);
    overflow:hidden;
    background:rgba(255,255,255,.1);
}
.thumb img{width:100%;height:100%;object-fit:cover}

.table{width:100%;border-collapse:separate;border-spacing:0 10px}
.table thead{display:none}
.table tr{
    background:rgba(0,0,0,.25);
    border:1px solid var(--line);
    border-radius:16px;
    display:block;
}
.table td{
    padding:10px 12px;
    display:flex;
    justify-content:space-between;
    gap:10px;
    align-items:flex-start;
}

@media (min-width:820px){
    .table thead{display:table-header-group}
    .table tr{display:table-row}
    .table td{display:table-cell}
}

/* =========================================
   FRONT (index) � HERO / FILTERS / PRODUCTS
   ========================================= */

/* ===== HERO ===== */
.hero-header{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:16px;
    margin:16px 0 26px;
}

.hero-logo img{
    max-width:580px;
    width:100%;
    display:block;
}

.hero-actions{
    width:100%;
    display:flex;
    justify-content:space-between;
    gap:14px;
    flex-wrap:wrap;
    align-items:center;
}

.hero-sub{
    color:var(--muted);
    font-size:12px;
    text-align:center;
}

/* ===== FILTERS ===== */
.filters{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
    align-items:flex-end;
    margin-bottom:18px;
}

.filters .field{
    flex:1;
    min-width:220px;
}

/* ===== KATEGORIJOS (PILLS) ===== */
.pill{
    display:inline-flex;
    align-items:center;
    padding:8px 12px;
    border-radius:999px;
    border:1px solid rgba(255,255,255,.25);
    background:rgba(0,0,0,.22);
    color:#fff;
    text-decoration:none;
    white-space:nowrap;
}

.pill.active{
    background:rgba(31,162,220,.35);
    border-color:#1fa2dc;
}

/* ===== DETAIL ===== */
.row.badges{
    gap:10px;
    flex-wrap:wrap;
}

.back-btn{
    white-space:nowrap;
}

/* ===== TABLE � pilnas plotis ===== */
.table{ width:100%; }
.table tr{ width:100%; }
.table td{ width:100%; }

/* ===== PRODUKTO LAYOUT (nuotrauka + tekstas) ===== */
.product-row{
    width:100%;
    display:grid;
    grid-template-columns: 96px 1fr;
    gap:16px;
    align-items:flex-start;
}

/* SVARBU: leidziam tekstui susitraukti */
.product-row > div{
    min-width:0;
    width:100%;
}

/* ===== PRODUKTO PAVADINIMAS (FIX: netelpa) ===== */
/* 2 eilutes + � (mobiliame tvarkingai) */
.product-title{
    font-weight:900;

    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
    overflow:hidden;

    max-width:100%;
    min-width:0;
    white-space:normal;
    overflow-wrap:anywhere;
    word-break:break-word;
    line-height:1.15;
}

/* ===== PRODUKTO VEIKSMAI: Turime + I krepseli ===== */
.product-actions{
    margin-top:10px;
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    align-items:center;
    justify-content:flex-start;
}

.product-badge{ flex:0 0 auto; }
.addcart-form{ margin:0; flex:0 0 auto; }

/* Vienodas �Turime� ir �I krepseli� dydis */
.product-badge .badge,
.addcart-btn{
    height:36px;
    padding:0 16px;
    border-radius:999px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-size:14px;
    font-weight:800;
    line-height:1;
}

/* Kaina su � salia */
.price{
    white-space:nowrap;
    font-weight:900;
}

/* ===== FOOTER CENTER FIX (jei naudoji footerbar) ===== */
.footerbar{
    text-align:center;
}
.footerbar .wrap2{
    max-width:1100px;
    margin:0 auto;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:4px;
    text-align:center;
}
.footerbar .wrap2 > *{
    width:100%;
    text-align:center;
}

/* ===== MOBILE ===== */
@media (max-width:600px){
    .hero-logo img{ max-width:360px; }

    .hero-actions{
        justify-content:center;
        text-align:center;
    }

    .pill{ white-space:normal; }

    .product-row{
        grid-template-columns: 1fr;
    }

    .thumb{
        width:96px;
        height:96px;
    }

    .product-actions{
        flex-direction:column;
        align-items:stretch;
    }

    .addcart-btn{
        width:100%;
        text-align:center;
    }

    /* jei noresi 3 eilutes mobiliai � pakeisk i 3
    .product-title{ -webkit-line-clamp:3; }
    */
}

/* ===== Responsive titles & overflow fix ===== */
h1, h2, h3{
  margin:0;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.topbar .brand > div{min-width:0}
.topbar h1{
  font-size:clamp(22px, 6.2vw, 44px);
  line-height:1.05;
  letter-spacing:.2px;
}
@media (max-width:600px){
  .topbar{gap:10px}
  .topbar h1{font-size:clamp(20px, 7vw, 34px)}
}

/* ===== Product titles (prevent running outside) ===== */
.product-title{
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* ===== Cart qty input width fix ===== */
.cart-qty{
  width:120px !important;
  max-width:140px;
  text-align:center;
  font-weight:800;
}
@media (max-width:600px){
  .cart-qty{
    width:110px !important;
    max-width:130px;
  }
}


/* ===== TEXT overflow fix (mobile + desktop) ===== */
.product-title,
h1,h2,h3{
  overflow-wrap:anywhere;
  word-break:break-word;
}

.product-title{
  font-size: clamp(16px, 4.6vw, 22px);
  line-height: 1.15;
  display:block;
}

/* ===== Cart qty controls ===== */
.qty-control{
  display:inline-flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
}
.qty-input{
  width:84px !important;
  max-width:84px;
  text-align:center;
  padding:10px 10px;
}
.qty-btn{
  width:38px;
  height:38px;
  border-radius:999px;
  background:rgba(0,0,0,.20);
  border:1px solid var(--line);
  color:var(--text);
  font-weight:900;
  font-size:18px;
  line-height:1;
  cursor:pointer;
}
.qty-btn:active{ transform:scale(.98); }

/* ===== Image fallback looks nice ===== */
.thumb img{
  background:rgba(0,0,0,.15);
}

/* Mobile: reduce huge titles in detail header */
@media (max-width:600px){
  .hero-actions{justify-content:center;}
  h2{font-size: clamp(20px, 6vw, 28px);}
}
