/* FLAGS Products - Frontend Styles */

/* ============================================
   MAIN CONTAINER
   ============================================ */
   
   
   .flag-item.selected::after {
    background: #0a9747 !important;
}
.flag-item.selected {
    border-color: #0b9949 !important;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}
.flags-selected-code {
    color: #0b9948 !important;
}
   
   
.flags-products-selector {
    background: transparent;
    border: none !important;
    border-radius: 0;
    padding: 0;
    margin: 30px 0;
}

.flags-products-notice {
    padding: 15px 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    margin: 20px 0;
    display: none !important;
}

/* ============================================
   FLAGS GROUP
   ============================================ */
.flags-group {
    margin-bottom: 20px;
}

.flags-group:last-child {
    margin-bottom: 0;
}

.flags-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.flags-group-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.flags-selected-code {
    color: #2271b1;
    font-weight: 700;
    font-size: 14px;
    min-height: 20px;
}

/* ============================================
   FLAGS GRID
   ============================================ */
.flags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px !important;
    align-items: flex-start;
    justify-content: flex-start;
    max-width: 100%;
}

.flag-item {
    position: relative;
    cursor: pointer;
    border: 2px solid #e5e5e5;
    border-radius: 7px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fff;
    width: 50px !important;
    height: 50px !important;
    max-width: 50px !important;
    max-height: 50px !important;
    min-width: 50px !important;
    min-height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    flex-basis: 50px !important;
    box-sizing: border-box !important;
}

.flag-item:hover {
    border-color: #999;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.flag-item.selected {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

.flag-item.selected::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: #2271b1;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    z-index: 10;
}

.flag-item img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.flag-placeholder {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    color: #999;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
}

.flag-name {
    display: none !important;
}

/* ============================================
   LOADING STATE
   ============================================ */
.flags-products-selector.loading {
    opacity: 0.6;
    pointer-events: none;
}

.flags-products-selector.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 767px) {
    .flags-products-selector {
        padding: 0;
    }
    
    .flags-group-header {
        gap: 6px;
    }
    
    .flags-group-label {
        font-size: 13px;
    }
    
    .flags-selected-code {
        font-size: 13px;
    }
    
    .flags-grid {
        gap: 10px !important;
    }
    
    .flag-item {
        width: 50px !important;
        height: 50px !important;
        max-width: 50px !important;
        max-height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
        flex-basis: 50px !important;
    }
    
    .flag-item.selected::after {
        width: 14px !important;
        height: 14px !important;
        font-size: 9px;
        top: 2px;
        right: 2px;
    }
    
    .flag-placeholder {
        font-size: 8px;
    }
}

/* ============================================
   INTEGRATION WITH WOOCOMMERCE
   ============================================ */
.single-product .flags-products-selector {
    margin-bottom: 25px;
}

.single-product .flags-products-selector {
    border: none !important;
    padding: 0 !important;
}
.single-product .flags-products-notice {
    display: none !important;
}

/* Ensure add to cart button is visible */
.single-product .cart {
    margin-top: 20px;
}
