/* ============================================================
   checkout.css - finalizarea comenzii pe o singura pagina
   (views/shopcart/checkout.php, web/js/checkout.js)
   Refoloseste variabilele --co-* si campurile .co-input / .co-select
   din checkout-guest.css.
   ============================================================ */

.ck-page {
    max-width: 1180px;
    margin: 0 auto 40px;
    padding: 0 12px;
}

.ck-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 18px 0 14px;
}

.ck-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    color: var(--co-text);
}

.ck-head__back {
    font-size: 14px;
    color: var(--co-cta);
    text-decoration: none;
}

.ck-head__back:hover { text-decoration: underline; }

.ck-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.ck-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Sumarul cu butonul ramane la vedere cit timp se completeaza formularul.
   top: sub headerul lipit, cind e lipit (--gf-sticky-top vine din header.js). */
.ck-side {
    flex: 0 0 360px;
    position: sticky;
    top: calc(var(--gf-sticky-top, 0px) + 16px);
}

/* position:sticky nu merge sub un parinte cu overflow:hidden, iar .siteScreen
   (layout-ul comun) il are - sumarul ramanea sus in dreapta. Ca la filtrele din
   categorii (style.css), doar pe paginile cosului si finalizarii hidden devine
   clip: taie la fel, dar nu face din .siteScreen un container de derulare.
   flow-root pastreaza contextul de formatare pe care il dadea hidden. */
@media (min-width: 861px) {
    .siteScreen:has(.ck-side),
    .siteScreen:has(.sc-sidebar) {
        overflow: clip;
        display: flow-root;
    }
}

.ck-card {
    background: var(--co-card);
    border: 1px solid var(--co-border);
    border-radius: var(--co-radius);
    padding: 22px 24px;
    box-shadow: var(--co-shadow);
}

.ck-card__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--co-text);
    margin: 0 0 16px;
}

.ck-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.ck-fields--2 { grid-template-columns: 1fr 1fr; }

.ck-fields + .co-field-wrap--full,
.ck-error + .co-field-wrap--full { margin-top: 14px; }

/* ---- Erori ---- */
.ck-error {
    display: none;
    font-size: 13px;
    color: var(--co-accent);
    margin-top: 6px;
}

.ck-error.is-visible { display: block; }

.ck-form-error {
    background: #fff5f5;
    border: 1px solid #f5c2c7;
    color: #b02a37;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 12px;
}

/* ---- Plitele (livrare, plata) ---- */
.ck-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.ck-tiles--delivery { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 420px; }

.ck-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 104px;
    padding: 14px 10px;
    border: 1.5px solid var(--co-border);
    border-radius: 10px;
    background: var(--co-bg);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--co-transition), background var(--co-transition), box-shadow var(--co-transition);
    margin: 0;
    font-weight: 500;
}

.ck-tile input { position: absolute; opacity: 0; width: 0; height: 0; }

.ck-tile i {
    font-size: 24px;
    color: var(--co-muted);
    transition: color var(--co-transition);
}

.ck-tile span {
    font-size: 13px;
    line-height: 1.25;
    color: var(--co-text);
}

.ck-tile small {
    font-size: 11px;
    color: var(--co-muted);
    line-height: 1.2;
}

.ck-tile__brand {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #1d5fbf;
    line-height: 1;
}

.ck-tile:hover { border-color: #b9c2d0; }

.ck-tile.is-active {
    border-color: var(--co-cta);
    background: #fff;
    box-shadow: 0 0 0 1px var(--co-cta);
}

.ck-tile.is-active i { color: var(--co-cta); }

.ck-tile:focus-within { outline: 2px solid rgba(37, 99, 235, .35); outline-offset: 2px; }

.ck-tile[hidden] { display: none; }

/* ---- Panouri conditionate ---- */
.ck-delivery-panel,
.ck-payment-panel { margin-top: 4px; }

.ck-delivery-note {
    font-size: 13px;
    color: var(--co-muted);
    margin-top: 10px;
    min-height: 18px;
}

.ck-delivery-note.is-error { color: var(--co-accent); }

.ck-note {
    font-size: 13px;
    color: var(--co-muted);
    background: var(--co-bg);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0 0 12px;
}

.ck-note i { margin-right: 6px; }

/* Rechizitele firmei (CompanyInvoice::formGridHtml) in cardul de plata */
.ck-payment-panel .scet-fields { padding: 0; }

/* Widget-ul de credit incorporat */
.ck-credit-widget { padding: 0 !important; }
.ck-credit-widget .card-header-pills h3 { font-size: 18px !important; margin-bottom: 14px !important; }

/* ---- Comentariu ---- */
.ck-card--comment { padding: 14px 24px; }

.ck-comment summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--co-cta);
    list-style: none;
}

.ck-comment summary::-webkit-details-marker { display: none; }

