/**
 * Frontend styles for State-Wise Delivery Pricing popup and floating badge
 */

:root {
    --swdp-primary: var(--e-global-color-primary, #532DB6);
    --swdp-primary-hover: var(--e-global-color-secondary, #FF8A00);
    --swdp-green: var(--e-global-color-secondary, #FF8A00);
    --swdp-green-hover: var(--e-global-color-primary, #532DB6);
    --swdp-text-main: var(--e-global-color-text, #24212C);
    --swdp-text-muted: var(--e-global-color-750cd12, #64748b);
    --swdp-bg-modal: #ffffff;
    --swdp-border: var(--e-global-color-005c559, #cbd5e1);
}

/* Modal Overlay */
.swdp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.swdp-modal-overlay.swdp-show {
    opacity: 1;
    visibility: visible;
}

/* Modal Card */
.swdp-modal-card {
    --swdp-bg-modal: #003f63;
    --swdp-text-main: #ffffff;
    --swdp-text-muted: rgba(255, 255, 255, 0.7);
    --swdp-border: rgba(255, 255, 255, 0.15);
    --swdp-green: #faac30;
    --swdp-green-hover: #e09624;

    background: var(--swdp-bg-modal);
    border-radius: 0px;
    border: none !important;
    box-shadow: 
        0 10px 25px -5px rgba(0, 63, 99, 0.3),
        0 20px 40px -10px rgba(0, 0, 0, 0.4);
    width: 95%;
    max-width: 920px;
    padding: 36px;
    box-sizing: border-box;
    font-family: var(--e-global-typography-text-font-family), inherit;
    position: relative;
    border: 1px solid var(--swdp-border);
    transform: scale(0.9) translateY(15px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    color: var(--swdp-text-main);
    overflow: visible;
}
.swdp-text-main
{
    color: #ffffff !important;
    letter-spacing: 0.8px !important;
}

.swdp-modal-overlay.swdp-show .swdp-modal-card {
    transform: scale(1) translateY(0);
}

/* Close Button */
.swdp-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    padding: 0;
    z-index: 10;
}

.swdp-modal-close svg {
    width: 18px;
    height: 18px;
}

.swdp-modal-close:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    transform: rotate(90deg);
}

/* Header Styling */
.swdp-modal-header {
    margin-bottom: 28px;
    text-align: center;
}

.swdp-modal-header h2 {
    font-family: var(--e-global-typography-primary-font-family), inherit;
    font-size: 28px;
    font-weight: 700;
    color: var(--swdp-text-main);
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-transform: none;
}

/* Search input and wrapper */
.swdp-search-wrapper {
    width: 100%;
    max-width: 480px;
    margin: 0 auto 32px auto;
    position: relative;
    z-index: 99999;
}

.swdp-search-input-container {
    display: flex;
    align-items: center;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    position: relative;
}

.swdp-search-input-container.swdp-dropdown-open {
    border-color: var(--swdp-green);
    background: rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.swdp-search-input-container:focus-within {
    border-color: var(--swdp-green);
    background: rgba(255, 255, 255, 0.1);
}

/* Left search icon */
.swdp-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 0 16px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.45);
    pointer-events: none;
}

.swdp-search-icon svg {
    width: 17px;
    height: 17px;
}

.swdp-search-input-container input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 14px 16px 14px 10px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    outline: none;
    color: #ffffff;
    cursor: pointer;
}

.swdp-search-input-container input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

#swdp-state-search {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Right chevron icon */
.swdp-search-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px 0 4px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: transform 0.25s ease, color 0.2s ease;
}

.swdp-search-chevron svg {
    width: 17px;
    height: 17px;
}

.swdp-search-chevron.swdp-chevron-open {
    transform: rotate(180deg);
    color: var(--swdp-green);
}

/* =============================================
   Select2-style Dropdown List
   ============================================= */
.swdp-state-dropdown {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #004878;
    border-top: none;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    z-index: 999999;
    max-height: 240px;
    overflow-y: auto;
    box-sizing: border-box;
    animation: swdp-dropdown-in 0.18s ease;
}

.swdp-state-dropdown.swdp-dropdown-visible {
    display: block;
}

@keyframes swdp-dropdown-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Custom scrollbar for dropdown */
.swdp-state-dropdown::-webkit-scrollbar {
    width: 5px;
}
.swdp-state-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.swdp-state-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
}
.swdp-state-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.35);
}

/* Dropdown items */
.swdp-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    position: relative;
    border-left: 3px solid transparent;
    user-select: none;
}

