/**
 * Color Swatches Ultimate Protection - FINAL SOLUTION
 * الحماية النهائية للسواتشات الملونة - الحل النهائي
 */

/* ========================================
   ULTIMATE PROTECTION SYSTEM
   ======================================== */

/* Override ANY possible conflicting styles with maximum specificity */
html body .cfvsw-swatches-option[data-type="color"],
html body .cfvsw-swatches-option[data-type="colour"],
html body .cfvsw-swatches-option.color-swatch-active,
html body .cfvsw-swatches-option[data-attribute_type="color"],
html body .cfvsw-swatches-option[data-attribute_type="colour"] {
    /* Force colors with maximum priority */
    background: var(--swatch-color, inherit) !important;
    background-color: var(--swatch-color, inherit) !important;
    background-image: none !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    background-position: center !important;
    background-attachment: scroll !important;
    background-clip: border-box !important;
    background-origin: padding-box !important;
    
    /* Force display properties */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    
    /* Force positioning */
    position: relative !important;
    z-index: 9999 !important;
    float: none !important;
    clear: none !important;
    
    /* Force sizing */
    box-sizing: border-box !important;
    min-width: 60px !important;
    min-height: 60px !important;
    
    /* Enhanced borders and shadows for better appearance */
    border: 3px solid rgba(255, 255, 255, 0.9) !important;
    border-radius: 16px !important;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) !important;
    
    /* Force text */
    color: transparent !important;
    text-align: center !important;
    line-height: 1 !important;
    
    /* Enhanced transitions */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    
    /* Override any inline styles */
    background-attachment: scroll !important;
    background-clip: border-box !important;
    background-origin: padding-box !important;
    background-position-x: 0 !important;
    background-position-y: 0 !important;
    background-size: auto !important;
    
    /* Force text properties */
    text-decoration: none !important;
    text-transform: none !important;
    text-shadow: none !important;
    font-weight: normal !important;
    font-style: normal !important;
    font-variant: normal !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    white-space: normal !important;
    
    /* Add margin for better spacing */
    margin: 8px !important;
    
    /* Add cursor pointer */
    cursor: pointer !important;
    
    /* Add overflow hidden for clean edges */
    overflow: hidden !important;
}

/* Force inner content to be transparent */
html body .cfvsw-swatches-option[data-type="color"] .cfvsw-swatch-inner,
html body .cfvsw-swatches-option[data-type="colour"] .cfvsw-swatch-inner,
html body .cfvsw-swatches-option.color-swatch-active .cfvsw-swatch-inner {
    color: transparent !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    font-size: 0 !important;
    line-height: 0 !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
}

/* ========================================
   SPECIFIC COLOR FORCING WITH MAXIMUM SPECIFICITY
   ======================================== */

/* Red - أحمر */
html body .cfvsw-swatches-option[data-slug*="red"],
html body .cfvsw-swatches-option[data-slug*="أحمر"],
html body .cfvsw-swatches-option[data-value*="red"],
html body .cfvsw-swatches-option[data-value*="أحمر"] {
    background-color: #ff0000 !important;
    background: #ff0000 !important;
    --swatch-color: #ff0000 !important;
    border-color: rgba(255, 255, 255, 0.95) !important;
}

/* Blue - أزرق */
html body .cfvsw-swatches-option[data-slug*="blue"],
html body .cfvsw-swatches-option[data-slug*="أزرق"],
html body .cfvsw-swatches-option[data-slug*="الازرق"],
html body .cfvsw-swatches-option[data-value*="blue"],
html body .cfvsw-swatches-option[data-value*="أزرق"],
html body .cfvsw-swatches-option[data-value*="الازرق"] {
    background-color: #0000ff !important;
    background: #0000ff !important;
    --swatch-color: #0000ff !important;
    border-color: rgba(255, 255, 255, 0.95) !important;
}

/* Green - أخضر */
html body .cfvsw-swatches-option[data-slug*="green"],
html body .cfvsw-swatches-option[data-slug*="أخضر"],
html body .cfvsw-swatches-option[data-slug*="اخضر"],
html body .cfvsw-swatches-option[data-value*="green"],
html body .cfvsw-swatches-option[data-value*="أخضر"],
html body .cfvsw-swatches-option[data-value*="اخضر"] {
    background-color: #00ff00 !important;
    background: #00ff00 !important;
    --swatch-color: #00ff00 !important;
    border-color: rgba(255, 255, 255, 0.95) !important;
}

