/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 10px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    scroll-behavior: smooth;
}

h1 {
    letter-spacing: -0.02em;
}

h1 span {
    font-style: italic;
    margin-left: -2px;
}

/* Righe della trascrizione */
.transcript-line {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
    background-color: white;
    position: relative;
    border-left: 4px solid transparent;
}

.transcript-line:hover {
    background-color: rgba(215, 216, 242, 1);
}

.transcript-line.confidence-low {
    border-left-color: #f59e0b;
}

.transcript-line.confidence-very-low {
    border-left-color: #ef4444;
}

.transcript-line.segment-dirty {
    box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.45);
}

.confidence-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.confidence-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.confidence-badge-critical {
    background: #fee2e2;
    color: #991b1b;
}

.segment-action-btn {
    border: 1px solid #e2e8f0;
    background: white;
    color: #334155;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 8px;
    padding: 4px 8px;
    transition: all 0.15s ease;
}

.segment-action-btn:hover {
    border-color: #6366f1;
    color: #4338ca;
    background: #eef2ff;
}

.segment-action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Textarea dinamica */
textarea {
    display: block;
    width: 100%;
    overflow: hidden;
    resize: none;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0;
    margin-top: 5px;
    background: transparent;
    transition: opacity 0.3s ease;
}

.transcript-line textarea {
    border: 2px solid transparent !important;
    border-radius: 8px;
    padding: 8px !important;
    transition: all 0.2s ease;
    outline: none !important;
}

/* Stato Focus: compare il bordo indaco quando clicchi */
.transcript-line textarea:focus {
    border-color: #6366f1 !important; /* Indigo-500 */
    background-color: #fcfcff;
}

/* Pulsante AI */
.ai-btn {
    opacity: 0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.transcript-line:hover .ai-btn {
    opacity: 1;
}

.ai-btn:disabled {
    cursor: not-allowed;
}

/* Animazione caricamento AI */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin-ai {
    animation: spin 1s linear infinite;
    color: #4f46e5;
}

/* Badge e Timecode */
.speaker-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.7rem;
    background-color: #e0e7ff;
    color: #4338ca;
    text-transform: uppercase;
}

.timecode {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #64748b;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f1f5f9;
}

.timecode:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Player fisso */
#sticky-player {
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
}

/* Stile per il video quando entra in modalità PiP manuale (CSS) */
/* Video PiP Ottimizzato */
.video-pip {
    position: fixed;
    bottom: 110px; /* Posizionato sopra lo sticky player */
    right: 20px;
    width: 280px;  /* Dimensione ridotta e fissa */
    max-width: 25vw; /* Non supererà mai il 25% della larghezza schermo */
    z-index: 50;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden; /* Taglia i bordi del video per seguire il radius */
    background: black;
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Rendi il video fluido dentro il suo contenitore mini */
.video-pip video {
    width: 100% !important;
    height: auto !important;
    display: block;
}

/* Nel tuo style.css */
#audio-player:not(.hidden) {
    margin: 20px auto;
    width: 100%;
    display: block;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

#audio-placeholderOLD {
    min-height: 200px;
    display: flex; /* Tailwind flex-col lo gestisce, ma forziamo per sicurezza */
}

/* Opzionale: un tocco di classe con barre animate */
#audio-placeholderOLD::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.2), transparent);
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20" preserveAspectRatio="none"><path d="M0 10 Q 5 0 10 10 T 20 10 T 30 10 T 40 10 T 50 10 T 60 10 T 70 10 T 80 10 T 90 10 T 100 10" fill="none" stroke="white" stroke-width="2"/></svg>');
    animation: waveMove 2s linear infinite;
}

#audio-placeholder {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden; /* Fondamentale: taglia tutto ciò che esce dai bordi */
    background: linear-gradient(to bottom right, #1e293b, #312e81);
}

#audio-placeholder::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px; /* Leggermente più alta per coprire bene il fondo */
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.3), transparent);
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20" preserveAspectRatio="none"><path d="M0 10 Q 5 0 10 10 T 20 10 T 30 10 T 40 10 T 50 10 T 60 10 T 70 10 T 80 10 T 90 10 T 100 10" fill="none" stroke="white" stroke-width="2"/></svg>');
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20" preserveAspectRatio="none"><path d="M0 10 Q 5 0 10 10 T 20 10 T 30 10 T 40 10 T 50 10 T 60 10 T 70 10 T 80 10 T 90 10 T 100 10" fill="none" stroke="white" stroke-width="2"/></svg>');
    mask-size: 200% 100%;
    animation: waveMove 4s linear infinite;
    z-index: 0; /* La tiene sullo sfondo */
    pointer-events: none; /* Evita che l'onda "intercetti" i click */
}

.hidden {
    display: none !important;
}

@keyframes waveMove {
    from { background-position: 0% 0; }
    to { background-position: 100% 0; }
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
