/**
 * Styles pour rigolospam - Composants TTS
 */

/* === Variables === */
:root {
    --rsp-primary: #6366f1;
    --rsp-primary-dark: #4f46e5;
    --rsp-secondary: #8b5cf6;
    --rsp-accent: #10b981;
    --rsp-bg-dark: #0f0f1a;
    --rsp-bg-card: #1a1a2e;
    --rsp-bg-card-hover: #16213e;
    --rsp-text-primary: #e0e0e0;
    --rsp-text-secondary: #a0a0b0;
    --rsp-border: #2a2a4a;
    --rsp-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --rsp-radius: 12px;
    --rsp-shadow: 0 4px 20px rgba(99, 102, 241, 0.2);
}

/* === TTS Card === */
.tts-card {
    background: var(--rsp-bg-card);
    border: 1px solid var(--rsp-border);
    border-radius: var(--rsp-radius);
    padding: 24px;
    margin: 16px 0;
    max-width: 600px;
    transition: all 0.3s ease;
}

.tts-card:hover {
    background: var(--rsp-bg-card-hover);
    box-shadow: var(--rsp-shadow);
}

.tts-card__text {
    color: var(--rsp-text-primary);
    font-size: 1.1em;
    line-height: 1.8;
    margin-bottom: 20px;
    white-space: pre-wrap;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.tts-card__voice-selector {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--rsp-border);
}

.tts-card__voice-label {
    display: block;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--rsp-text-secondary);
    margin-bottom: 8px;
}

.tts-card__voice-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--rsp-border);
    border-radius: 8px;
    color: var(--rsp-text-primary);
    font-size: 0.95em;
    font-family: 'Segoe UI', system-ui, sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='%23a0a0b0'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.tts-card__voice-select:hover {
    border-color: var(--rsp-primary);
}

.tts-card__voice-select:focus {
    outline: none;
    border-color: var(--rsp-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.tts-card__voice-select option {
    background: var(--rsp-bg-card);
    color: var(--rsp-text-primary);
    padding: 8px;
}

.tts-card__controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* === TTS List === */
.tts-list {
    background: var(--rsp-bg-card);
    border: 1px solid var(--rsp-border);
    border-radius: var(--rsp-radius);
    padding: 24px;
    margin: 16px 0;
    max-width: 600px;
}

.tts-list__voice-selector {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--rsp-border);
}

.tts-list__voice-label {
    display: block;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--rsp-text-secondary);
    margin-bottom: 8px;
}

.tts-list__voice-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--rsp-border);
    border-radius: 8px;
    color: var(--rsp-text-primary);
    font-size: 0.95em;
    font-family: 'Segoe UI', system-ui, sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='%23a0a0b0'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.tts-list__voice-select:hover {
    border-color: var(--rsp-primary);
}

.tts-list__voice-select:focus {
    outline: none;
    border-color: var(--rsp-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.tts-list__voice-select option {
    background: var(--rsp-bg-card);
    color: var(--rsp-text-primary);
    padding: 8px;
}

.tts-list__controls {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--rsp-border);
}

/* === TTS Item === */
.tts-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tts-item:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--rsp-border);
}

.tts-item__text {
    color: var(--rsp-text-primary);
    font-size: 1em;
    line-height: 1.6;
    flex: 1;
    margin-right: 16px;
}

/* === TTS Button === */
.tts-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(99, 102, 241, 0.15);
    color: var(--rsp-primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.tts-button:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--rsp-primary);
    transform: translateY(-1px);
}

.tts-button:active {
    transform: translateY(0);
}

.tts-button svg {
    flex-shrink: 0;
}

.tts-button.tts-card__stop,
.tts-button.tts-list__stop,
.tts-button.is-playing {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.tts-button.tts-card__stop:hover,
.tts-button.tts-list__stop:hover,
.tts-button.is-playing:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
}

/* === Spinner === */
.tts-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-right-color: transparent;
    animation: rsp-spin 0.6s linear infinite;
}

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

/* === Pulse Animation === */
.tts-pulse {
    animation: rsp-pulse 1.5s ease-in-out infinite;
}

@keyframes rsp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* === Responsive === */
@media (max-width: 768px) {
    .tts-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .tts-item__text {
        margin-right: 0;
    }

    .tts-card__controls,
    .tts-list__controls {
        flex-direction: column;
    }

    .tts-button {
        width: 100%;
        justify-content: center;
    }
}