/* IMFA TTS Player - Modern Design */
.imfa-tts-player {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border-radius: 16px;
    padding: 20px 24px;
    margin: 24px 0;
    line-height: 1.5;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

/* Gradient Style (Default) */
.imfa-tts-gradient {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    color: #fff;
}
.imfa-tts-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

/* Dark Style */
.imfa-tts-dark {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Light Style */
.imfa-tts-light {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

/* Minimal Style */
.imfa-tts-minimal {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    box-shadow: none;
}

/* ========== Header ========== */
.imfa-tts-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.imfa-tts-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.imfa-tts-light .imfa-tts-icon,
.imfa-tts-minimal .imfa-tts-icon {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.imfa-tts-title {
    font-weight: 700;
    font-size: 16px;
    flex: 1;
    letter-spacing: -0.01em;
}

.imfa-tts-badge {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.imfa-tts-ready {
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.imfa-tts-pending {
    background: rgba(245, 158, 11, 0.9);
    color: #fff;
    animation: imfa-pulse 2s ease-in-out infinite;
}

@keyframes imfa-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ========== Controls ========== */
.imfa-tts-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

/* Play Button */
.imfa-tts-play {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #6366f1;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    position: relative;
}

.imfa-tts-play::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.5), rgba(255,255,255,0));
    opacity: 0;
    transition: opacity 0.3s;
}

.imfa-tts-play:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.imfa-tts-play:hover::before {
    opacity: 1;
}

.imfa-tts-play:active {
    transform: scale(0.98);
}

.imfa-tts-play .imfa-tts-icon-play,
.imfa-tts-play .imfa-tts-icon-pause {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dark & Light style play button */
.imfa-tts-dark .imfa-tts-play {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
}

.imfa-tts-light .imfa-tts-play,
.imfa-tts-minimal .imfa-tts-play {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
}

/* Progress Section */
.imfa-tts-progress {
    flex: 1;
    min-width: 0;
}

.imfa-tts-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: height 0.2s;
}

.imfa-tts-progress-bar:hover {
    height: 10px;
}

.imfa-tts-progress-fill {
    height: 100%;
    width: 0;
    background: #fff;
    border-radius: 10px;
    transition: width 0.1s linear;
    position: relative;
}

.imfa-tts-progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.2s;
}

.imfa-tts-progress-bar:hover .imfa-tts-progress-fill::after {
    opacity: 1;
}

/* Light/Dark progress bar */
.imfa-tts-light .imfa-tts-progress-bar,
.imfa-tts-minimal .imfa-tts-progress-bar {
    background: #e2e8f0;
}

.imfa-tts-light .imfa-tts-progress-fill,
.imfa-tts-minimal .imfa-tts-progress-fill {
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
}

.imfa-tts-dark .imfa-tts-progress-bar {
    background: rgba(255, 255, 255, 0.15);
}

/* Time Display */
.imfa-tts-time {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-top: 8px;
    opacity: 0.9;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Speed Button */
.imfa-tts-speed {
    padding: 8px 14px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
    min-width: 50px;
}

.imfa-tts-speed:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

.imfa-tts-light .imfa-tts-speed,
.imfa-tts-minimal .imfa-tts-speed {
    background: #e2e8f0;
    color: #475569;
}

.imfa-tts-light .imfa-tts-speed:hover,
.imfa-tts-minimal .imfa-tts-speed:hover {
    background: #cbd5e1;
}

.imfa-tts-dark .imfa-tts-speed {
    background: rgba(255, 255, 255, 0.1);
}

/* Hide audio element */
.imfa-tts-audio {
    display: none;
}

/* ========== Messages ========== */
.imfa-tts-message {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.imfa-tts-light .imfa-tts-message,
.imfa-tts-minimal .imfa-tts-message {
    background: #f1f5f9;
    color: #64748b;
}

.imfa-tts-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: imfa-spin 0.8s linear infinite;
}

.imfa-tts-light .imfa-tts-spinner,
.imfa-tts-minimal .imfa-tts-spinner {
    border-color: #e2e8f0;
    border-top-color: #6366f1;
}

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

/* ========== Playing State ========== */
.imfa-tts-player.is-playing .imfa-tts-play {
    animation: imfa-playing 1.5s ease-in-out infinite;
}

@keyframes imfa-playing {
    0%, 100% { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15); }
    50% { box-shadow: 0 4px 25px rgba(99, 102, 241, 0.4); }
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
    .imfa-tts-player {
        padding: 16px 18px;
        border-radius: 14px;
        margin: 16px 0;
    }
    
    .imfa-tts-header {
        margin-bottom: 14px;
    }
    
    .imfa-tts-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
        border-radius: 10px;
    }
    
    .imfa-tts-title {
        font-size: 15px;
    }
    
    .imfa-tts-badge {
        padding: 4px 10px;
        font-size: 10px;
    }
    
    .imfa-tts-controls {
        gap: 12px;
    }
    
    .imfa-tts-play {
        width: 46px;
        height: 46px;
        font-size: 18px;
    }
    
    .imfa-tts-time {
        font-size: 12px;
    }
    
    .imfa-tts-speed {
        padding: 6px 12px;
        font-size: 12px;
        min-width: 44px;
    }
}

/* ========== Print ========== */
@media print {
    .imfa-tts-player {
        display: none !important;
    }
}

.imfa-tts-icon-play,
.imfa-tts-icon-pause {
    display: flex;
    align-items: center;
    justify-content: center;
}

.imfa-tts-icon-play svg,
.imfa-tts-icon-pause svg {
    width: 24px;
    height: 24px;
}

.imfa-tts-icon-pause {
    display: none;
}