/**
 * Super Delivery & Pickup - Shop Popup Styles
 * Updated with !important to resolve theme conflicts
 */

/* Popup Overlay */
.sdp-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 99999999 !important; /* Increased and forced to beat theme headers */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sdp-popup-overlay.sdp-popup-visible {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Popup Container */
.sdp-popup-container {
    background: #ffffff !important;
    border-radius: 16px !important;
    max-width: 500px !important;
    width: 90% !important;
    max-height: 90vh !important;
    overflow: hidden !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-sizing: border-box !important; /* Added to prevent theme padding calculation errors */
}

.sdp-popup-overlay.sdp-popup-visible .sdp-popup-container {
    transform: scale(1) translateY(0) !important;
}

/* Popup Content */
.sdp-popup-content {
    padding: 40px 30px !important;
}

/* Popup Header */
.sdp-popup-header {
    text-align: center !important;
    margin-bottom: 30px !important;
}

/* Typography is the #1 conflict area in WP themes */
.sdp-popup-header h2 {
    margin: 0 0 10px 0 !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
    line-height: 1.3 !important;
    text-transform: none !important; /* Resets theme uppercase styles */
    letter-spacing: normal !important;
}

.sdp-popup-header p {
    margin: 0 !important;
    font-size: 15px !important;
    color: #666666 !important;
    line-height: 1.5 !important;
}

/* Popup Options Container */
.sdp-popup-options {
    display: flex !important;
    gap: 15px !important;
    flex-wrap: wrap !important;
    list-style: none !important; /* In case theme treats it like a list */
    margin: 0 !important;
    padding: 0 !important;
}

/* Option Buttons */
.sdp-popup-option {
    flex: 1 !important;
    min-width: 180px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 25px 20px !important;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px !important;
    cursor: pointer !important;
    transition: all 0.2s ease;
    text-align: center !important;
    text-decoration: none !important; /* Removes theme link underlines */
    box-sizing: border-box !important;
}

.sdp-popup-option:hover {
    background: #fff !important;
    border-color: #e22d2d !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(226, 45, 45, 0.15) !important;
}

.sdp-popup-option:active {
    transform: translateY(0) !important;
}

/* Icon Styles */
.sdp-popup-icon {
    width: 60px !important;
    height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #e22d2d !important;
    border-radius: 50% !important;
    margin-bottom: 15px !important;
    transition: all 0.2s ease;
    padding: 0 !important; /* Resets theme padding */
}

.sdp-popup-icon svg {
    width: 30px !important;
    height: 30px !important;
    color: #ffffff !important;
    fill: #ffffff !important; /* Some themes use fill instead of color */
    display: block !important;
}

.sdp-popup-option:hover .sdp-popup-icon {
    background: #c41e1e !important;
    transform: scale(1.1) !important;
}

/* Label Styles */
.sdp-popup-label {
    display: block !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #1a1a1a !important;
    margin-bottom: 5px !important;
}

.sdp-popup-desc {
    display: block !important;
    font-size: 13px !important;
    color: #888888 !important;
    line-height: 1.4 !important;
}

/* Selected State */
.sdp-popup-option.sdp-selected {
    background: #e22d2d !important;
    border-color: #e22d2d !important;
}

.sdp-popup-option.sdp-selected .sdp-popup-icon {
    background: #ffffff !important;
}

.sdp-popup-option.sdp-selected .sdp-popup-icon svg {
    color: #e22d2d !important;
    fill: #e22d2d !important;
}

.sdp-popup-option.sdp-selected .sdp-popup-label,
.sdp-popup-option.sdp-selected .sdp-popup-desc {
    color: #ffffff !important;
}

/* Loading State */
.sdp-popup-option.sdp-loading {
    pointer-events: none !important;
    opacity: 0.7 !important;
}

.sdp-popup-option.sdp-loading::after {
    content: '' !important;
    position: absolute !important;
    width: 20px !important;
    height: 20px !important;
    border: 2px solid #e22d2d !important;
    border-top-color: transparent !important;
    border-radius: 50% !important;
    animation: sdp-spin 0.8s linear infinite !important;
}

@keyframes sdp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Styles */
@media (max-width: 480px) {
    .sdp-popup-content {
        padding: 30px 20px !important;
    }
    
    .sdp-popup-header h2 {
        font-size: 20px !important;
    }
    
    .sdp-popup-options {
        flex-direction: column !important;
    }
    
    .sdp-popup-option {
        min-width: 100% !important;
        padding: 20px 15px !important;
    }
    
    .sdp-popup-icon {
        width: 50px !important;
        height: 50px !important;
    }
    
    .sdp-popup-icon svg {
        width: 25px !important;
        height: 25px !important;
    }
}

/* Animation for closing */
.sdp-popup-overlay.sdp-popup-closing {
    opacity: 0 !important;
}

.sdp-popup-overlay.sdp-popup-closing .sdp-popup-container {
    transform: scale(0.9) translateY(20px) !important;
}
