/**
 * Image Color Toggle - Frontend Styles
 * Version: 1.0.0
 */

/* ===========================================
   STICKY TOGGLE CONTAINER
   =========================================== */

.ict-sticky-toggle {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 20px;
    z-index: 999999;
    transition: all 0.3s ease;
}

.ict-toggle-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e0e0e0;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.ict-toggle-container:hover {
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-5px);
}

/* ===========================================
   TOGGLE SWITCH
   =========================================== */

.ict-toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.ict-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ict-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 26px;
}

.ict-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Checked State */
input:checked + .ict-toggle-slider {
    background-color: #000;
}

input:checked + .ict-toggle-slider:before {
    transform: translateX(20px);
}

/* Focus State */
.ict-toggle-switch input:focus + .ict-toggle-slider {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Toggle Text */
.ict-toggle-text {
    font-size: 10px;
    font-weight: 500;
    color: #333;
    text-align: center;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
    white-space: nowrap;
}

.ict-toggle-text br {
    display: none;
}

/* ===========================================
   IMAGE FILTERS - ENHANCED VERSION
   =========================================== */

/* Grayscale Mode - Ultra Specific Selectors */
body.ict-grayscale-mode img,
body.ict-grayscale-mode img.wp-post-image,
body.ict-grayscale-mode .wp-post-image,
body.ict-grayscale-mode picture img,
body.ict-grayscale-mode figure img,
body.ict-grayscale-mode .gallery img,
body.ict-grayscale-mode article img,
body.ict-grayscale-mode section img,
body.ict-grayscale-mode main img,
body.ict-grayscale-mode aside img,
body.ict-grayscale-mode header img,
body.ict-grayscale-mode footer img,
body.ict-grayscale-mode div img,
body.ict-grayscale-mode span img,
body.ict-grayscale-mode a img,
body.ict-grayscale-mode li img,
body.ict-grayscale-mode .portfolio-image,
body.ict-grayscale-mode .project-image,
body.ict-grayscale-mode .post-thumbnail img,
body.ict-grayscale-mode .entry-content img,
body.ict-grayscale-mode .content img,
body.ict-grayscale-mode [class*="image"] img,
body.ict-grayscale-mode [class*="img"] img,
body.ict-grayscale-mode [class*="photo"] img,
body.ict-grayscale-mode [class*="picture"] img {
    filter: grayscale(100%) !important;
    -webkit-filter: grayscale(100%) !important;
    -moz-filter: grayscale(100%) !important;
    -ms-filter: grayscale(100%) !important;
    -o-filter: grayscale(100%) !important;
    transition: filter 0.6s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Color Mode - Ultra Specific Selectors */
body:not(.ict-grayscale-mode) img,
body:not(.ict-grayscale-mode) img.wp-post-image,
body:not(.ict-grayscale-mode) .wp-post-image,
body:not(.ict-grayscale-mode) picture img,
body:not(.ict-grayscale-mode) figure img,
body:not(.ict-grayscale-mode) .gallery img,
body:not(.ict-grayscale-mode) article img,
body:not(.ict-grayscale-mode) section img,
body:not(.ict-grayscale-mode) main img,
body:not(.ict-grayscale-mode) aside img,
body:not(.ict-grayscale-mode) header img,
body:not(.ict-grayscale-mode) footer img,
body:not(.ict-grayscale-mode) div img,
body:not(.ict-grayscale-mode) span img,
body:not(.ict-grayscale-mode) a img,
body:not(.ict-grayscale-mode) li img,
body:not(.ict-grayscale-mode) .portfolio-image,
body:not(.ict-grayscale-mode) .project-image,
body:not(.ict-grayscale-mode) .post-thumbnail img,
body:not(.ict-grayscale-mode) .entry-content img,
body:not(.ict-grayscale-mode) .content img,
body:not(.ict-grayscale-mode) [class*="image"] img,
body:not(.ict-grayscale-mode) [class*="img"] img,
body:not(.ict-grayscale-mode) [class*="photo"] img,
body:not(.ict-grayscale-mode) [class*="picture"] img {
    filter: grayscale(0%) !important;
    -webkit-filter: grayscale(0%) !important;
    -moz-filter: grayscale(0%) !important;
    -ms-filter: grayscale(0%) !important;
    -o-filter: grayscale(0%) !important;
    transition: filter 0.6s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Default Exclusions */
body.ict-grayscale-mode .site-logo img,
body.ict-grayscale-mode .site-branding img,
body.ict-grayscale-mode .logo img,
body.ict-grayscale-mode .custom-logo img,
body.ict-grayscale-mode .icon,
body.ict-grayscale-mode .svg-icon,
body.ict-grayscale-mode .ict-exclude {
    filter: none !important;
    -webkit-filter: none !important;
}

/* ===========================================
   MOBILE RESPONSIVE
   =========================================== */

@media screen and (max-width: 768px) {
    .ict-sticky-toggle {
        left: 50%;
        transform: translateX(-50%);
        bottom: 15px;
    }
    
    .ict-toggle-container {
        padding: 10px 16px;
        flex-direction: row;
        gap: 8px;
    }
    
    .ict-toggle-text {
        font-size: 9px;
        white-space: nowrap;
    }
    
    .ict-toggle-text br {
        display: none;
    }
    
    .ict-toggle-switch {
        width: 40px;
        height: 22px;
    }
    
    .ict-toggle-slider:before {
        height: 16px;
        width: 16px;
    }
    
    input:checked + .ict-toggle-slider:before {
        transform: translateX(18px);
    }
}

@media screen and (max-width: 480px) {
    .ict-sticky-toggle {
        left: 50%;
        transform: translateX(-50%);
        bottom: 12px;
    }
    
    .ict-toggle-container {
        padding: 8px 14px;
    }
    
    .ict-toggle-text {
        font-size: 8px;
    }
}

/* ===========================================
   ANIMATIONS
   =========================================== */

@keyframes ict-slide-in-right {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.ict-sticky-toggle {
    animation: ict-slide-in-right 0.6s ease-out 0.3s both;
}

@media screen and (max-width: 768px) {
    @keyframes ict-slide-in-right {
        from {
            opacity: 0;
            transform: translateX(-50%) translateY(50px);
        }
        to {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
    }
}

/* ===========================================
   PRINT STYLES
   =========================================== */

@media print {
    .ict-sticky-toggle {
        display: none !important;
    }
    
    body.ict-grayscale-mode img {
        filter: none !important;
        -webkit-filter: none !important;
    }
}

/* ===========================================
   ACCESSIBILITY
   =========================================== */

.ict-toggle-switch:focus-within .ict-toggle-slider {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .ict-toggle-container {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .ict-toggle-slider,
    .ict-toggle-slider:before,
    .ict-toggle-container,
    body.ict-grayscale-mode img,
    body:not(.ict-grayscale-mode) img {
        transition: none !important;
    }
    
    .ict-sticky-toggle {
        animation: none !important;
    }
}
