/* Conditional Stock Manager Public Styles - Compact Modal with Original Shortcode Styling */

/* ==========================================================================
    BASE RESET
    ========================================================================== */
    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
    
    /* ==========================================================================
        SHORTCODE STYLES (ORIGINAL)
        ========================================================================== */
    #csm-current-location-shortcode-wrapper {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        padding: 8px 12px !important;
        background-color: #fff !important;
        color: #333 !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        cursor: pointer !important;
        font-size: 0.9em !important;
        box-sizing: border-box !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 250px !important;
        transition: all 0.2s ease !important;
        text-decoration: none !important;
    }
    
    #csm-current-location-shortcode-wrapper:hover {
        background-color: #f8f9fa !important;
        border-color: #0073aa !important;
        color: #0073aa !important;
    }
    
    #csm-current-location-shortcode-wrapper span.dashicons {
        flex-shrink: 0 !important;
        font-size: 16px !important;
        line-height: 1 !important;
    }
    
    #csm-current-location-shortcode {
        color: inherit !important;
        font-weight: 500 !important;
        text-decoration: none !important;
        font-size: inherit !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    /* ==========================================================================
        MODAL STYLES (COMPACT VERSION - NO VERTICAL GAPS)
        ========================================================================== */
    .csm-modal-overlay {
        display: flex !important;
        position: fixed !important;
        z-index: 10000 !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        overflow: auto !important;
        background-color: rgba(0, 0, 0, 0.4) !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px !important;
        box-sizing: border-box !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out !important;
    }
    
    .csm-modal-overlay.active {
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    .csm-modal-content {
        background-color: #fefefe !important;
        padding: 15px 20px !important;
        border: 1px solid #ddd !important;
        width: 100% !important;
        max-width: 400px !important;
        border-radius: 8px !important;
        text-align: left !important;
        position: relative !important;
        box-sizing: border-box !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
        transform: scale(0.95) !important;
        transition: transform 0.3s ease-in-out !important;
    }
    
    .csm-modal-overlay.active .csm-modal-content {
        transform: scale(1) !important;
    }
    
    .csm-modal-content h3 {
        margin: 0 0 5px 0 !important;
        font-size: 1.25em !important;
        color: #333 !important;
        text-align: center !important;
    }
    
    .csm-close-modal {
        color: #aaa !important;
        position: absolute !important;
        top: 10px !important;
        right: 15px !important;
        font-size: 22px !important;
        font-weight: bold !important;
        cursor: pointer !important;
        background: none !important;
        border: none !important;
        padding: 0 !important;
        line-height: 1 !important;
        transition: color 0.2s ease !important;
    }
    
    .csm-close-modal:hover,
    .csm-close-modal:focus {
        color: #333 !important;
        text-decoration: none !important;
    }
    
    .csm-field-group {
        margin-bottom: 0 !important;
        /* No gap between field groups */
    }
    
    .csm-field-group p {
        margin: 0 !important;
        /* No vertical margin */
        font-size: 0.9em !important;
        line-height: 1.3 !important;
    }
    
    .csm-field-group p strong {
        color: #333 !important;
        font-weight: 600 !important;
    }
    
    .csm-field-group label {
        display: block !important;
        margin-bottom: 0 !important;
        /* No gap below labels */
        font-weight: 500 !important;
        color: #555 !important;
        font-size: 0.85em !important;
    }
    
    .csm-field-group select {
        width: 100% !important;
        padding: 8px 10px !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        font-size: 0.9em !important;
        background-color: #fff !important;
        box-sizing: border-box !important;
        transition: border-color 0.2s ease !important;
        margin-top: 2px !important;
        /* Minimal gap above inputs */
    }
    
    .csm-field-group select:focus {
        outline: none !important;
        border-color: #0073aa !important;
        box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.1) !important;
    }
    
    .csm-field-group select:disabled {
        background-color: #f5f5f5 !important;
        color: #999 !important;
        cursor: not-allowed !important;
    }
    
    #csm-detected-display-location {
        color: #0073aa !important;
        font-weight: 500 !important;
    }
    
    #csm-set-manual-location {
        background-color: #0073aa !important;
        color: white !important;
        padding: 8px !important;
        border: none !important;
        border-radius: 4px !important;
        cursor: pointer !important;
        font-size: 0.95em !important;
        font-weight: 500 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        transition: background-color 0.2s ease !important;
        margin-top: 5px !important;
        /* Minimal gap above button */
    }
    
    #csm-set-manual-location:hover:not(:disabled) {
        background-color: #005a87 !important;
    }
    
    #csm-set-manual-location:disabled {
        background-color: #ccc !important;
        cursor: not-allowed !important;
    }
    
    .csm-modal-message {
        margin-top: 5px !important;
        /* Minimal gap above messages */
        padding: 8px !important;
        border-radius: 4px !important;
        font-size: 0.85em !important;
        text-align: center !important;
    }
    
    .csm-modal-message.success {
        background-color: #d4edda !important;
        color: #155724 !important;
        border: 1px solid #c3e6cb !important;
    }
    
    .csm-modal-message.error {
        background-color: #f8d7da !important;
        color: #721c24 !important;
        border: 1px solid #f5c6cb !important;
    }
    
    .csm-loading-spinner {
        border: 2px solid rgba(0, 0, 0, 0.1) !important;
        border-top: 2px solid #0073aa !important;
        border-radius: 50% !important;
        width: 14px !important;
        height: 14px !important;
        animation: spin 1s linear infinite !important;
        display: inline-block !important;
        vertical-align: middle !important;
        margin-right: 5px !important;
    }
    
    @keyframes spin {
        0% {
            transform: rotate(0deg);
        }
    
        100% {
            transform: rotate(360deg);
        }
    }
    
    /* ==========================================================================
        STOCK STATUS STYLES
        ========================================================================== */
    /* Out of Stock */
    body.csm-regionally-out-of-stock .woocommerce-product-gallery {
        position: relative !important;
    }
    
    body.csm-regionally-out-of-stock .woocommerce-product-gallery img {
        filter: grayscale(100%) !important;
        opacity: 0.6 !important;
    }
    
    body.csm-regionally-out-of-stock .woocommerce-product-gallery::after {
        content: "Out of Stock in Your Region" !important;
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        color: #fff !important;
        font-size: 1.2em !important;
        font-weight: bold !important;
        text-align: center !important;
        z-index: 2 !important;
        padding: 15px 20px !important;
        background-color: rgba(220, 53, 69, 0.9) !important;
        border-radius: 6px !important;
        max-width: 80% !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    }
    
    body.csm-regionally-out-of-stock form.cart button.single_add_to_cart_button {
        background-color: #6c757d !important;
        cursor: not-allowed !important;
        opacity: 0.7 !important;
    }
    
    /* In Stock */
    body.csm-regionally-in-stock .woocommerce-product-gallery::after {
        display: none !important;
    }
    
    body.csm-regionally-in-stock .woocommerce-product-gallery img {
        filter: none !important;
        opacity: 1 !important;
    }
    
    /* Status Messages */
    #csm-regional-stock-status {
        font-weight: 600 !important;
        margin: 15px 0 !important;
        padding: 10px !important;
        font-size: 1em !important;
        text-align: center !important;
        border-radius: 4px !important;
    }
    
    #csm-regional-stock-status.loading {
        background-color: #f8f9fa !important;
        color: #6c757d !important;
        border: 1px solid #dee2e6 !important;
    }
    
    #csm-regional-stock-status.in-stock {
        background-color: #d4edda !important;
        color: #155724 !important;
        border: 1px solid #c3e6cb !important;
    }
    
    #csm-regional-stock-status.out-of-stock {
        background-color: #f8d7da !important;
        color: #721c24 !important;
        border: 1px solid #f5c6cb !important;
    }
    
    /* ==========================================================================
        ADDITIONAL STYLES FOR DISABLED BUTTONS (FOR JS-FORCED DISABLE)
        ========================================================================== */
    .csm-disabled-button {
        cursor: not-allowed !important;
        opacity: 0.7 !important;
        /* You can add more styling here for a truly "disabled" look */
    }
    