/* Yellow - أصفر */
html body .cfvsw-swatches-option[data-slug*="yellow"],
html body .cfvsw-swatches-option[data-slug*="أصفر"],
html body .cfvsw-swatches-option[data-value*="yellow"],
html body .cfvsw-swatches-option[data-value*="أصفر"] {
    background-color: #ffff00 !important;
    background: #ffff00 !important;
    --swatch-color: #ffff00 !important;
    border-color: rgba(0, 0, 0, 0.3) !important;
}

/* Purple - بنفسجي */
html body .cfvsw-swatches-option[data-slug*="purple"],
html body .cfvsw-swatches-option[data-slug*="بنفسجي"],
html body .cfvsw-swatches-option[data-slug*="بنفسج"],
html body .cfvsw-swatches-option[data-value*="purple"],
html body .cfvsw-swatches-option[data-value*="بنفسجي"],
html body .cfvsw-swatches-option[data-value*="بنفسج"] {
    background-color: #800080 !important;
    background: #800080 !important;
    --swatch-color: #800080 !important;
    border-color: rgba(255, 255, 255, 0.95) !important;
}

/* Orange - برتقالي */
html body .cfvsw-swatches-option[data-slug*="orange"],
html body .cfvsw-swatches-option[data-slug*="برتقالي"],
html body .cfvsw-swatches-option[data-value*="orange"],
html body .cfvsw-swatches-option[data-value*="برتقالي"] {
    background-color: #ffa500 !important;
    background: #ffa500 !important;
    --swatch-color: #ffa500 !important;
    border-color: rgba(255, 255, 255, 0.95) !important;
}

/* Pink - وردي */
html body .cfvsw-swatches-option[data-slug*="pink"],
html body .cfvsw-swatches-option[data-slug*="وردي"],
html body .cfvsw-swatches-option[data-value*="pink"],
html body .cfvsw-swatches-option[data-value*="وردي"] {
    background-color: #ffc0cb !important;
    background: #ffc0cb !important;
    --swatch-color: #ffc0cb !important;
    border-color: rgba(0, 0, 0, 0.2) !important;
}

/* Brown - بني */
html body .cfvsw-swatches-option[data-slug*="brown"],
html body .cfvsw-swatches-option[data-slug*="بني"],
html body .cfvsw-swatches-option[data-value*="brown"],
html body .cfvsw-swatches-option[data-value*="بني"] {
    background-color: #a52a2a !important;
    background: #a52a2a !important;
    --swatch-color: #a52a2a !important;
    border-color: rgba(255, 255, 255, 0.95) !important;
}

/* Black - أسود */
html body .cfvsw-swatches-option[data-slug*="black"],
html body .cfvsw-swatches-option[data-slug*="أسود"],
html body .cfvsw-swatches-option[data-value*="black"],
html body .cfvsw-swatches-option[data-value*="أسود"] {
    background-color: #000000 !important;
    background: #000000 !important;
    --swatch-color: #000000 !important;
    border-color: rgba(255, 255, 255, 0.95) !important;
}

/* White - أبيض */
html body .cfvsw-swatches-option[data-slug*="white"],
html body .cfvsw-swatches-option[data-slug*="أبيض"],
html body .cfvsw-swatches-option[data-value*="white"],
html body .cfvsw-swatches-option[data-value*="أبيض"] {
    background-color: #ffffff !important;
    background: #ffffff !important;
    --swatch-color: #ffffff !important;
    border-color: #ddd !important;
}

/* Gray - رمادي */
html body .cfvsw-swatches-option[data-slug*="gray"],
html body .cfvsw-swatches-option[data-slug*="grey"],
html body .cfvsw-swatches-option[data-slug*="رمادي"],
html body .cfvsw-swatches-option[data-value*="gray"],
html body .cfvsw-swatches-option[data-value*="grey"],
html body .cfvsw-swatches-option[data-value*="رمادي"] {
    background-color: #808080 !important;
    background: #808080 !important;
    --swatch-color: #808080 !important;
    border-color: rgba(255, 255, 255, 0.95) !important;
}

