/* ========================================
   CURRENT ORDER PAGE - SHOPPING CART
   ======================================== */

/* Back Button */
.back-btn {
    position: relative;
    font-size: 32px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 50px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    border: 2px solid #6c757d;
    z-index: 2;
}

.back-btn i {
    font-size: 22px;
    color: #6c757d;
}

/* Header Center - Cart Title */
.cart-header {
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.cart-header i {
    font-size: 36px;
    color: #c2410c;
}

.cart-header span {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
}

/* Header Actions Placeholder */
.header-placeholder {
    width: 60px;
}

/* Main Content Container */
.order-content {
    padding: 40px 80px;
    overflow-y: auto;
    height: 100%;
    background: #f5f5f5;
}

.order-content-inner {
    max-width: 900px;
    margin: 0 auto;
}

/* ========== CART ITEMS LIST ========== */
.current-order-items-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

/* Item Card */
.current-order-item-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #ececec;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    display: grid;
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto auto;
    column-gap: 14px;
    row-gap: 10px;
    align-items: start;
    position: relative;
}

.current-order-item-card .current-order-item-image-wrapper {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
}

.current-order-item-card .current-order-item-info {
    grid-column: 2;
    grid-row: 1;
}

.current-order-item-card .current-order-item-total {
    position: static;
    transform: none;
}

.current-order-item-card .current-order-controls {
    grid-column: 2;
    grid-row: 2;
}

/* Item Image */
.current-order-item-image-wrapper {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    flex-shrink: 0;
    overflow: hidden;
}

