/* Text to Speech Styles */
.tts-manual-button {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    box-shadow: none !important;
    position: relative;
    gap: 8px;
}

.tts-manual-button:hover {
    background: transparent !important;
    transform: scale(1.05);
    opacity: 0.8;
}

.tts-manual-button.playing {
    background: transparent !important;
    animation: pulse 1.5s infinite;
}

.tts-manual-button.paused {
    background: transparent !important;
    opacity: 0.6;
}

/* Custom icon styling - completely clean */
.tts-manual-button .tts-custom-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
    filter: none !important;
    background: transparent !important;
}

/* Default play icon styling - only used when no custom icon */
.tts-manual-button .tts-play-icon {
    width: 32px;
    height: 32px;
    color: #007cba;
    transition: all 0.3s ease;
    background: transparent;
}

.tts-manual-button:hover .tts-play-icon {
    color: #005a87;
}

/* LISTEN text styling - CHANGED TO WHITE */
.tts-button-text {
    color: #ffffff !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1;
    white-space: nowrap;
    padding-right: 15px;
}

/* Auto Player Controls - Fixed cursor visibility */
.tts-auto-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    min-width: 150px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    cursor: auto !important;
}

.tts-auto-controls.playing {
    border-color: #007cba;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.tts-controls-header {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
    text-align: center;
}

.tts-controls-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.tts-control-btn {
    background: #f8f9fa;
    border: 1px solid #6c757d;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    color: #495057;
    font-weight: 600;
}

.tts-control-btn:hover {
    background: #e9ecef;
    border-color: #495057;
}

#tts-play-btn.playing {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

/* Pulse animation for playing state - Only for custom icon */
.tts-manual-button.playing .tts-custom-icon {
    animation: icon-pulse 1.5s infinite;
}

@keyframes icon-pulse {
    0% {
        filter: drop-shadow(0 0 0 rgba(240, 189, 45, 0.7));
    }
    70% {
        filter: drop-shadow(0 0 8px rgba(240, 189, 45, 0.3));
    }
    100% {
        filter: drop-shadow(0 0 0 rgba(240, 189, 45, 0));
    }
}

/* For default play icon - show background pulse */
.tts-manual-button.playing .tts-play-icon {
    animation: default-pulse 1.5s infinite;
}

@keyframes default-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(240, 189, 45, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(240, 189, 45, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(240, 189, 45, 0);
    }
}

/* Active state styling */
.tts-manual-button.active {
    background: transparent !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .tts-auto-controls {
        bottom: 10px;
        right: 10px;
        left: auto !important;
        min-width: auto;
    }
    
    .tts-manual-button .tts-custom-icon,
    .tts-manual-button .tts-play-icon {
        width: 28px;
        height: 28px;
    }
    
    .tts-button-text {
        font-size: 13px;
        padding-right: 12px;
    }
}

/* Accessibility improvements */
.tts-manual-button:focus {
    outline: 2px solid #F0BD2D;
    outline-offset: 2px;
}

.tts-control-btn:focus {
    outline: 2px solid #F0BD2D;
    outline-offset: 1px;
}

/* Reset any global button styles that might interfere */
.tts-manual-button * {
    box-sizing: border-box;
    background: transparent !important;
}

/* Ensure no background colors interfere */
.tts-manual-button,
.tts-manual-button:before,
.tts-manual-button:after,
.tts-manual-button *:before,
.tts-manual-button *:after {
    background: transparent !important;
}

/* Load Inter font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Close button styling - positioned absolutely within the sticky player */
.tts-close-btn {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    background: transparent !important;
    border: none !important;
    font-size: 18px !important;
    cursor: pointer !important;
    color: #999 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    transition: all 0.2s ease !important;
    z-index: 10001 !important;
}

.tts-close-btn:hover {
    background: #f0f0f0 !important;
    color: #333 !important;
}

/* Ensure the header has padding for the close button */
.tts-controls-header {
    padding-right: 24px !important;
}

/* Minimized state styles - keeps white background around icon */
.tts-auto-controls.minimized {
    min-width: auto !important;
    width: auto !important;
    padding: 8px !important;
    cursor: pointer !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.tts-auto-controls.minimized:hover {
    background-color: #F0BD2D !important;
}

.tts-auto-controls.minimized .tts-controls-header,
.tts-auto-controls.minimized .tts-controls-buttons,
.tts-auto-controls.minimized .tts-close-btn {
    display: none !important;
}

.tts-auto-controls.minimized .tts-minimized-icon {
    display: block !important;
}

.tts-auto-controls .tts-minimized-icon {
    display: none !important;
}

/* Minimized icon styling */
.tts-minimized-icon img {
    width: 40px !important;
    height: 40px !important;
    display: block !important;
    cursor: pointer !important;
}

/* Mobile responsive adjustments - ONLY FIXES FOR MOBILE */
@media (max-width: 768px) {
    .tts-close-btn {
        top: 5px !important;
        right: 5px !important;
        width: 20px !important;
        height: 20px !important;
        font-size: 14px !important;
    }
    
    .tts-controls-header {
        padding-right: 20px !important;
        font-size: 12px !important;
    }
    
    .tts-minimized-icon img {
        width: 35px !important;
        height: 35px !important;
    }
    
    /* Fix for minimized state on mobile - keep right position and proper width */
    .tts-auto-controls.minimized {
        padding: 6px !important;
        right: 10px !important;
        left: auto !important;
        bottom: 10px !important;
        background: #fff !important;
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
        width: auto !important;
        min-width: auto !important;
    }
}