/* ========================================
   OVERRIDE ANY INLINE STYLES
   ======================================== */

/* Override any inline styles that might be added */
html body .cfvsw-swatches-option[style*="background-color"] {
    background-color: var(--swatch-color, inherit) !important;
    background: var(--swatch-color, inherit) !important;
}

html body .cfvsw-swatches-option[style*="background-image"] {
    background-image: none !important;
    background-color: var(--swatch-color, inherit) !important;
    background: var(--swatch-color, inherit) !important;
}

html body .cfvsw-swatches-option[style*="display"] {
    display: block !important;
}

html body .cfvsw-swatches-option[style*="visibility"] {
    visibility: visible !important;
}

html body .cfvsw-swatches-option[style*="opacity"] {
    opacity: 1 !important;
}

/* ========================================
   ENHANCED HOVER AND SELECTION STATES
   ======================================== */

/* Enhanced hover effects */
html body .cfvsw-swatches-option[data-type="color"]:hover,
html body .cfvsw-swatches-option[data-type="colour"]:hover,
html body .cfvsw-swatches-option.color-swatch-active:hover {
    transform: translateY(-6px) scale(1.08) !important;
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.2),
        0 8px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 0 0 2px rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 1) !important;
}

/* Enhanced selected state */
html body .cfvsw-swatches-option[data-type="color"].cfvsw-selected-swatch,
html body .cfvsw-swatches-option[data-type="colour"].cfvsw-selected-swatch,
html body .cfvsw-swatches-option.color-swatch-active.cfvsw-selected-swatch {
    border-color: #007AFF !important;
    border-width: 4px !important;
    box-shadow: 
        0 12px 30px rgba(0, 122, 255, 0.4),
        0 6px 18px rgba(0, 122, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        0 0 0 3px rgba(0, 122, 255, 0.2) !important;
    transform: translateY(-3px) scale(1.05) !important;
}

/* ========================================
   ENHANCED CONTAINER STYLING
   ======================================== */

/* Enhanced container styling */
html body .cfvsw-swatches-container.has-color-swatches {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85)) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 20px !important;
    padding: 24px !important;
    margin: 24px 0 !important;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.1),
        0 4px 15px rgba(0, 0, 0, 0.05) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    html body .cfvsw-swatches-option[data-type="color"],
    html body .cfvsw-swatches-option[data-type="colour"],
    html body .cfvsw-swatches-option.color-swatch-active {
        min-width: 65px !important;
        min-height: 65px !important;
        border-radius: 18px !important;
        margin: 6px !important;
    }
    
    html body .cfvsw-swatches-option[data-type="color"]:hover,
    html body .cfvsw-swatches-option[data-type="colour"]:hover,
    html body .cfvsw-swatches-option.color-swatch-active:hover {
        transform: translateY(-4px) scale(1.06) !important;
    }
    
    html body .cfvsw-swatches-container.has-color-swatches {
        padding: 20px !important;
        border-radius: 18px !important;
    }
}

@media (max-width: 480px) {
    html body .cfvsw-swatches-option[data-type="color"],
    html body .cfvsw-swatches-option[data-type="colour"],
    html body .cfvsw-swatches-option.color-swatch-active {
        min-width: 55px !important;
        min-height: 55px !important;
        border-radius: 16px !important;
        margin: 5px !important;
    }
    
    html body .cfvsw-swatches-container.has-color-swatches {
        padding: 16px !important;
        border-radius: 16px !important;
    }
}

/* ========================================
   FINAL OVERRIDE SYSTEM
   ======================================== */

/* This is the final override - nothing can override this */
html body .cfvsw-swatches-option[data-type="color"],
html body .cfvsw-swatches-option[data-type="colour"],
html body .cfvsw-swatches-option.color-swatch-active {
    /* Force these properties to override ANYTHING */
    background: var(--swatch-color, inherit) !important;
    background-color: var(--swatch-color, inherit) !important;
    background-image: none !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 9999 !important;
}

/* Override any !important rules from other sources */
html body .cfvsw-swatches-option[data-type="color"] *,
html body .cfvsw-swatches-option[data-type="colour"] *,
html body .cfvsw-swatches-option.color-swatch-active * {
    background-image: none !important;
    background-repeat: no-repeat !important;
}
