/**
 * City-Based Delivery Calculator Styles
 * WhatsApp Order Styles
 * Cash on Delivery Styles
 *
 * @package 24hpneus
 * @since 2.1.0
 */

/* ==========================================
   City Delivery Select Field
   ========================================== */

.delivery-city-select,
select#billing_city {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color, #E5E5E5);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-main, #1D1D1D);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 20px 20px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.delivery-city-select:hover,
select#billing_city:hover {
    border-color: var(--primary, #E63946);
}

.delivery-city-select:focus,
select#billing_city:focus {
    outline: none;
    border-color: var(--primary, #E63946);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

/* ==========================================
   Delivery City Info Box
   ========================================== */

.delivery-city-info {
    margin-top: 10px;
    padding: 12px 15px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 8px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.delivery-info-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.delivery-info-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary, #E63946);
    border-radius: 50%;
    color: #fff;
}

.delivery-info-icon svg {
    width: 16px;
    height: 16px;
}

.delivery-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary, #E63946);
}

.delivery-price.free {
    color: var(--success, #31A56D);
    background: rgba(49, 165, 109, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
}

.delivery-delay {
    font-size: 13px;
    color: var(--text-light, #666);
}

/* ==========================================
   Free Shipping Notice
   ========================================== */

.free-shipping-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fbbf24;
    border-radius: 10px;
    color: #92400e;
    font-size: 14px;
    font-weight: 500;
}

.free-shipping-notice svg {
    flex-shrink: 0;
    color: #d97706;
}

.free-shipping-notice.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #34d399;
    color: #065f46;
}

.free-shipping-notice.success svg {
    color: #10b981;
}

/* ==========================================
   WhatsApp Order Button
   ========================================== */

.whatsapp-order-section {
    margin-top: 25px;
    text-align: center;
}

.whatsapp-separator {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.whatsapp-separator::before,
.whatsapp-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color, #E5E5E5);
}

.whatsapp-separator span {
    padding: 0 15px;
    color: var(--text-light, #666);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.whatsapp-order-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Filled Style (Default) */
.whatsapp-btn-filled {
    background: #25D366;
    color: #fff;
}

.whatsapp-btn-filled:hover {
    background: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.35);
}

/* Outlined Style */
.whatsapp-btn-outlined {
    background: transparent;
    border: 2px solid #25D366;
    color: #25D366;
}

.whatsapp-btn-outlined:hover {
    background: #25D366;
    color: #fff;
}

/* Minimal Style */
.whatsapp-btn-minimal {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.whatsapp-btn-minimal:hover {
    background: #dcfce7;
    border-color: #86efac;
}

.whatsapp-icon {
    width: 24px;
    height: 24px;
}

.whatsapp-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-light, #666);
}

/* ==========================================
   WhatsApp Floating Button
   ========================================== */

.whatsapp-floating-btn {
    position: fixed;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
}

.whatsapp-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(37, 211, 102, 0.5);
}

.whatsapp-floating-btn.position-bottom-right {
    bottom: 25px;
    right: 25px;
}

.whatsapp-floating-btn.position-bottom-left {
    bottom: 25px;
    left: 25px;
}

/* Mobile adjustment for floating button */
@media (max-width: 768px) {
    .whatsapp-floating-btn {
        width: 55px;
        height: 55px;
        bottom: 20px;
    }

    .whatsapp-floating-btn.position-bottom-right {
        right: 15px;
    }

    .whatsapp-floating-btn.position-bottom-left {
        left: 15px;
    }
}

/* ==========================================
   Payment Methods Styling (All)
   ========================================== */

.woocommerce-checkout-payment .payment_methods,
.wc_payment_methods {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 20px 0 !important;
}

.woocommerce-checkout-payment .payment_methods > li,
.wc_payment_methods > li {
    position: relative;
    margin-bottom: 10px !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 10px !important;
    overflow: hidden;
    background: #fff !important;
}

/* Radio input - position inside the box inline with label */
.woocommerce-checkout-payment .payment_methods > li > input[type="radio"],
.wc_payment_methods > li > input[type="radio"] {
    position: absolute !important;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
    width: 20px !important;
    height: 20px !important;
    accent-color: #2563eb !important;
    margin: 0 !important;
    z-index: 2;
    cursor: pointer;
}

/* Adjust for payment_box visible state */
.woocommerce-checkout-payment .payment_methods > li:has(.payment_box:not([style*="display: none"])) > input[type="radio"],
.wc_payment_methods > li:has(.payment_box:not([style*="display: none"])) > input[type="radio"] {
    top: 24px;
    transform: none;
}

.woocommerce-checkout-payment .payment_methods > li > label,
.wc_payment_methods > li > label {
    display: block !important;
    padding: 16px 18px 16px 50px !important;
    margin: 0 !important;
    background: #fff !important;
    cursor: pointer;
    font-weight: 500;
    color: #374151 !important;
    line-height: 1.4;
}

/* Selected payment method */
.woocommerce-checkout-payment .payment_methods > li:has(input:checked),
.wc_payment_methods > li:has(input:checked) {
    border-color: #2563eb !important;
    background: #f0f7ff !important;
}

.woocommerce-checkout-payment .payment_methods > li:has(input:checked) > label,
.wc_payment_methods > li:has(input:checked) > label {
    background: transparent !important;
    color: #1e40af !important;
}

/* Payment box (description) */
.woocommerce-checkout-payment .payment_box,
.wc_payment_methods .payment_box {
    padding: 15px 18px 15px 50px !important;
    margin: 0 !important;
    background: #f8fafc !important;
    border-top: 1px solid #e5e7eb !important;
    font-size: 13px;
    line-height: 1.6;
    color: #64748b !important;
}

.woocommerce-checkout-payment .payment_methods > li:has(input:checked) .payment_box,
.wc_payment_methods > li:has(input:checked) .payment_box {
    background: #eef6ff !important;
    border-top-color: #bfdbfe !important;
    color: #1e40af !important;
}

.woocommerce-checkout-payment .payment_box p,
.wc_payment_methods .payment_box p {
    margin: 0;
}

/* COD Fee Notice */
.cod-fee-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    background: #fef9c3;
    border-radius: 6px;
    font-size: 12px;
    color: #854d0e;
}