.swdp-dropdown-item:hover,
.swdp-dropdown-item.swdp-dropdown-item-focused {
    background: rgba(250, 172, 48, 0.12);
    color: #ffffff;
    border-left-color: var(--swdp-green);
}

.swdp-dropdown-item-active {
    background: #10374b !important;
    color: #fff !important;
    font-weight: 600;
}

.swdp-dropdown-item-active:hover {
    background: rgba(250, 172, 48, 0.25);
}

/* Checkmark for active item */
.swdp-dropdown-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--swdp-green);
    border-radius: 50%;
    flex-shrink: 0;
    color: #000;
}

.swdp-dropdown-check svg {
    width: 9px;
    height: 9px;
}

.swdp-dropdown-item-text {
    flex: 1;
}

/* No results message inside dropdown */
.swdp-dropdown-no-results {
    padding: 14px 18px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    font-style: italic;
    list-style: none;
    cursor: default;
}

/* Section Title */
.swdp-popular-header {
    text-align: center;
    margin-bottom: 20px;
}

.swdp-popular-header h3 {
    font-family: var(--e-global-typography-accent-font-family), inherit;
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    position: relative;
    display: inline-block;
    letter-spacing: normal;
    text-transform: none;
}

/* States Card Grid */
.swdp-states-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    justify-content: center;
    max-height: 380px;
    overflow-y: auto;
    padding: 6px;
    margin-bottom: 10px;
}

/* Custom Scrollbar for Grid */
.swdp-states-grid::-webkit-scrollbar {
    width: 6px;
}

.swdp-states-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.swdp-states-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.swdp-states-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* State Card styling */
.swdp-state-card {
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 22px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    box-sizing: border-box;
    min-height: 100px;
}

.swdp-state-card:hover {
    background: #fff;
    border-color: var(--swdp-green);
}

.swdp-state-card-active {
    background: #fff;
    border-color: var(--swdp-green);
    border-width: 1.5px;
}

/* State Card Icon styling */
.swdp-state-card-icon {
    width: 120px;
    display: block;
    object-fit: contain; 
    transition: transform 0.25s ease, filter 0.25s ease;
    filter: brightness(1);
}

.swdp-state-card-icon svg {
    width: 100%;
    height: 100%;
}

/* State Name */
.swdp-state-card-name {
    font-family: var(--e-global-typography-text-font-family), inherit;
    font-size: 18px;
    font-weight: 600;
    color: rgb(0 117 225);
    text-align: center;
    transition: color 0.2s ease;
}

.swdp-state-card:hover .swdp-state-card-name,
.swdp-state-card-active .swdp-state-card-name {
    color: #1b6ed5;
}

/* Active Checkmark Badge */
.swdp-state-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--swdp-green);
    color: #000000;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(250, 172, 48, 0.4);
    animation: swdp-scale-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.swdp-state-card-badge svg {
    width: 10px;
    height: 10px;
    color: #000000;
}

@keyframes swdp-scale-in {
    0% {
        transform: scale(0);
    }
    100% {
        transform: scale(1);
    }
}

/* No results message styling */
.swdp-no-results-msg {
    padding: 30px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
    font-weight: 500;
}

/* Floating Deliver-To Badge */
.swdp-floating-badge {
    display:none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 20px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 10px 20px -5px rgba(0, 0, 0, 0.08);
    padding: 12px 18px;
    z-index: 99999;
    cursor: pointer;
    font-family: var(--e-global-typography-text-font-family), inherit;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.swdp-floating-badge.swdp-visible {
    opacity: 1;
    transform: translateY(0);
}

.swdp-floating-badge:hover {
    background: #ffffff;
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.08),
        0 20px 30px -5px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
    border-color: #faac30;
}

.swdp-floating-badge:active {
    transform: translateY(0);
}

