/* ============================================================
   Delivery Partner Selection — Cart Sidebar
   Scoped to #deliveryServiceSelection so it doesn't leak.
   Existing IDs preserved: #chkOneDelivery, #chkDeliveryDost,
   #oneDeliveryRate, #deliveryDostRate, #btnBidding.
   ============================================================ */

#deliveryServiceSelection.delivery-section {
    margin: 14px 0 10px;
    padding: 0;
    background: transparent;
}

#deliveryServiceSelection .delivery-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

#deliveryServiceSelection .delivery-section-title::before {
    content: "\f48b"; /* fa-truck-fast */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #16a34a;
    font-size: 14px;
}

/* ----- Tile (delivery-option-row) ----- */
#deliveryServiceSelection .delivery-option-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    transition: all 0.18s ease;
    cursor: pointer;
}

#deliveryServiceSelection .delivery-option-row:hover {
    border-color: #16a34a;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.08);
}

#deliveryServiceSelection .delivery-option-row.disabled {
    opacity: 0.55;
    pointer-events: none;
    background: #f9fafb;
}

/* Icon avatar on the left */
#deliveryServiceSelection .delivery-option-row::before {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 16px;
}

#deliveryOptionOneDelivery::before {
    content: "\f0e7"; /* fa-bolt */
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #b45309;
}

#deliveryOptionDeliveryDost::before {
    content: "\f48b"; /* fa-truck-fast */
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1d4ed8;
}

#deliveryOptionDelhivery::before {
    content: "\f0d1"; /* fa-truck */
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #b91c1c;
}

#deliveryOptionShiprocket::before {
    content: "\f197"; /* fa-rocket */
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #6d28d9;
}

#deliveryOptionBorzo::before {
    content: "\f21c"; /* fa-motorcycle */
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #b45309;
}

#deliveryServiceSelection .delivery-section-subtitle {
    font-size: 10.5px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 14px 0 8px;
    padding-top: 12px;
    border-top: 1px dashed #e5e7eb;
    display: flex;
    align-items: center;
    gap: 6px;
}

#deliveryServiceSelection .delivery-section-subtitle::before {
    content: "\f0ac"; /* fa-globe */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #9ca3af;
    font-size: 11px;
}

/* Middle content block */
#deliveryServiceSelection .delivery-checkbox-label {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    cursor: pointer;
    min-width: 0;
}

#deliveryServiceSelection .delivery-option-text {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    line-height: 1.2;
}

#deliveryServiceSelection .delivery-option-sub {
    font-size: 11.5px;
    color: #6b7280;
    line-height: 1.3;
}

/* Recommended / fastest badge */
#deliveryServiceSelection .delivery-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

#deliveryServiceSelection .delivery-badge.badge-recommended {
    background: #dcfce7;
    color: #15803d;
}

#deliveryServiceSelection .delivery-badge.badge-bidding {
    background: #fef3c7;
    color: #b45309;
}

/* Right side: rate + custom radio */
#deliveryServiceSelection .delivery-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

#deliveryServiceSelection .delivery-rate {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    min-width: 42px;
    text-align: right;
}

#deliveryServiceSelection .delivery-rate:empty::before {
    content: "—";
    color: #9ca3af;
    font-weight: 500;
}

/* Hide native checkbox, render custom radio dot */
#deliveryServiceSelection input[type="checkbox"][name="deliveryService"] {
    position: absolute;
    opacity: 0;
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    z-index: 2;
}

#deliveryServiceSelection .delivery-radio {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: #ffffff;
    flex-shrink: 0;
    position: relative;
    transition: all 0.15s ease;
}

#deliveryServiceSelection .delivery-option-row:has(input:checked) {
    border-color: #16a34a;
    background: #f0fdf4;
    box-shadow: 0 2px 10px rgba(22, 163, 74, 0.12);
}

#deliveryServiceSelection .delivery-option-row:has(input:checked) .delivery-radio {
    border-color: #16a34a;
    background: #16a34a;
}

#deliveryServiceSelection .delivery-option-row:has(input:checked) .delivery-radio::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
    transform: translate(-50%, -50%);
}

/* Fallback for browsers without :has() — uses .is-selected class set via JS later if needed */
#deliveryServiceSelection .delivery-option-row.is-selected {
    border-color: #16a34a;
    background: #f0fdf4;
    box-shadow: 0 2px 10px rgba(22, 163, 74, 0.12);
}

#deliveryServiceSelection .delivery-option-row.is-selected .delivery-radio {
    border-color: #16a34a;
    background: #16a34a;
}

#deliveryServiceSelection .delivery-option-row.is-selected .delivery-radio::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
    transform: translate(-50%, -50%);
}

/* Bidding CTA button inside DeliveryDost tile */
#deliveryServiceSelection .btn-bidding {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 12px;
    border: none;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #ffffff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
    box-shadow: 0 2px 6px rgba(29, 78, 216, 0.25);
}

#deliveryServiceSelection .btn-bidding:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(29, 78, 216, 0.35);
}

#deliveryServiceSelection .btn-bidding:disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.85;
}

#deliveryServiceSelection .btn-bidding::after {
    content: "\f061"; /* fa-arrow-right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 10px;
}

/* ============================================================
   Courier Options Modal — list multiple plans for one provider
   ============================================================ */
.courier-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}

.courier-modal-overlay.is-open {
    display: flex !important;
}

.courier-modal {
    background: #ffffff;
    border-radius: 14px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.courier-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

.courier-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0 4px;
}

.courier-modal-close:hover { color: #111827; }

.courier-modal-body {
    padding: 12px 14px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.courier-option-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.courier-option-card:hover { border-color: #16a34a; background: #f9fafb; }

.courier-option-card.is-selected {
    border-color: #16a34a;
    background: #f0fdf4;
}

.courier-option-card input[type="radio"] {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    accent-color: #16a34a;
    cursor: pointer;
}

.courier-option-card .opt-info {
    flex: 1 1 auto;
    min-width: 0;
}

.courier-option-card .opt-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    line-height: 1.3;
}

.courier-option-card .opt-meta {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.courier-option-card .opt-meta .badge-cheap {
    display: inline-block;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    background: #dcfce7;
    color: #15803d;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

.courier-option-card .opt-meta .badge-fast {
    display: inline-block;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

.courier-option-card .opt-price {
    flex: 0 0 auto;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    text-align: right;
}

.courier-modal-empty {
    padding: 24px 12px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
}

.courier-modal-footer {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.courier-modal-cancel,
.courier-modal-confirm {
    flex: 1 1 0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.courier-modal-cancel {
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.courier-modal-cancel:hover { background: #f3f4f6; }

.courier-modal-confirm {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #ffffff;
}

.courier-modal-confirm:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35);
}

.courier-modal-confirm:disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}

/* Stack badge + meta neatly on small widths (cart sidebar can get narrow) */
@media (max-width: 360px) {
    #deliveryServiceSelection .delivery-option-row {
        padding: 10px 12px;
        gap: 10px;
    }
    #deliveryServiceSelection .delivery-option-row::before {
        flex-basis: 30px;
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    #deliveryServiceSelection .delivery-rate { font-size: 14px; min-width: 36px; }
    #deliveryServiceSelection .delivery-option-text { font-size: 13px; }
}