.cod-fee-notice svg {
    flex-shrink: 0;
}

/* Place order button */
#place_order {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    background: var(--primary, #E63946);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

#place_order:hover {
    background: var(--primary-dark, #c62828);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

/* ==========================================
   Order Review Delivery Fee Row
   ========================================== */

.woocommerce-checkout-review-order-table .fee th,
.woocommerce-checkout-review-order-table .fee td {
    padding-top: 12px;
    padding-bottom: 12px;
}

.woocommerce-checkout-review-order-table .fee th {
    font-weight: 500;
    color: var(--text-main, #1D1D1D);
}

/* Highlight delivery fee */
tr.fee[class*="livraison"] td,
tr.fee[class*="delivery"] td {
    color: var(--primary, #E63946);
    font-weight: 600;
}

/* Free delivery highlight */
.delivery-free-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: var(--success, #31A56D);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
}

/* ==========================================
   Checkout City Field Wrapper
   ========================================== */

.form-row.delivery-city-select {
    margin-bottom: 5px;
}

.form-row.delivery-city-select + .delivery-city-info {
    margin-bottom: 20px;
}

/* ==========================================
   Loading State for City Select
   ========================================== */

.delivery-city-select.loading {
    pointer-events: none;
    opacity: 0.7;
}

.delivery-city-select.loading::after {
    content: '';
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* ==========================================
   Checkout Loading Overlay
   ========================================== */

.checkout-loading {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.checkout-loading.active {
    opacity: 1;
    visibility: visible;
}

.checkout-loading .loader {
    text-align: center;
}

.checkout-loading .spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color, #E5E5E5);
    border-top-color: var(--primary, #E63946);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

.checkout-loading .loader p {
    color: var(--text-main, #1D1D1D);
    font-weight: 500;
}

/* ==========================================
   Admin Delivery Info Display
   ========================================== */

.delivery-info-admin {
    margin-top: 20px;
    padding: 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.delivery-info-admin h3 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.delivery-info-admin p {
    margin: 5px 0;
    font-size: 13px;
    color: #64748b;
}

.delivery-info-admin p strong {
    color: #334155;
}

/* ==========================================
   Responsive Adjustments
   ========================================== */

@media (max-width: 768px) {
    .delivery-city-info {
        padding: 10px 12px;
    }

    .delivery-info-content {
        gap: 8px;
        flex-wrap: wrap;
    }

    .delivery-info-icon {
        width: 28px;
        height: 28px;
    }

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

    .free-shipping-notice {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .whatsapp-order-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}

@media (max-width: 575px) {
    .delivery-city-info {
        padding: 10px;
        margin-top: 8px;
    }

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

    .delivery-info-icon {
        width: 24px;
        height: 24px;
        display: none;
    }

    .delivery-price {
        font-size: 13px;
        word-break: break-word;
    }

    .delivery-price-breakdown {
        font-size: 11px;
        display: block;
        margin-top: 2px;
    }

    .delivery-delay {
        font-size: 11px;
    }

    .delivery-free-badge {
        font-size: 11px;
        padding: 2px 8px;
    }
}

@media (max-width: 400px) {
    .delivery-city-info {
        padding: 8px;
        border-radius: 6px;
    }

    .delivery-price {
        font-size: 12px;
    }

    .delivery-delay,
    .delivery-price-breakdown {
        font-size: 10px;
    }
}

/* ==========================================
   Animation Classes
   ========================================== */

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   Print Styles
   ========================================== */

@media print {
    .whatsapp-floating-btn,
    .whatsapp-order-section {
        display: none !important;
    }
}

/* ==========================================
   Store Search Options (Montage)
   ========================================== */

.store-search-options {
    margin-top: 15px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.store-search-title {
    margin: 0 0 15px;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    text-align: center;
}

/* City Select Dropdown */
.store-city-select-wrapper {
    margin-bottom: 15px;
}

.montage-city-select {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 20px 20px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.montage-city-select:hover {
    border-color: var(--primary, #E63946);
}

.montage-city-select:focus {
    outline: none;
    border-color: var(--primary, #E63946);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

/* Separator */
.store-search-separator {
    display: flex;
    align-items: center;
    margin: 15px 0;
}

.store-search-separator::before,
.store-search-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.store-search-separator span {
    padding: 0 15px;
    color: #9ca3af;
    font-size: 13px;
    text-transform: uppercase;
}

/* Geolocation Button */
.btn-use-location {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-use-location:hover {
    border-color: var(--primary, #E63946);
    color: var(--primary, #E63946);
}

.btn-use-location.loading {
    opacity: 0.7;
    pointer-events: none;
}

.btn-use-location svg {
    flex-shrink: 0;
}

/* Stores Loading */
.stores-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    margin-top: 15px;
    color: #6b7280;
    font-size: 14px;
    background: #f8fafc;
    border-radius: 8px;
}

.stores-search-loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--primary, #E63946);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Stores List Container */
.stores-list-container {
    margin-top: 15px;
}

.stores-list-title {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.stores-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

/* Store Item */
.store-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 15px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: border-color 0.2s, background 0.2s;
}

.store-item:hover {
    border-color: var(--primary, #E63946);
    background: #fef2f2;
}

.store-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.store-info .store-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.store-info .store-address {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.store-info .store-distance {
    font-size: 12px;
    color: var(--primary, #E63946);
    font-weight: 500;
}

.store-info .store-phone {
    font-size: 12px;
    color: #9ca3af;
}

.store-select-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    background: var(--primary, #E63946);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.store-select-btn:hover {
    background: var(--primary-dark, #c62828);
    transform: translateY(-1px);
}

/* No Results */
.stores-no-results {
    padding: 20px;
    margin-top: 15px;
    text-align: center;
    color: #92400e;
    font-size: 14px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
}

.stores-no-results p {
    margin: 0;
}

/* Responsive */
@media (max-width: 480px) {
    .store-search-options {
        padding: 15px;
    }

    .store-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .store-select-btn {
        width: 100%;
        text-align: center;
    }
}
