.tts-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-right: 12px;
    height: 38px;
    /* background: rgba(255, 255, 255, 0.2); */
    border-radius: 30px;
    padding: 5px 10px;
}

.tts-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.tts-switch-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.tts-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    opacity: 0.85;
    transition: opacity 0.3s;
    filter: invert(1);
}

.tts-switch input:checked ~ .tts-icon {
    opacity: 1;
}

.tts-switch-toggle {
    position: relative;
    width: 46px;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 2px;
    transition: background 0.3s;
}

.tts-switch-toggle::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    left: 2px;
    top: 2px;
    transition: transform 0.3s, background 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tts-switch input:checked + .tts-switch-label .tts-switch-toggle {
    background: #4DB8A2;
}

.tts-switch input:checked + .tts-switch-label .tts-switch-toggle::before {
    transform: translateX(22px);
}

/* TTS cursor and interactive elements */
.tts-enabled [data-tts] {
    cursor: url('../img/speaker-icon.svg') 12 12, pointer;
}

/* Toast notification */
.tts-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.tts-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Loading state */
[data-tts].tts-loading {
    position: relative;
}

[data-tts].tts-loading::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid #4DB8A2;
    border-top-color: transparent;
    border-radius: 50%;
    animation: tts-spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes tts-spin {
    to { transform: rotate(360deg); }
}
