/**
 * Parcel Lockers Styles
 * Styles for popup modals and summary displays
 */

/* GLS Popup Styles */
#gls-locker-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
}

#gls-locker-popup-inner {
    position: relative;
    width: 80%;
    max-width: 1200px;
    height: 80%;
    max-height: 800px;
    margin: 5% auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#gls-locker-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    z-index: 10001;
}

#gls-locker-close:hover {
    background: #d32f2f;
}

#gls-locker-popup-container {
    width: 100%;
    height: 100%;
    overflow: auto;
}

/* FANCourier Popup Styles */
#fancourier-locker-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
}

#fancourier-locker-popup-inner {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 85%;
    max-height: 800px;
    margin: 2.5% auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#fancourier-locker-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    z-index: 10001;
}

#fancourier-locker-close:hover {
    background: #d32f2f;
}

#fancourier-locker-widget-container {
    width: 100%;
    height: 100%;
    overflow: auto;
}

/* BoxNow Widget Overlay - Force to top of stacking order */
#boxnowmap,
.boxnow-map-widget-overlay,
.boxnow-map-widget-popup,
.boxnow-map-widget,
.boxnow-widget,
.boxnow-popup,
.boxnow-modal,
iframe[src*="boxnow"][src*="map-widget"] {
    z-index: 2147483640 !important; /* near-max */
    position: relative !important;
}

/* Parcel Locker Summary Box */
.parcel-locker-summary-box {
    cursor: pointer;
    border: 2px solid #3182ce;
    background: #f9f9f9;
    padding: 12px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.parcel-locker-summary-box:hover {
    background: #f0f0f0;
    border-color: #2563eb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Disabled Place Order Button */
button.parcel-locker-disabled,
input.parcel-locker-disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    position: relative;
}

button.parcel-locker-disabled::after,
input.parcel-locker-disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}

/* Notice/Tooltip for Place Order Button */
.parcel-locker-place-order-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: parcel-locker-notice-fade-in 0.3s ease-in;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.parcel-locker-place-order-notice:hover,
.parcel-locker-place-order-notice:active {
    background: #ffe69c !important;
    border-color: #ffb300;
}

.parcel-locker-place-order-notice:active {
    transform: scale(0.98);
}

.parcel-locker-place-order-notice .parcel-locker-notice-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
}

.parcel-locker-place-order-notice .parcel-locker-notice-text {
    flex: 1;
    font-weight: 500;
}

@keyframes parcel-locker-notice-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    #gls-locker-popup-inner {
        width: 95%;
        height: 90%;
        margin: 2.5% auto;
        padding: 15px;
    }

    #fancourier-locker-popup-inner {
        width: 95%;
        height: 90%;
        margin: 2.5% auto;
        padding: 15px;
    }

    .parcel-locker-summary-box {
        padding: 10px;
        font-size: 14px;
    }

    .parcel-locker-place-order-notice {
        padding: 10px 12px;
        font-size: 13px;
        margin-bottom: 10px;
        touch-action: manipulation;
    }

    .parcel-locker-place-order-notice .parcel-locker-notice-icon {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    #gls-locker-popup-inner {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        padding: 10px;
    }

    #fancourier-locker-popup-inner {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        padding: 10px;
    }

    #gls-locker-close {
        top: 5px;
        right: 5px;
        padding: 6px 12px;
        font-size: 12px;
    }

    #fancourier-locker-close {
        top: 5px;
        right: 5px;
        padding: 6px 12px;
        font-size: 12px;
    }

    .parcel-locker-place-order-notice {
        padding: 10px;
        font-size: 12px;
        gap: 6px;
    }

    .parcel-locker-place-order-notice .parcel-locker-notice-icon {
        font-size: 14px;
    }
}

/* Blocks Checkout Compatibility */
.wc-block-components-checkout-place-order-button ~ .parcel-locker-place-order-notice,
.place-order ~ .parcel-locker-place-order-notice {
    margin-bottom: 16px;
}

/* Ensure notice doesn't break layout */
.parcel-locker-place-order-notice {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Select Pickup Point Button Wrapper */
.parcel-locker-select-btn-wrapper {
    padding: 14px 16px;
    background: linear-gradient(to bottom, #fff9e6 0%, #fffef7 100%);
    border: 1px solid #ffe082;
    border-radius: 4px;
    margin: 12px 0 0 0;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(255, 193, 7, 0.1);
}

.parcel-locker-select-btn-wrapper::before {
    content: "⚠️";
    font-size: 18px;
    flex-shrink: 0;
    animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Select Pickup Point Button */
.parcel-locker-select-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    margin: 0;
    background: #5271ff;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(82, 113, 255, 0.3);
    flex-shrink: 0;
}

.parcel-locker-select-btn:hover {
    background: #4461eb;
    box-shadow: 0 2px 6px rgba(82, 113, 255, 0.4);
    transform: translateY(-1px);
}

.parcel-locker-select-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(82, 113, 255, 0.3);
}

.parcel-locker-select-btn__icon {
    font-size: 14px;
    line-height: 1;
}

.parcel-locker-select-btn__text {
    line-height: 1;
    white-space: nowrap;
}

/* Container styling when needs selection */
.rf-option-container.parcel-locker-needs-selection {
    border-color: #ffc107 !important;
    background: #fffef7 !important;
    position: relative;
}

.rf-option-container.parcel-locker-needs-selection::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #ffc107;
}

/* Make parcel locker containers appear clickable */
.rf-option-container[data-parcel-locker="true"].is-selected {
    cursor: pointer !important;
    transition: all 0.2s ease;
}

.rf-option-container[data-parcel-locker="true"].is-selected:hover {
    background: #f9f9f9;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .parcel-locker-select-btn-wrapper {
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .parcel-locker-select-btn-wrapper::before {
        align-self: center;
    }

    .parcel-locker-select-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 14px;
    }

    .parcel-locker-select-btn__icon {
        font-size: 16px;
    }
}

