/**
 * Стили корзины V2
 * /new/assets/css/cart.css
 */

/* Скрываем лишние элементы */
#new_header, .zone-title { display: none !important; }

.cart-v2 {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Пустая корзина */
.cart-v2-empty {
    text-align: center;
    padding: 80px 20px;
    background: var(--n0);
    border-radius: var(--r4);
}

.cart-v2-empty-icon {
    font-size: 72px;
    margin-bottom: 20px;
}

.cart-v2-empty h2 {
    font-size: 24px;
    color: var(--n9);
    margin-bottom: 10px;
}

.cart-v2-empty p {
    color: var(--n5);
    margin-bottom: 30px;
}

/* Заголовок */
.cart-v2-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--n9);
}

/* Товары */
.cart-v2-items {
    margin-bottom: 32px;
}

.cart-item {
    display: grid;
    grid-template-columns: 70px 1fr auto auto auto;
    gap: 16px;
    align-items: center;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--n2);
    border-radius: var(--r3);
    margin-bottom: 12px;
}

.cart-item-image img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: var(--r2);
    background: var(--n1);
}

.cart-item-name {
    font-weight: 500;
    color: var(--n9);
    text-decoration: none;
    display: block;
    margin-bottom: 6px;
    line-height: 1.3;
}

.cart-item-name:hover { color: var(--g5); }

.cart-item-price {
    font-size: 14px;
    color: var(--n5);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 4px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: var(--r2);
    cursor: pointer;
    font-size: 18px;
    color: var(--n9);
    transition: all 0.2s;
}

.qty-btn:hover {
    background: var(--n1);
    border-color: #ccc;
}

.qty-input {
    width: 44px;
    height: 32px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: var(--r2);
    font-size: 15px;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.cart-item-sum {
    font-weight: 600;
    font-size: 16px;
    color: var(--n9);
    min-width: 90px;
    text-align: right;
}

.cart-item-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: #bbb;
    font-size: 24px;
    cursor: pointer;
    border-radius: var(--r2);
    transition: all 0.2s;
}

.cart-item-remove:hover {
    background: #fee;
    color: var(--err);
}

/* ===== PROGRESS BAR ===== */
.checkout-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 16px 8px;
    background: #fff;
    border-radius: var(--r3);
    border: 1px solid var(--n2);
}
.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.progress-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    background: var(--n2);
    color: var(--n4);
    transition: all 0.3s;
}
.progress-label {
    font-size: 12px;
    color: var(--n4);
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.3s;
}
.progress-line {
    flex: 1;
    height: 2px;
    background: var(--n2);
    min-width: 20px;
    margin: 0 4px;
    margin-bottom: 22px;
    transition: background 0.3s;
}
.progress-step.active .progress-circle {
    background: var(--g5);
    color: #fff;
}
.progress-step.active .progress-label {
    color: var(--g5);
    font-weight: 600;
}
.progress-step.done .progress-circle {
    background: var(--g5);
    color: #fff;
}
.progress-step.done .progress-circle::after {
    content: "✓";
    font-size: 16px;
}
.progress-step.done .progress-circle {
    font-size: 0;
}
.progress-step.done .progress-label {
    color: var(--g5);
}
.progress-line.done {
    background: var(--g5);
}

/* Оформление заказа */
.checkout-v2 {
    background: var(--n0);
    border-radius: var(--r4);
    padding: 24px;
}

.checkout-step {
    background: #fff;
    border-radius: var(--r3);
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid var(--n2);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--n0);
    border-bottom: 1px solid var(--n2);
}

.step-number {
    width: 28px;
    height: 28px;
    background: var(--g5);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.step-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--n9);
}

.step-content {
    padding: 20px;
}

.step-desc {
    color: var(--n5);
    margin-bottom: 16px;
    font-size: 14px;
}

/* Форма телефона */
.phone-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.phone-input-wrap {
    flex: 1;
    position: relative;
}

.phone-input {
    width: 100%;
    padding: 14px 40px 14px 16px;
    border: 2px solid var(--n2);
    border-radius: var(--r3);
    font-size: 18px;
    letter-spacing: 1px;
    transition: border-color 0.2s;
}