.current-order-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.current-order-item-image-placeholder {
    width: 100%;
    height: 100%;
    background: #fff4ec;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

/* Logo umjesto emojija kad artikl nema svoju sliku. Okvir je malen (70px, na
   mobitelu 48px), pa logo ide u `contain` i s rubom -- `cover` s pravila iznad
   bi ga razvukao i odrezao. */
.current-order-item-image-placeholder img.nema-slike-logo {
    width: auto;
    height: auto;
    max-width: 78%;
    max-height: 78%;
    object-fit: contain;
    border-radius: 0;
}

/* Item Info */
.current-order-item-info {
    flex: 1;
    min-width: 0;
}

.current-order-item-title {
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 8px 0;
}

.current-order-item-variant {
    color: #9b59b6;
    font-size: 18px;
}

.current-order-item-description {
    font-size: 13px;
    color: #6c757d;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

/* Item header — name on left, total on right */
.current-order-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.current-order-item-header .current-order-item-title {
    margin: 0;
    flex: 1;
    min-width: 0;
}

.current-order-item-total {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: center;
}

/* Extras list — flush left, no background */
.current-order-extras-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.current-order-extra-item {
    font-size: 13px;
    line-height: 1.4;
}

/* Prazna košarica i dijalog brisanja: ista pravila kontrasta (4,5:1).
   Gumb i dijalog dolaze iz zajedničkih cards.css / modals.css — tamo bi
   promjena dirnula i stranice osoblja, pa se gaze samo na košarici. */
.current-order-empty .browse-menu-btn {
    background: #c2410c;
}

.confirm-modal__actions .confirm-modal__btn--danger {
    background: #c0392b;
}

.confirm-modal__actions .confirm-modal__btn--danger:hover {
    background: #a93226;
}

.confirm-modal__actions .confirm-modal__btn--cancel {
    color: #5c6670;
}

/* Quantity display + pulse on press */
.current-order-quantity-display {
    display: inline-block;
    min-width: 24px;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    color: #2c3e50;
}

@keyframes qty-pulse {
    0%   { transform: scale(1);    color: #2c3e50; }
    40%  { transform: scale(1.25); color: #c2410c; }
    100% { transform: scale(1);    color: #2c3e50; }
}

.current-order-quantity-controls:has(.cart-qty-btn:active) .current-order-quantity-display {
    animation: qty-pulse 0.35s ease-out;
}

/* Price Breakdown */
.current-order-price-breakdown {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 8px;
}

.current-order-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.current-order-price-label {
    font-weight: 700;
    color: #2c3e50 !important;  /* Override .extras-badge color */
}

.current-order-price-value {
    font-weight: 700;
    color: #2c3e50;
    margin-left: 12px;
}

.current-order-extras-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    margin-left: 20px;
}

.current-order-price-separator {
    border-top: 2px solid #dee2e6;
    padding-top: 8px;
    margin-top: 8px;
}

.current-order-total-row {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    color: #2c3e50;
}

.current-order-total-amount {
    color: #2c3e50;
    font-size: 16px;
}

/* Controls */
.current-order-controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* Jedan obrub oko cijele pilule; gumbi unutra su bez vlastitih krugova
   (cards.css .cart-qty-btn) — tri kruga u sivoj piluli djelovala su natrpano. */
.current-order-quantity-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    background: #fff;
    border: 1.5px solid #c2410c;
    border-radius: 999px;
    padding: 2px;
    /* Desno, gdje je bio gumb za brisanje (kanta je sada "−" na količini 1). */
    grid-column: 3;
    justify-self: end;
}

.current-order-quantity-display {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    min-width: 30px;
    text-align: center;
}

/* ========== STANJE "NIJE POSLANO" ========== */
/* Na vrhu kosarice: gost je ekran s velikim "Ukupno" citao kao kraj posla.
   Jantarna = "ceka tebe", ne greska (crvena) ni gotovo (zelena). */
.cart-not-sent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #fff7e6;
    border: 1px solid #f5c26b;
    border-left: 5px solid #f39c12;
    border-radius: 12px;
    color: #7a4b00;
    font-size: 14px;
    line-height: 1.4;
}

.cart-not-sent i {
    margin-top: 2px;
    font-size: 20px;
    color: #f39c12;
}

.cart-not-sent strong {
    display: block;
    font-size: 16px;
    color: #5c3a00;
}

/* ========== NAPOMENA UZ NARUDZBU (<details>) ========== */
/* Neutralno siva: plava je na meniju "nastavi", zelena je "posalji" — sporedna
   radnja ne smije nositi nijednu od njih. #5c6670 na bijelom: 5,8:1.

   Zadnji red kartice sa stavkama, desno. Otvoreno polje ide ispod, preko
   cijele sirine kartice (vidi .current-order-note-row). */
.order-note summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;           /* dodirna povrsina za palac */
    padding: 0 4px;
    color: #5c6670;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.order-note summary::-webkit-details-marker {
    display: none;
}

/* ========== CHECKOUT FORMA ========== */
.current-order-checkout-form {
    margin: 0;
}

/* ========== EMPTY CART STATE ========== */
.current-order-empty {
    text-align: center;
    padding: 80px 40px;
}

.current-order-empty-icon {
    font-size: 100px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.current-order-empty-title {
    font-size: 28px;
    color: #5c6670;
    font-weight: 600;
    margin-bottom: 12px;
}

.current-order-empty-text {
    font-size: 16px;
    color: #5c6670;
    margin-bottom: 32px;
}

/* ========== MOBILE ========== */
@media (max-width: 768px) {
    .back-btn {
        font-size: 22px;
        padding: 8px 12px;
    }

    .back-btn i {
        font-size: 16px;
    }

    /* Naslov je apsolutno centriran (customer_base.html), pa ne zna za pločicu
       sa stolom koja mu je s desna. Sužavanje je dovoljno da se razmaknu —
       mjereno ostaje 16px zraka.

       Ikona košarice ovdje ionako ne nosi ništa: stranica JEST košarica, a
       naslov to i piše. */
    .cart-header i {
        display: none;
    }

    .cart-header span {
        font-size: 17px;
    }

    .header-placeholder {
        width: 40px;
    }

    .order-content {
        padding: 12px;
        /* Na mobitelu skrola cijela stranica (customer.css otvara overflow i
           roditeljima). overflow-y: auto bi ovdje napravio skrol-kontejner koji
           se nikad ne skrola, pa se gumb "Pošalji" (sticky) ne bi zalijepio. */
        overflow: visible;
        height: auto;
    }

    /* Item cards — stack vertically */
    .current-order-items-list {
        gap: 12px;
        margin-bottom: 16px;
    }

    .current-order-item-card {
        padding: 12px;
        column-gap: 10px;
        row-gap: 10px;
        border-radius: 12px;
        grid-template-columns: 56px 1fr;
    }

    .current-order-item-image-wrapper {
        width: 56px;
        height: 56px;
        border-radius: 8px;
    }

    .current-order-item-image-placeholder {
        font-size: 28px;
    }

    .current-order-item-title {
        font-size: 15px;
        margin-bottom: 4px;
    }

    .current-order-item-variant {
        font-size: 13px;
    }

    .current-order-item-description {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .current-order-price-breakdown {
        font-size: 11px;
        padding: 8px;
    }

    .current-order-total-amount {
        font-size: 13px;
    }

    /* Controls — količina desno */
    .current-order-controls {
        grid-template-columns: 1fr auto 1fr;
        width: 100%;
        gap: 8px;
    }

    .current-order-quantity-display {
        font-size: 16px;
        min-width: 20px;
    }

    .current-order-item-total {
        font-size: 17px;
    }

    /* Empty state */
    .current-order-empty {
        padding: 50px 16px;
    }

    .current-order-empty-icon {
        font-size: 64px;
    }

    .current-order-empty-title {
        font-size: 20px;
    }

    .current-order-empty-text {
        font-size: 14px;
    }
}


/* ========== POZIV NA AKCIJU ========== */
/* ── Gumb za slanje: odmah ispod narudzbe, lijepi se za dno kad je ne vidi ──
   Prije je bio fixed na dnu ekrana. Kod kratke kosarice (vecina ima 1–3
   stavke) izmedju ukupnog iznosa i gumba ostajala je prazna siva ploha, pa
   gumb nije izgledao kao dio narudzbe (zakon blizine, NN/g). Gost gleda i
   tapka najradije u sredinu ekrana (Hoober), a ondje je sad narudzba + gumb.

   position: sticky, s gumbom kao IZRAVNIM djetetom #order-items-container:
   njegov blok je cijela kosarica, pa se kod duge kosarice gumb lijepi za dno
   ekrana dok se popis skrola, a na kraju sjedne ispod ukupnog iznosa.
   Sticky unutar nekadasnje kartice s iznosom bio je vezan uz taj mali
   blok i nestajao je cim bi gost odskrolao — zato je gumb izvan forme i salje
   je preko atributa form="checkout-form" (current_order_partial.html).

   Selektori su .checkout-btn.checkout-sticky (dvije klase): cards.css se
   ucitava NAKON ove datoteke i njegov .checkout-btn bi inace pregazio boju,
   padding i :hover. */
.checkout-btn.checkout-sticky {
    position: sticky;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 5;
    width: 100%;
    min-height: 68px;           /* daleko iznad 48px preporuke za palac */
    margin-top: 16px;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 18px 24px 20px;
    border-radius: 16px;

    /* Zelen, jedini zeleni element na kosarici: sve ostale akcije gosta su
       narancaste (#c2410c), a zadnji korak mora iskociti (efekt izolacije;
       razlog i povijest u css/partials/floating_cart_button.css).
       #15803d / #166534 / #14532d isti su koraci Tailwind palete (700/800/900)
       kao narancasta #c2410c / #9a3412 / #7c2d12, pa su jednako "teski"
       (OKLCH L 0,53 prema 0,55). Bijelo na #15803d 5,0:1 (AA). Zeleno koje se
       svjetlinom potpuno poklapa s narancastom pada na 4,47:1, a zasicenija
       #258001 vuce u limetu. Ista zelena je kvacica na potvrdi narudzbe.
       Dva sloja sjene: tamna odize gumb, aura u boji daje dojam da lebdi. */
    background: #15803d;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .22),
                0 16px 44px rgba(21, 128, 61, .45);
    text-shadow: none;
    transition: transform .08s ease, box-shadow .08s ease, background .15s ease;

    /* Ulazak odozdo pa lagano njihanje, 3 puta (~8,5 s) pa stane: beskonacno
       pokretanje uz sadrzaj krsi WCAG 2.2.2, a nakon par sekundi gost je gumb
       vec primijetio. Ime MORA biti vlastito, ne 'slideUp': css/components/
       messages.css pod tim imenom drzi animaciju odlaska poruke, a kod istog
       imena pobjeduje zadnje ucitano pravilo. :hover i :active nose
       !important, koji tuce animaciju, pa pritisak daje svoju povratnu
       informaciju. */
    animation: checkoutSlideUp 0.3s ease-out,
               checkoutBob 2.8s ease-in-out 0.4s 3;
}

@keyframes checkoutSlideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: none;
        opacity: 1;
    }
}

@keyframes checkoutBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-7px); }
}

