/* ============================================================
   Триггер доставки — компактная строка без рамки
   ============================================================ */

.delivery-trigger-compact {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    min-height: 28px;
    box-sizing: border-box;
    margin-top: 4px;
    padding: 2px 0;

    background: transparent;
    border: none;
    border-radius: 0;

    cursor: pointer;
    user-select: none;
    text-decoration: none;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.3;
    color: #4d4d4d;
    white-space: nowrap;
    text-align: left;

    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.delivery-trigger-compact:hover {
    opacity: 1;
}

.delivery-trigger-compact:active {
    opacity: 0.8;
}

.delivery-trigger-compact:focus-visible {
    outline: 2px solid #ffed4e;
    outline-offset: 2px;
    border-radius: 4px;
}

.delivery-trigger-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    position: relative;
    min-height: 20px;
}

/* Иконка грузовика + текст «Доставка» */
.delivery-trigger-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #4d4d4d;
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.delivery-trigger-label::before {
    content: "";
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-color: #e6d400;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 3h15v13H1zM16 8h4l3 3v5h-7V8zM5.5 21a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zM18.5 21a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z'/></svg>") center/contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 3h15v13H1zM16 8h4l3 3v5h-7V8zM5.5 21a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zM18.5 21a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z'/></svg>") center/contain no-repeat;
    transition: background-color 0.15s ease;
}

/* Точки-«чек» больше не нужны */
.delivery-trigger-dots {
    display: none;
}

.delivery-trigger-right {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
}

/* Сумма на фирменной плашке */
.delivery-trigger-value {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #ffed4e;
    color: #111827;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.1;
    white-space: nowrap;
}

.delivery-trigger-value-free {
    background: #d1fae5;
    color: #065f46;
}

.delivery-trigger-value-empty {
    background: #f3f4f6;
    color: #6b7280;
    font-style: normal;
    font-weight: 500;
}

/* Стрелка справа */
.delivery-trigger-arrow {
    color: #c0c4c9;
    flex-shrink: 0;
    transition: transform 0.15s ease, color 0.15s ease;
}

.delivery-trigger-compact:hover .delivery-trigger-arrow {
    color: #111827;
    transform: translateX(2px);
}

.delivery-trigger-compact:hover .delivery-trigger-label {
    color: #111827;
}

.delivery-trigger-compact:hover .delivery-trigger-label::before {
    background-color: #111827;
}

@media (max-width: 480px) {
    .delivery-trigger-compact {
        min-height: 26px;
        font-size: 12px;
        gap: 4px;
    }

    .delivery-trigger-label {
        font-size: 12px;
        gap: 4px;
    }

    .delivery-trigger-label::before {
        width: 14px;
        height: 14px;
    }

    .delivery-trigger-value {
        font-size: 12px;
        padding: 2px 7px;
    }
}

/* ============================================================
   Переменные
   ============================================================ */

:root {
    --color-yellow: #ffea00;
    --color-yellow-light: #fff8cc;
    --color-yellow-dark: #e6d300;
    --color-brand: #ffed4e;
    --color-brand-dark: #e6d400;
    --color-success: #10b981;
    --color-info: #3b82f6;
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;
    --color-black: #000000;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Сброс только внутри модалки доставки */
.delivery-modal,
.delivery-modal * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================================
   Модалка доставки
   ============================================================ */

.delivery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.delivery-modal.is-open {
    display: block;
}

.delivery-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: deliveryFadeIn 0.2s ease;
}

@keyframes deliveryFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.delivery-modal__container {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 600px;
    height: 100%;
    background: #f9fafb;
    animation: deliverySlideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes deliverySlideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.delivery-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

/* Шапка — липкая */
.delivery-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid var(--color-gray-200);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
}

.delivery-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-gray-100);
    border: none;
    border-radius: var(--radius);
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-right: 12px;
}

.delivery-back:hover {
    background: var(--color-brand);
    color: #111827;
}

.delivery-header__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-gray-900);
    flex: 1;
    line-height: 1.2;
}

.delivery-header__empty {
    width: 40px;
    flex-shrink: 0;
}

.delivery-product-info {
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid var(--color-gray-200);
    flex-shrink: 0;
}

.delivery-product-info__name {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-gray-600);
    margin-bottom: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.delivery-product-info__price {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-gray-900);
}

.delivery-main-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #f9fafb;
}