.phone-input:focus {
    outline: none;
    border-color: var(--g5);
}

.clear-phone {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--n4);
    font-size: 20px;
    cursor: pointer;
    display: none;
}

.phone-input:not(:placeholder-shown) + .clear-phone {
    display: block;
}

.btn-send-code {
    padding: 14px 24px;
    background: var(--g5);
    color: #fff;
    border: none;
    border-radius: var(--r3);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-send-code:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-send-code:not(:disabled):hover {
    background: var(--g6);
}

/* Форма кода */
.code-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.code-desc {
    color: var(--n5);
    margin-bottom: 12px;
    font-size: 14px;
}

.code-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.code-digit {
    width: 50px;
    height: 56px;
    border: 2px solid var(--n2);
    border-radius: var(--r3);
    text-align: center;
    font-size: 24px;
    font-weight: 600;
}

.code-digit:focus {
    outline: none;
    border-color: var(--g5);
}

.code-error {
    color: var(--err);
    background: #ffebee;
    padding: 8px 12px;
    border-radius: var(--r2);
    font-size: 13px;
    margin-bottom: 10px;
}

.btn-verify-code {
    width: 100%;
    padding: 12px;
    background: var(--g5);
    color: #fff;
    border: none;
    border-radius: var(--r3);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background 0.2s;
}

.btn-verify-code:hover {
    background: var(--g6);
}

.btn-verify-code:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.code-timer {
    font-size: 13px;
    color: var(--n4);
}

/* Подтверждённый телефон */
.phone-confirmed {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #e8f5e9;
    border-radius: var(--r3);
}

.confirmed-icon {
    color: var(--g5);
    font-weight: 600;
    font-size: 18px;
}

.confirmed-text {
    flex: 1;
    color: var(--g6);
}

.change-phone {
    background: none;
    border: none;
    color: var(--g5);
    cursor: pointer;
    font-size: 14px;
}

/* Доставка */
.delivery-info {
    margin-bottom: 16px;
}

.delivery-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-size: 15px;
}

.delivery-icon {
    font-size: 18px;
}

.delivery-free {
    margin-left: auto;
    color: var(--g5);
    font-weight: 500;
}

/* Выбранная аптека */
.selected-store {
    background: var(--g0);
    border: 2px solid var(--g5);
    border-radius: var(--r3);
    padding: 16px;
    margin-bottom: 16px;
}

.store-ready {
    font-weight: 600;
    margin-bottom: 8px;
}

.store-ready.ready-today { color: var(--g5); }
.store-ready.ready-later { color: #f39c12; }

.store-address {
    font-size: 15px;
    color: var(--n9);
    margin-bottom: 8px;
}

.store-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--n5);
}

.store-sum {
    font-weight: 600;
    color: var(--n9);
    font-size: 16px;
}

.btn-select-store {
    width: 100%;
    padding: 14px;
    background: #fff;
    border: 2px solid var(--g5);
    border-radius: var(--r3);
    color: var(--g5);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-select-store:hover {
    background: var(--g5);
    color: #fff;
}

/* Модалка */
.store-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: var(--n1);
    border: none;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
}

.modal-search {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.modal-search input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: var(--r3);
    font-size: 15px;
}

.modal-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.store-group {
    margin-bottom: 20px;
}

.store-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--n5);
    margin-bottom: 12px;
    padding-left: 4px;
}

.store-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--n0);
    border-radius: var(--r3);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.store-option:hover {
    background: var(--g0);
    border-color: var(--g5);
}

.store-option.available { background: #f0fff4; }
.store-option.partial { background: #fffbf0; }

.store-option-address {
    font-weight: 500;
    color: var(--n9);
    margin-bottom: 4px;
}

.store-option-time {
    font-size: 13px;
    color: var(--n4);
}

.store-option-price {
    font-weight: 600;
    font-size: 16px;
    color: var(--n9);
}

/* Футер оформления */
.checkout-footer {
    margin-top: 24px;
    text-align: center;
}

.checkout-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #fff;
    border-radius: var(--r3);
    margin-bottom: 16px;
    font-size: 18px;
}

.total-sum {
    font-size: 24px;
    font-weight: 700;
    color: var(--g5);
}

.btn-submit {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--g5), var(--g4));
    color: #fff;
    border: none;
    border-radius: var(--r3);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-submit:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--sg);
}

