/* =========================================================================
   indexs/cart.css
   Стилі кошика RAZ (indexs/cart.js): плаваюча кнопка-кошик (FAB) + бічна шторка
   зі списком позицій. Палітра узгоджена з рештою сайту:
   --red:#DA1A32 --yellow:#FFC857 --navy:#1E3A5F --cyan:#3AAFD9
   ========================================================================= */

.razcart-fab {
    position: fixed;
    bottom: 28px;
    left: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--c-navy) 0%, #2a5080 100%);
    box-shadow: 0 4px 20px rgba(30, 58, 95, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    z-index: 9998;
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s, box-shadow 0.25s, opacity 0.2s;
}
.razcart-fab--visible {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}
.razcart-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(30, 58, 95, 0.55); }

.razcart-fab__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c-brand) 0%, #c41528 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

.razcart-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 35, 0.55);
    backdrop-filter: blur(3px);
    display: none;
    align-items: stretch;
    justify-content: flex-end;
}
.razcart-overlay.razcart-overlay--open { display: flex; }

body.razcart-no-scroll { overflow: hidden; }

.razcart-drawer {
    position: relative;
    background: #fff;
    width: 100%;
    max-width: 420px;
    height: 100%;
    box-shadow: -24px 0 70px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Arial, sans-serif;
    animation: razcartSlideIn 0.25s ease-out;
}
@keyframes razcartSlideIn {
    from { transform: translateX(24px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.razcart-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 2;
}
.razcart-close:hover { background: rgba(255, 255, 255, 0.32); }

.razcart-header {
    background: linear-gradient(135deg, var(--c-navy) 0%, #2C5282 100%);
    padding: 22px 26px;
    flex-shrink: 0;
}
.razcart-title { font-size: 19px; font-weight: 800; color: #fff; }

.razcart-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px;
}

.razcart-empty {
    color: var(--g-500);
    font-size: 13.5px;
    text-align: center;
    padding: 40px 10px;
    line-height: 1.6;
}

.razcart-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--g-50);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.razcart-item__num { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; background: var(--c-navy); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 1px; }

/* Мініатюра макета. object-fit: contain, а не cover: у кошику важливо
   впізнати свій макет цілком, а не побачити його обрізаний центр.
   Біле тло — бо макети бувають із прозорістю. */
.razcart-item__thumb {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--g-200);
    display: flex;
    align-items: center;
    justify-content: center;
}
.razcart-item__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.razcart-item__main { flex: 1; min-width: 0; }
/* overflow-wrap: імена файлів бувають довгими рядками без пробілів
   (хеші з месенджерів), і такий рядок не переносився — він просто
   виїжджав за межі картки разом із ціною. */
.razcart-item__params {
    font-size: 12px;
    color: #556a7e;
    margin-top: 3px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.razcart-item__title { font-weight: 700; color: var(--c-navy); font-size: 14px; overflow-wrap: anywhere; }
.razcart-item__meta { font-size: 12px; color: var(--g-600); margin-top: 2px; }
.razcart-item__ready { display:inline-flex; align-items:center; gap:5px; font-size: 12px; font-weight:700; color:#0f7d3b; background:#eaf8ef; border:1px solid rgba(30,158,87,.3); border-radius:6px; padding:3px 7px; margin-top:5px; line-height:1.3; }
.razcart-item__price { font-weight: 700; color: var(--c-navy); font-size: 14px; white-space: nowrap; }
.razcart-item__remove {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: #eee;
    color: var(--g-500);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.razcart-item__remove:hover { background: #ffebee; color: #c62828; }

.razcart-footer {
    flex-shrink: 0;
    padding: 16px 22px 22px;
    border-top: 1px solid #f1f3f5;
}

.razcart-min-warning {
    display: none;
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12.5px;
    line-height: 1.5;
    margin-bottom: 12px;
}
.razcart-min-warning.razcart-min-warning--shown { display: block; }

.razcart-error {
    display: none;
    background: #ffebee;
    color: #c62828;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 12px;
}
.razcart-error:not(:empty) { display: block; }

.razcart-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--c-brand) 0%, #c41528 100%);
    color: #fff;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 14px;
}
.razcart-total span { font-size: 13px; opacity: 0.9; }
.razcart-total strong { font-size: 22px; }

.razcart-checkout-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #7AB72B 0%, #5a9a1a 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.razcart-checkout-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(122, 183, 43, 0.35);
}
.razcart-checkout-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.razcart-continue-btn {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    border: 1.5px solid #cfd8e3;
    border-radius: 12px;
    background: #fff;
    color: var(--c-navy);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.razcart-continue-btn i { font-size: 15px; line-height: 0; }
.razcart-continue-btn:hover { border-color: var(--c-navy); background: #f4f7fb; }
.razcart-checkout-btn__spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    display: none;
}
.razcart-checkout-btn--loading .razcart-checkout-btn__label { opacity: 0.6; }
.razcart-checkout-btn--loading .razcart-checkout-btn__spinner {
    display: inline-block;
    animation: razcartSpin 0.8s linear infinite;
}
@keyframes razcartSpin { to { transform: rotate(360deg); } }

.razcart-toast {
    position: fixed;
    bottom: 100px;
    left: 28px;
    background: var(--c-navy);
    color: #fff;
    padding: 11px 18px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    z-index: 10000;
    transform: translateY(10px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s, opacity 0.2s;
}
.razcart-toast.razcart-toast--shown {
    transform: translateY(0);
    opacity: 1;
}

/* Плашка під кошиком у шапці (координати рахує positionToast у cart.js).
   Виїжджає згори вниз — з боку кнопки, а не назустріч їй. */
.razcart-toast--anchored {
    bottom: auto;
    left: auto;
    max-width: min(260px, calc(100vw - 24px));
    transform: translateY(-10px);
}

/* Вістря до кнопки кошика. Відступ справа задає --razcart-caret:
   плашка ширша за кнопку, тож без нього стрілка дивилась би в порожнє. */
.razcart-toast--anchored::after {
    content: '';
    position: absolute;
    top: -6px;
    right: var(--razcart-caret, 19px);
    width: 12px;
    height: 12px;
    background: inherit;
    border-radius: 2px;
    transform: translateX(50%) rotate(45deg);
}

@media (max-width: 480px) {
    .razcart-drawer { max-width: 100%; }
    .razcart-header { padding: 18px 18px; }
    .razcart-body { padding: 14px 16px; }
    .razcart-footer { padding: 14px 16px 18px; }

    /* На телефоні під опис лишається близько 120px, і назва позиції
       розповзається на три рядки. Порядковий номер там і так нічого не
       додає: позиції йдуть згори вниз, а впізнати свою допомагає саме
       картинка макета. Тож там, де картинка є, номер прибираємо —
       опис отримує ті 32px назад. Без картинки номер лишається. */
    .razcart-item--withthumb .razcart-item__num { display: none; }
}

@media (max-width: 420px) {
    .razcart-fab { bottom: 20px; left: 16px; width: 54px; height: 54px; }
    /* Тільки для кутового варіанта: у прив'язаного до шапки координати
       свої, і left:16px розтягнув би плашку через увесь екран. */
    .razcart-toast:not(.razcart-toast--anchored) { bottom: 90px; left: 16px; }
}