.swdp-badge-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.swdp-badge-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(250, 172, 48, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.swdp-badge-icon svg {
    width: 18px;
    height: 18px;
    color: #faac30;
}

.swdp-badge-text-group {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.swdp-badge-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 600;
    line-height: 1.2;
}

.swdp-badge-value {
    font-size: 14px;
    font-weight: 700;
    color: #24212C;
    line-height: 1.3;
}

.swdp-badge-arrow {
    background: #f1f5f9;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.swdp-badge-arrow svg {
    width: 10px;
    height: 10px;
    color: #64748b;
    transition: transform 0.2s ease, color 0.2s ease;
}

.swdp-floating-badge:hover .swdp-badge-arrow {
    background: #faac30;
}

.swdp-floating-badge:hover .swdp-badge-arrow svg {
    color: #000000;
    transform: translateX(1px);
}

/* Shortcode Trigger */
.swdp-change-location-trigger {
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-weight: 500 !important;
    color: var(--swdp-primary, #003f63) !important;
    font-family: inherit !important;
    transition: color 0.2s ease !important;
}

.swdp-change-location-trigger:hover {
    color: var(--swdp-accent, #faac30) !important;
}

.swdp-trigger-edit {
    font-size: 12px !important;
    opacity: 0.7 !important;
}

/* Remove underline from WooCommerce sale price (ins) and strikethrough from regular price (del) */
ins,
.woocommerce ins,
.woocommerce .price ins,
.woocommerce span.price ins,
.woocommerce ul.products li.product .price ins,
.woocommerce .woocommerce-Price-amount ins,
.woocommerce ins .woocommerce-Price-amount,
.woocommerce ins .amount,
.woocommerce-page ins,
.woocommerce-page ins .amount {
    text-decoration: none !important;
    font-style: normal !important;
}



/* Mobile Responsive Adjustments */
@media (max-width: 767px) {
    .swdp-states-grid {
        grid-template-columns: repeat(2, 1fr); /* Two columns on mobile */
        gap: 10px;
        max-height: 320px;
        /* Hide scrollbar but keep scroll functionality */
        overflow-y: auto;
        scrollbar-width: none;       /* Firefox */
        -ms-overflow-style: none;    /* IE / Edge */
    }

    /* Hide WebKit scrollbar for the grid */
    .swdp-states-grid::-webkit-scrollbar {
        display: none;
    }
    
    .swdp-modal-card {
        padding: 24px 16px;
        border-radius: 20px;
        max-width: 92%;
    }
    
    .swdp-modal-header {
        margin-bottom: 20px;
    }
    
    .swdp-modal-header h2 {
        font-size: 22px !important;
    }
    
    .swdp-search-wrapper {
        margin-bottom: 20px;
    }
    
    /* Card: icon on left, name on right */
    .swdp-state-card {
        flex-direction: row;
        padding: 10px 12px;
        min-height: 56px;
        gap: 10px;
        text-align: left;
    }
    
    .swdp-state-card:hover {
        transform: translateY(0);
    }
    
    .swdp-state-card-icon {
        width: 80px;
        margin-bottom: 0;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        object-fit: contain;
    }
    
    .swdp-state-card-name {
        text-align: left;
        font-size: 13px;
    }
    
    .swdp-state-card-badge {
        top: 6px;
        bottom: auto;
        right: 8px;
        position: absolute;
    }
    
    .swdp-floating-badge {
        display:none;
        bottom: 16px;
        right: 20px;
        padding: 14px;
        background: #144f6e;
        border: none;
        border-radius: 50px;
    }
    
    .swdp-badge-content {
        gap: 8px;
    }
    
    .swdp-badge-icon {
        width: 28px;
        height: 28px;
        background: none;
    }
    
    .swdp-badge-icon svg {
        width: 25px;
        height: 25px;
    }

    /* Ensure text group and arrow are always visible on mobile */
    .swdp-badge-text-group {
        display: none !important;
    }

    .swdp-badge-label {
        display: block !important;
        font-size: 10px !important;
        color: #64748b !important;
        font-weight: 600 !important;
        line-height: 1.2 !important;
        white-space: nowrap;
    }

    .swdp-badge-value {
        display: block !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        color: #24212C !important;
        line-height: 1.3 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .swdp-badge-arrow {
        display: none !important;
    }

    .swdp-badge-content {
        display: flex !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }
}

/* ── Checkout state field auto-fill styles ─────────────────────── */
/* NOTE: we do NOT use the HTML 'disabled' attribute because it prevents
   the field value from being POSTed. Instead we CSS-lock the field. */
.swdp-checkout-state-locked {
    opacity: 0.65 !important;
    pointer-events: none !important;   /* blocks all mouse interaction */
    user-select: none !important;      /* blocks text selection */
    background-color: #f5f5f5 !important;
    cursor: default !important;
}

.swdp-checkout-change-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #faac30;
    text-decoration: none;
    border: 1px solid #faac30;
    border-radius: 4px;
    padding: 3px 9px;
    transition: background 0.18s, color 0.18s;
}

.swdp-checkout-change-link:hover {
    background: #faac30;
    color: #003f63;
    text-decoration: none;
}

.swdp-checkout-change-link svg {
    flex-shrink: 0;
}