.checkout-note {
    font-size: 12px;
    color: var(--n4);
    margin-top: 12px;
}

.btn-primary {
    display: inline-block;
    padding: 14px 32px;
    background: var(--g5);
    color: #fff;
    text-decoration: none;
    border-radius: var(--r3);
    font-weight: 500;
}

.hidden { display: none !important; }

.no-stores {
    padding: 20px;
    text-align: center;
    color: var(--n5);
    background: #f8f8f8;
    border-radius: var(--r3);
}

/* Адаптив */
@media (max-width: 640px) {
    .cart-v2 { padding: 12px; }
    
    .cart-item {
        grid-template-columns: 60px 1fr;
        grid-template-rows: auto auto;
        gap: 10px;
        position: relative;
        padding-right: 40px;
    }
    
    .cart-item-image img { width: 60px; height: 60px; }
    .cart-item-qty, .cart-item-sum { grid-column: 1 / -1; }
    .cart-item-remove {
        position: absolute;
        right: 8px;
        top: 8px;
    }
    
    .phone-form {
        flex-direction: column;
    }
    
    .btn-send-code { width: 100%; }
    
    .code-digit {
        width: 44px;
        height: 50px;
        font-size: 20px;
    }

    .checkout-progress {
        padding: 12px 4px;
        gap: 0;
    }
    .progress-label {
        font-size: 10px;
    }
    .progress-circle {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    .progress-line {
        min-width: 12px;
    }
    .confirm-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .confirm-value {
        text-align: left;
    }

    .modal-content {
        max-height: 90vh;
        border-radius: var(--r4) 16px 0 0;
    }
}

/* Кнопка повторной отправки */
.btn-resend {
    background: none;
    border: none;
    color: var(--c5);
    cursor: pointer;
    font-size: 14px;
    padding: 5px 0;
    text-decoration: underline;
}
.btn-resend:hover {
    color: var(--c4);
}

/* Выбор города */
.city-link {
    color: var(--c5);
    text-decoration: underline;
    cursor: pointer;
}
.city-link:hover {
    color: var(--c4);
}
.city-list {
    max-height: 400px;
    overflow-y: auto;
}
.city-option {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}
.city-option:hover {
    background: var(--n1);
}
.city-option.active {
    background: #e3f2fd;
    font-weight: 600;
}
.city-option.active::after {
    content: " ✓";
    color: var(--g5);
}

/* === Упрощённая корзина: одна аптека === */

.ready-partial {
    color: #ff9800;
    background: #fff3e0;
}

.unavailable-warning {
    background: #fff3e0;
    border: 1px solid #ff9800;
    border-radius: var(--r2);
    padding: 12px 16px;
    margin: 16px 0;
}

.unavailable-warning .warning-title {
    font-weight: 600;
    color: #e65100;
    margin-bottom: 8px;
}

.unavailable-warning .warning-list {
    margin: 0;
    padding-left: 20px;
    color: var(--n5);
    font-size: 14px;
}

.unavailable-warning .warning-list li {
    margin: 4px 0;
}

.store-option-stock {
    font-size: 12px;
    color: #ff9800;
    margin-top: 4px;
}


/* === Состав заказа === */

.order-summary {
    background: var(--n0);
    border: 1px solid var(--n2);
    border-radius: var(--r2);
    padding: 16px;
    margin: 16px 0;
}

.order-summary.hidden {
    display: none;
}

.order-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.order-summary-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--n9);
}

.order-summary-items {
    font-size: 14px;
}

.order-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

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

.order-summary-item-name {
    flex: 1;
    color: var(--n9);
}

.order-summary-item-qty {
    color: var(--n5);
    margin: 0 12px;
    white-space: nowrap;
}