/* Tko je u postavkama ugasio animacije ne dobiva njihanje — gumb ostaje
   velik i sa sjenom, vidljivost ne ovisi samo o pokretu. */
@media (prefers-reduced-motion: reduce) {
    .checkout-btn.checkout-sticky {
        animation: none;
    }
}

.checkout-btn.checkout-sticky:hover {
    /* cards.css na :hover dize gumb translateY(-2px) !important. */
    transform: none !important;
    background: #166534;
    /* Oba sloja se moraju ponoviti: box-shadow se ne mijesa po sloju nego se
       cijela lista zamjenjuje, pa bi hover inace pojeo auru. */
    box-shadow: 0 12px 28px rgba(0, 0, 0, .25),
                0 18px 48px rgba(21, 128, 61, .5) !important;
}

/* Pritisak: gumb potamni i lagano se spusti. Na mobitelu je to jedina
   povratna informacija da je klik primljen. */
.checkout-btn.checkout-sticky:active {
    transform: translateY(1px) !important;
    background: #14532d;
    box-shadow: 0 5px 14px rgba(0, 0, 0, .2),
                0 8px 24px rgba(21, 128, 61, .35) !important;
}

/* Natpis i iznos u jednom redu; na uskom ekranu iznos prelomi u novi red,
   centriran. gap umjesto margine na ikoni: ikona je flex stavka. */
