/**
 * Neumorphism Toggle Switch with Sound
 * Modern soft UI design with subtle shadows
 * Compact size optimized for header placement
 */

.wooden-toggle-container {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 3500;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    touch-action: manipulation;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.wooden-toggle-container.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.wooden-toggle-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    pointer-events: none;
    display: none; /* Hide SOUND text label */
}

.wooden-toggle {
    position: relative;
    width: 56px;
    height: 30px;
    cursor: pointer;
    user-select: none;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Hide default checkbox */
.wooden-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Neumorphism Track */
.wooden-toggle-base {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1e2535;
    border-radius: 18px;
    box-shadow:
        inset 3px 3px 6px rgba(0, 0, 0, 0.4),
        inset -3px -3px 6px rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

/* Neumorphism Handle */
.wooden-toggle-handle {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 26px;
    height: 26px;
    background: linear-gradient(145deg, #242b3d, #1a202e);
    border-radius: 50%;
    box-shadow:
        3px 3px 6px rgba(0, 0, 0, 0.5),
        -3px -3px 6px rgba(255, 255, 255, 0.07);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon inside handle */
.wooden-toggle-handle::before {
    content: '\F57F'; /* Bootstrap Icons soundwave */
    font-family: 'bootstrap-icons';
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

/* ON state - checked */
.wooden-toggle input[type="checkbox"]:checked ~ .wooden-toggle-base {
    background: linear-gradient(135deg, #5e72e4, #825ee4);
    box-shadow:
        inset 3px 3px 6px rgba(0, 0, 0, 0.3),
        inset -3px -3px 6px rgba(255, 255, 255, 0.1),
        0 0 15px rgba(102, 126, 234, 0.3);
}

.wooden-toggle input[type="checkbox"]:checked ~ .wooden-toggle-handle {
    left: calc(100% - 28px);
    background: linear-gradient(145deg, #6f85ff, #5869e6);
    box-shadow:
        3px 3px 6px rgba(0, 0, 0, 0.4),
        -3px -3px 6px rgba(255, 255, 255, 0.2);
}

.wooden-toggle input[type="checkbox"]:checked ~ .wooden-toggle-handle::before {
    color: rgba(255, 255, 255, 1);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Hover effect - desktop only */
@media (min-width: 769px) {
    .wooden-toggle:hover .wooden-toggle-handle {
        box-shadow:
            5px 5px 10px rgba(0, 0, 0, 0.6),
            -5px -5px 10px rgba(255, 255, 255, 0.08);
    }
}

/* Active/pressing effect */
.wooden-toggle:active .wooden-toggle-handle {
    transform: scale(0.95);
}

.wooden-toggle input[type="checkbox"]:checked:active ~ .wooden-toggle-handle {
    transform: translateX(0) scale(0.95);
}

/* ON/OFF text indicators - removed for cleaner look */
.wooden-toggle-text {
    display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .wooden-toggle-container {
        top: 20px;
        right: 20px;
        gap: 8px;
    }

    .wooden-toggle-container.show {
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }

    .wooden-toggle {
        width: 65px;
        height: 34px;
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
    }

    .wooden-toggle-base {
        pointer-events: auto !important;
    }

    .wooden-toggle-handle {
        width: 28px;
        height: 28px;
        pointer-events: auto !important;
    }

    .wooden-toggle-handle::before {
        font-size: 0.75rem;
    }

    .wooden-toggle input[type="checkbox"] {
        /* Make checkbox cover entire toggle area for easier tapping */
        width: 100%;
        height: 100%;
        cursor: pointer;
    }

    .wooden-toggle input[type="checkbox"]:checked ~ .wooden-toggle-handle {
        left: calc(100% - 31px);
    }

    .wooden-toggle-label {
        font-size: 0.6rem;
        pointer-events: none;
    }

    /* Remove hover effects on mobile - use active instead */
    .wooden-toggle:hover .wooden-toggle-handle {
        box-shadow:
            4px 4px 8px rgba(0, 0, 0, 0.5),
            -4px -4px 8px rgba(255, 255, 255, 0.07);
    }

    /* Mobile active/tap feedback */
    .wooden-toggle:active .wooden-toggle-base,
    .wooden-toggle-base:active {
        opacity: 0.95;
    }
}

/* Animation for initial load */
@keyframes toggle-slide-in {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wooden-toggle-container {
    animation: toggle-slide-in 0.5s ease-out;
}