.ck-comment summary::after {
    content: '\25BE';
    margin-left: 6px;
    font-size: 12px;
}

.ck-comment[open] summary::after { content: '\25B4'; }

.ck-comment[open] summary { margin-bottom: 12px; }

/* ---- Sumar ---- */
.ck-items {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    max-height: 280px;
    overflow-y: auto;
}

.ck-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--co-border);
}

.ck-item:last-child { border-bottom: none; }

.ck-item__img {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border: 1px solid var(--co-border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ck-item__img img { max-width: 100%; max-height: 100%; }

.ck-item__body { flex: 1; min-width: 0; }

.ck-item__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.3;
    color: var(--co-text);
    text-decoration: none;
}

.ck-item__title:hover { color: var(--co-cta); }

.ck-item__meta {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 13px;
    color: var(--co-muted);
}

.ck-item__meta b { color: var(--co-text); }

.ck-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--co-text);
    padding: 10px 0;
    border-top: 1px solid var(--co-border);
    cursor: pointer;
}

.ck-check input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--co-accent);
    flex-shrink: 0;
}

.ck-promo { padding: 10px 0; border-top: 1px solid var(--co-border); }

.ck-promo__toggle {
    background: none;
    border: none;
    padding: 0;
    color: var(--co-cta);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.ck-promo__toggle i { margin-right: 6px; }

.ck-promo__form {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.ck-promo__input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    border: 1.5px solid var(--co-border);
    border-radius: 8px;
    font-size: 14px;
    text-transform: uppercase;
}

.ck-promo__apply {
    height: 40px;
    padding: 0 14px;
    border: none;
    border-radius: 8px;
    background: var(--co-cta);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.ck-promo__msg { font-size: 13px; margin-top: 6px; }
.ck-promo__msg.is-ok { color: #27ae60; }
.ck-promo__msg.is-error { color: var(--co-accent); }

.ck-promo__guest {
    font-size: 12px;
    color: var(--co-muted);
    padding: 10px 0;
    border-top: 1px solid var(--co-border);
    margin: 0;
}

.ck-rows { border-top: 1px solid var(--co-border); padding-top: 10px; margin-bottom: 14px; }

.ck-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 5px 0;
    font-size: 14px;
    color: var(--co-text);
}

.ck-row b { font-weight: 600; white-space: nowrap; text-align: right; }

.ck-row--discount { color: #27ae60; }

.ck-row--total {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 2px solid var(--co-border);
    font-size: 17px;
    font-weight: 700;
}

.ck-row--total b { color: var(--co-accent); font-size: 20px; }

.ck-submit {
    width: 100%;
    padding: 15px 20px;
    background: var(--co-cta);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--co-transition), transform .1s, opacity var(--co-transition);
}

.ck-submit:hover { background: var(--co-cta-dark); }
.ck-submit:active { transform: scale(.98); }
.ck-submit[disabled] { opacity: .6; cursor: default; transform: none; }

.ck-agree {
    font-size: 12px;
    color: var(--co-muted);
    line-height: 1.45;
    margin: 12px 0 0;
    text-align: center;
}

.ck-agree a { color: var(--co-cta); text-decoration: underline; }

/* ---- Bara fixa de jos (telefon) ---- */
.ck-mobilebar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    gap: 12px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--co-border);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
}

.ck-mobilebar__total { display: flex; flex-direction: column; line-height: 1.15; }
.ck-mobilebar__total span { font-size: 11px; color: var(--co-muted); }
.ck-mobilebar__total b { font-size: 18px; color: var(--co-accent); white-space: nowrap; }
.ck-submit--mobile { flex: 1; padding: 13px 16px; font-size: 15px; }

/* ---- Responsive ---- */
@media (max-width: 991px) {
    .ck-layout { flex-direction: column; }
    .ck-side { position: static; flex: 0 0 auto; width: 100%; }
    /* Sub 992px sumarul coboara sub formular: totalul si butonul raman la
       vedere in bara fixa de jos, deasupra tab-barului site-ului (bottom-ul il
       potriveste checkout.js). Jos lasam loc pentru ambele bare. */
    .ck-page { padding-bottom: 150px; }
    .ck-summary .ck-submit { display: none; }
    .ck-mobilebar { display: flex; justify-content: space-between; }
    .ck-submit--mobile { max-width: 440px; }
}

@media (max-width: 600px) {
    /* loc pentru bara cu totalul + tab-barul site-ului, ambele fixe jos */
    .ck-page { padding: 0 8px 150px; }
    .ck-card { padding: 16px; }
    .ck-card--comment { padding: 12px 16px; }
    .ck-fields--2 { grid-template-columns: 1fr; }
    .ck-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .ck-tiles--delivery { max-width: none; }
    .ck-tile { min-height: 92px; padding: 12px 8px; }
    .ck-title { font-size: 21px; }
    .ck-head { padding: 12px 0 10px; }
}