.delivery-list-compact {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

/* ============================================================
   Карточка метода доставки
   ============================================================ */

.delivery-card {
    padding: 16px;
    background: white;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    display: flex;
    gap: 14px;
    position: relative;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.delivery-card:hover {
    border-color: var(--color-gray-300);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.delivery-card.is-popular {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(255, 237, 78, 0.18);
}

.delivery-card.is-popular:hover {
    border-color: var(--color-brand-dark);
    box-shadow: 0 0 0 3px rgba(255, 237, 78, 0.28), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.delivery-card__logo {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
}

.delivery-card__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
}

.delivery-card__main {
    flex: 1;
    min-width: 0;
}

.delivery-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.delivery-card__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1.3;
}

.delivery-card__popular {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--color-brand);
    color: #111827;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.delivery-card__popular::before {
    content: "";
    width: 10px;
    height: 10px;
    background-color: #111827;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M13.5 0.67s0.74 2.65 0.74 4.8c0 2.06-1.35 3.73-3.41 3.73-2.07 0-3.63-1.67-3.63-3.73l0.03-0.36C5.21 7.51 4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 17.41 3.8 13.5 0.67zM11.71 19c-1.78 0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 1.77-0.36 3.6-1.21 4.62-2.58 0.39 1.29 0.59 2.65 0.59 4.04 0 2.65-2.15 4.8-4.8 4.8z'/></svg>") center/contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M13.5 0.67s0.74 2.65 0.74 4.8c0 2.06-1.35 3.73-3.41 3.73-2.07 0-3.63-1.67-3.63-3.73l0.03-0.36C5.21 7.51 4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 17.41 3.8 13.5 0.67zM11.71 19c-1.78 0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 1.77-0.36 3.6-1.21 4.62-2.58 0.39 1.29 0.59 2.65 0.59 4.04 0 2.65-2.15 4.8-4.8 4.8z'/></svg>") center/contain no-repeat;
}

.delivery-card__price {
    font-size: 17px;
    font-weight: 800;
    color: var(--color-gray-900);
    white-space: nowrap;
    line-height: 1.2;
}

.delivery-card__price.is-free {
    color: var(--color-success);
}

.delivery-card__price.is-empty {
    color: var(--color-gray-500);
    font-style: italic;
    font-weight: 500;
    font-size: 14px;
}

.delivery-card__details {
    margin-bottom: 12px;
}

.delivery-card__description {
    font-size: 13px;
    color: var(--color-gray-600);
    line-height: 1.5;
    margin-bottom: 10px;
}

.delivery-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.delivery-card__time,
.delivery-card__area {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    color: var(--color-gray-700);
    background: var(--color-gray-100);
    padding: 4px 10px;
    border-radius: 999px;
    line-height: 1.3;
}

.delivery-card__time svg,
.delivery-card__area svg {
    margin-right: 4px;
    flex-shrink: 0;
    color: var(--color-gray-500);
}

/* ============================================================
   Блок «Бесплатно от N руб»
   ============================================================ */

.delivery-card__free {
    margin-bottom: 12px;
}

.delivery-card__free-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #d1fae5;
    color: #065f46;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    line-height: 1.3;
}

.delivery-card__free-from {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fffbe0;
    color: #111827;
    font-size: 12px;
    font-weight: 600;
    padding: 10px 12px;
    border-radius: 8px;
    line-height: 1.3;
    border: 1px solid rgba(255, 237, 78, 0.6);
}

.delivery-card__free-from::before {
    content: "До бесплатной доставки";
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.delivery-card__free-progress {
    height: 4px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.delivery-card__free-progress-bar {
    height: 100%;
    background: var(--color-brand);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ============================================================
   Ссылка «Подробнее»
   ============================================================ */

.delivery-card__link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-gray-700);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    background: white;
}

.delivery-card__link:hover {
    background: var(--color-gray-50);
    border-color: var(--color-gray-400);
    color: var(--color-gray-900);
}

.delivery-card__link svg {
    stroke: currentColor;
    fill: none;
    width: 14px;
    height: 14px;
}

/* ============================================================
   Общая информация — аккордеон (<details>)
   ============================================================ */

.delivery-general-info {
    margin: 0 16px 16px;
    padding: 0;
    background: white;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.delivery-general-info__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-gray-900);
    padding: 14px 16px;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    user-select: none;
}

.delivery-general-info__title::-webkit-details-marker {
    display: none;
}

.delivery-general-info__title::after {
    content: "";
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    background-color: var(--color-gray-500);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/></svg>") center/contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/></svg>") center/contain no-repeat;
    transition: transform 0.2s ease;
}

.delivery-general-info[open] .delivery-general-info__title::after {
    transform: rotate(180deg);
}

.delivery-general-info__list {
    list-style: none;
    padding: 0 16px 14px;
    border-top: 1px solid var(--color-gray-100);
    margin: 0;
}

.delivery-general-info__list li {
    position: relative;
    padding-left: 20px;
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-gray-700);
}

.delivery-general-info__list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-brand);
}

/* ============================================================
   Адаптивность
   ============================================================ */

@media (max-width: 768px) {
    .delivery-modal__container {
        max-width: 100%;
    }

    .delivery-header {
        padding: 12px 16px;
    }

    .delivery-back {
        width: 36px;
        height: 36px;
        margin-right: 10px;
    }

    .delivery-header__title {
        font-size: 16px;
    }

    .delivery-product-info {
        padding: 10px 16px;
    }

    .delivery-list-compact {
        padding: 12px;
        gap: 10px;
    }

    .delivery-card {
        padding: 14px;
        gap: 12px;
    }

    .delivery-card__logo {
        width: 48px;
        height: 48px;
    }

    .delivery-card__title {
        font-size: 14px;
    }

    .delivery-card__price {
        font-size: 16px;
    }

    .delivery-general-info {
        margin: 0 12px 12px;
    }
}

@media (max-width: 480px) {
    .delivery-header {
        padding: 10px 12px;
    }

    .delivery-back {
        width: 32px;
        height: 32px;
        margin-right: 8px;
    }

    .delivery-header__title {
        font-size: 15px;
    }

    .delivery-list-compact {
        padding: 10px;
        gap: 10px;
    }

    .delivery-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 14px;
    }

    .delivery-card__logo {
        width: 40px;
        height: 40px;
    }

    .delivery-card__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .delivery-card__price {
        font-size: 15px;
    }

    .delivery-general-info {
        margin: 0 10px 10px;
    }
}

/* ============================================================
   Пустое состояние
   ============================================================ */

.delivery-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--color-gray-500);
    font-size: 14px;
    line-height: 1.5;
}

.delivery-empty svg {
    width: 48px;
    height: 48px;
    color: var(--color-gray-300);
    margin-bottom: 12px;
}

.delivery-modal-open {
    overflow: hidden;
}

@media (hover: none) and (pointer: coarse) {
    .delivery-card__link:active {
        opacity: 0.7;
    }
}

@media (prefers-reduced-motion: reduce) {
    .delivery-modal__overlay,
    .delivery-modal__container,
    .delivery-card,
    .delivery-general-info__title::after {
        animation: none !important;
        transition: none !important;
    }
}