/**
 * ZiPi TTS - Single Line Slim Design
 */

.zipi-tts-widget {
    margin: 20px auto;
    width: 70%;
    max-width: 800px;
    background: #667eea;
    border-radius: 6px;
    padding: 6px 12px;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    height: 32px;
}

.zipi-tts-widget.theme-green {
    background: #20C063;
    box-shadow: 0 2px 12px rgba(32, 192, 99, 0.2);
}

/* Play button */
.zipi-tts-play-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    background: rgba(255, 255, 255, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    outline: none;
    position: relative;
    padding: 0 !important;
}

.zipi-tts-play-btn.loading {
    border: 2px solid transparent;
}

.zipi-tts-play-btn.loading::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: white;
    border-right-color: white;
    animation: zipi-spin 0.8s linear infinite;
}

@keyframes zipi-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.zipi-tts-play-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.05);
}

.zipi-tts-play-btn:focus {
    outline: none;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.zipi-tts-play-btn .zipi-tts-icon {
    font-size: 14px;
    color: white;
}

/* Progress bar */
.zipi-tts-progress-bar {
    flex: 1;
    background: rgba(255, 255, 255, 0.25);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    min-width: 100px;
}

.zipi-tts-progress-fill {
    background: white;
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

/* Language badge */
.zipi-tts-lang {
    font-size: 11px;
    color: white;
    font-weight: 600;
    opacity: 0.9;
    white-space: nowrap;
    min-width: 80px;
}

/* User controls - single line, collapsed by default */
.zipi-tts-user-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    transition: max-width 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    white-space: nowrap;
    max-width: 400px;
    opacity: 1;
}

.zipi-tts-user-controls.collapsed {
    max-width: 0;
    opacity: 0;
}

.zipi-tts-control-icon {
    font-size: 13px;
    color: white;
    filter: brightness(0) invert(1);
}

.zipi-tts-control-slider {
    width: 70px;
    height: 3px;
    border-radius: 2px;
    --slider-fill: 80%;
    background: linear-gradient(to right, #4CAF50 var(--slider-fill), rgba(255, 255, 255, 0.3) var(--slider-fill));
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.zipi-tts-volume {
    --slider-fill: 80%;
}

.zipi-tts-speed {
    --slider-fill: 50%; /* 100 out of 50-200 range = 50% */
}

.zipi-tts-control-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
}

.zipi-tts-control-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
}

.zipi-tts-control-value {
    font-size: 10px;
    font-weight: 600;
    color: white;
    min-width: 38px;
    text-align: right;
}

.zipi-tts-control-separator {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
}

/* Settings toggle */
.zipi-tts-settings-toggle {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 50% !important;
    color: white !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0 !important;
}

.zipi-tts-settings-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.zipi-tts-settings-toggle .icon {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.zipi-tts-settings-toggle.collapsed .icon {
    transform: rotate(180deg);
}

/* Floating widget */
.zipi-tts-widget.widget-style-floating {
    position: sticky;
    top: 20px;
    z-index: 999;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .zipi-tts-widget {
        width: 90%;
        padding: 8px 12px;
        gap: 8px;
    }
    
    .zipi-tts-play-btn {
        width: 36px;
        height: 36px;
    }
    
    .zipi-tts-play-btn .zipi-tts-icon {
        font-size: 16px;
    }
    
    .zipi-tts-control-slider {
        width: 60px;
    }
    
    .zipi-tts-lang {
        font-size: 10px;
        min-width: 70px;
    }
}

@media (max-width: 480px) {
    .zipi-tts-widget {
        width: 95%;
        gap: 6px;
    }
    
    .zipi-tts-control-slider {
        width: 50px;
    }
}

/* Loading animation */
.zipi-tts-play-btn.loading .zipi-tts-icon {
    display: inline-block;
    animation: zipi-spin 1s linear infinite;
}

@keyframes zipi-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Pointer cursor for interactive elements */
.zipi-tts-progress-bar,
.zipi-tts-control-slider {
    cursor: pointer;
}

/* Centering fix for buttons and icons */
.zipi-tts-play-btn,
.zipi-tts-settings-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    line-height: 1 !important;
}

/* SVG icon styling */
.zipi-tts-icon {
    display: block !important;
    flex-shrink: 0 !important;
}

/* Mobile responsive - controls become dropdown */
@media (max-width: 600px) {
    .zipi-tts-user-controls {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        background: inherit !important;
        z-index: 9999 !important;
        flex-direction: column !important;
        padding: 10px 15px !important;
        border-radius: 0 0 8px 8px !important;
        box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
    }

    .zipi-tts-widget {
        position: relative !important;
    }

    .zipi-tts-user-controls .zipi-tts-control-separator {
        display: none !important;
    }

    .zipi-tts-user-controls .zipi-tts-control-slider {
        width: 100% !important;
        margin: 5px 0 !important;
    }
}