.checkout-sticky .checkout-btn__label {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    column-gap: 10px;
}

/* Iznos krupnije — jedino mjesto na kosarici gdje stoji ukupno. */
.checkout-sticky .checkout-btn__cijena {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.3px;
    margin-left: 6px;
}

/* Slanje u tijeku (js/orders/cart-interactions.js): gumb zaključan, avion
   postane kotačić koji se vrti — gost vidi da je dodir primljen. */
.checkout-btn.checkout-sticky.salje {
    opacity: 0.85;
    cursor: progress;
    animation: none;
}

.checkout-sticky.salje .checkout-btn__label i::before {
    content: "\f110";           /* fa-spinner */
}

.checkout-sticky.salje .checkout-btn__label i {
    animation: fa-spin 1s linear infinite;
}

.checkout-sticky .checkout-btn__label {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.15;
}

.checkout-sticky .checkout-btn__hint {
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: .2px;
    opacity: .9;
    text-shadow: none;
}

/* ========== NAPOMENA U KARTICI SA STAVKAMA ==========
   Bez reda s iznosom (2026-10-21): iznos je na zelenom gumbu.
   "+ Dodaj napomenu" je zadnji red kartice sa stavkama, desno. Bocni
   padding = padding retka stavke, pa je desni rub isti kao rub gumba za
   kolicinu iznad; summary nosi 44px visine za palac. */
.current-order-items-list {
    margin-bottom: 4px;
}

.current-order-note-row {
    position: relative;
    text-align: right;
    padding: 0 12px 8px;
}

/* Iznos lijevo u istom redu kao "+ Dodaj napomenu": ista velicina (15px),
   samo debelo. absolute, a ne flex: otvoreno polje za napomenu mora ostati
   ispod, preko cijele sirine. line-height = 44px visine summaryja. */
.current-order-note-row__iznos {
    position: absolute;
    top: 0;
    left: 12px;
    line-height: 44px;
    font-size: 15px;
    font-weight: 800;
    color: #2c3e50;
}

@media (min-width: 769px) {
    .current-order-note-row {
        padding: 0 16px 12px;   /* = .current-order-item-card na racunalu */
    }

    .current-order-note-row__iznos {
        left: 16px;
    }
}

.order-note[open] textarea {
    margin-top: 4px;
    text-align: left;           /* red je poravnat desno, tekst gosta ne */
}

/* ========== NAPOMENA I GUMB "POŠALJI" ==========
   Dok je napomena otvorena, gumb nije ljepljiv nego stoji ispod nje. Inače se
   otvoreno polje pojavi točno ispod gumba zalijepljenog za dno ekrana, a s
   otvorenom tipkovnicom gumb prekrije polje u kojem gost piše. */
.current-order-items-list:has(.order-note[open]) ~ .checkout-btn.checkout-sticky {
    position: static;
}

/* ========== POPIS KAO JEDAN BLOK (kao Glovo) ==========
   Stavke su redovi jedne bijele kartice, bez razmaka i zasebnih kartica.
   Red: slika | naziv, cijena ispod njega i odabiri | − n + gore desno. */
.current-order-items-list {
    gap: 0;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.current-order-item-card {
    grid-template-columns: 64px 1fr auto;
    grid-template-rows: auto;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.current-order-item-card .current-order-item-image-wrapper {
    grid-row: 1;
    align-self: start;
}

/* Pilula okomito na sredini retka: s nazivom u dva reda ili odabirima ispod
   stajala je gore, pa redovi nisu izgledali jednako. */
.current-order-item-card .current-order-controls {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    display: block;
    width: auto;
}

.current-order-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

/* align-self: flex-start — staro pravilo (center) bi cijenu u stupcu
   centriralo vodoravno umjesto poravnanja s nazivom. */
.current-order-item-total {
    font-size: 15px;
    font-weight: 600;
    align-self: flex-start;
}

@media (max-width: 768px) {
    .current-order-item-card {
        grid-template-columns: 56px 1fr auto;
    }
}