.order-summary-item-sum {
    font-weight: 500;
    white-space: nowrap;
}

.order-summary-item.partial .order-summary-item-qty {
    color: #ff9800;
}

.order-summary-item.unavailable {
    opacity: 0.5;
    text-decoration: line-through;
}

.order-summary-note {
    font-size: 12px;
    color: var(--n4);
    margin-top: 12px;
    font-style: italic;
}

.warning-section {
    margin-bottom: 8px;
}

.warning-section:last-child {
    margin-bottom: 0;
}


/* === Скрытие кнопки минус при qty=1 === */

.qty-btn-hidden {
    visibility: hidden;
    pointer-events: none;
}



/* Уведомление о лимите наличия */
.stock-limit-notice {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff9800;
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--r2);
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.stock-limit-notice.visible {
    opacity: 1;
}

/* ===== СПОСОБ ОПЛАТЫ ===== */
.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.payment-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid var(--n2);
    border-radius: var(--r3);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
}
.payment-option:hover {
    border-color: #b0bec5;
}
.payment-option.selected {
    border-color: var(--g5);
    background: var(--g0);
}
.payment-option input[type="radio"] {
    display: none;
}
.payment-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}
.payment-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.payment-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--n9);
}
.payment-desc {
    font-size: 13px;
    color: var(--n4);
}
/* Онлайн-оплата заглушка */
.payment-option.disabled {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid var(--n2);
    border-radius: var(--r3);
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
    user-select: none;
}
.payment-badge-soon {
    background: #ff9800;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

/* ===== ШАГ 4: ПОДТВЕРЖДЕНИЕ ===== */
.confirm-summary {
    margin-bottom: 16px;
}
.confirm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}
.confirm-row:last-child {
    border-bottom: none;
}
.confirm-label {
    font-size: 14px;
    color: var(--n5);
}
.confirm-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--n9);
    text-align: right;
}

@media (max-width: 600px) {
    .payment-option {
        padding: 12px 14px;
        gap: 10px;
    }
    .payment-icon {
        font-size: 24px;
        width: 32px;
    }
    .payment-name {
        font-size: 14px;
    }
}

/* ===== Нет моего города ===== */
.intercity-block {
    margin-top: 16px;
    border-top: 1px solid #eee;
    padding-top: 14px;
}
.intercity-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    user-select: none;
}
.intercity-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--c5);
    flex-shrink: 0;
    cursor: pointer;
}
.intercity-form {
    margin-top: 14px;
    padding: 16px;
    background: var(--g0);
    border-radius: var(--r3);
    border: 1px solid #bbdefb;
}
.intercity-hint {
    font-size: 13px;
    color: #555;
    margin: 0 0 12px;
}
.intercity-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}
.intercity-field label {
    display: block;
    font-size: 12px;
    color: #777;
    margin-bottom: 4px;
}
.intercity-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c5d8ec;
    border-radius: var(--r2);
    font-size: 15px;
    box-sizing: border-box;
    background: #fff;
}
.intercity-field input:focus {
    outline: none;
    border-color: var(--c5);
    box-shadow: 0 0 0 3px rgba(0,180,98,.1);
}
.btn-intercity-submit {
    width: 100%;
    padding: 12px;
    background: var(--c5);
    color: #fff;
    border: none;
    border-radius: var(--r2);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.btn-intercity-submit:hover:not(:disabled) { background: var(--c4); }
.btn-intercity-submit:disabled { background: #90caf9; cursor: default; }
.intercity-result {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--r2);
    font-size: 14px;
}
.intercity-result--error {
    background: #ffebee;
    color: var(--err);
    border: 1px solid #ef9a9a;
}
.intercity-success {
    color: var(--g6);
    font-weight: 600;
    font-size: 15px;
    margin: 0;
}

/* Товар не в наличии (цена = 0) */
.cart-item-unavailable {
    opacity: 0.6;
    background: #fafafa;
    border-color: #eee;
}
.cart-item-no-price {
    color: #d32f2f;
    font-size: 13px;
    font-weight: 500;
}
