/**
 * Script Analyzer - Frontend Stylesheet
 * @version 2.0.0
 */

/* ─── Layout ──────────────────────────────────────────────────────── */
.sa-frontend-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 30px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1d1d1f;
    line-height: 1.6;
}

/* ─── Header ──────────────────────────────────────────────────────── */
.sa-frontend-wrap .sa-fh {
    text-align: center;
    margin-bottom: 40px;
}
.sa-frontend-wrap .sa-fh h1 {
    font-size: 2rem;
    margin: 0 0 20px;
    font-weight: 800;
}
.sa-fh-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
}
.sa-fh-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.sa-fh-stat strong {
    font-size: 2rem;
    color: #2271b1;
}
.sa-fh-stat span {
    font-size: 0.85rem;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ─── Tabs ────────────────────────────────────────────────────────── */
.sa-f-tabs {
    display: flex;
    border-bottom: 2px solid #e5e5e5;
    margin-bottom: 30px;
    gap: 0;
}
.sa-f-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #646970;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}
.sa-f-tab:hover { color: #2271b1; }
.sa-f-tab.active { color: #2271b1; border-bottom-color: #2271b1; }
.sa-f-panel { display: none; }
.sa-f-panel.active { display: block; }

/* ─── Scene Cards ─────────────────────────────────────────────────── */
.sa-f-scene {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.sa-f-scene-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1d3557, #457b9d);
    color: #fff;
    cursor: pointer;
    font-size: 0.95rem;
    flex-wrap: wrap;
}
.sa-f-badge {
    background: rgba(255,255,255,0.2);
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 0.8rem;
}
.sa-f-scene-title { font-weight: 600; font-size: 1.05rem; }
.sa-f-time { background: rgba(255,255,255,0.15); padding: 3px 8px; border-radius: 4px; font-size: 0.8rem; }
.sa-f-mood { background: rgba(255,193,7,0.3); padding: 3px 8px; border-radius: 4px; font-size: 0.8rem; }
.sa-f-toggle { margin-left: auto; font-size: 0.7rem; transition: transform 0.2s; }
.sa-f-scene.collapsed .sa-f-desc,
.sa-f-scene.collapsed .sa-f-chars,
.sa-f-scene.collapsed .sa-f-shots { display: none; }
.sa-f-scene.collapsed .sa-f-toggle { transform: rotate(-90deg); }

.sa-f-desc {
    padding: 16px 20px;
    font-size: 0.95rem;
    color: #3c4349;
    border-bottom: 1px solid #f0f0f1;
    margin: 0;
}
.sa-f-chars {
    padding: 10px 20px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-bottom: 1px solid #f0f0f1;
}
.sa-f-char-tag {
    background: #e7f3ff;
    color: #1d4ed8;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ─── Shot Cards ──────────────────────────────────────────────────── */
.sa-f-shots { padding: 16px 20px 20px; }
.sa-f-shot {
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-left: 4px solid #2271b1;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.sa-f-shot-head {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.sa-f-shot-head strong { color: #2271b1; }
.sa-f-stype { background: #e7f3ff; color: #1d4ed8; padding: 2px 10px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
.sa-f-scam { color: #646970; font-size: 0.8rem; }
.sa-f-toggle { font-size: 0.7rem; margin-left: auto; transition: transform 0.2s; }
.sa-f-shot.collapsed .sa-f-shot-body { display: none; }
.sa-f-shot.collapsed .sa-f-toggle { transform: rotate(-90deg); }

.sa-f-shot-body p { margin: 4px 0; font-size: 0.9rem; }
.sa-f-shot-body strong { color: #50575e; }
.sa-f-dialogue { margin-top: 8px; }
.sa-f-dialogue pre {
    background: #fff;
    border-left: 3px solid #dba617;
    padding: 10px 14px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    margin: 6px 0 0;
}

/* ─── Prompt ──────────────────────────────────────────────────────── */
.sa-f-prompt { margin-top: 12px; border-top: 1px solid #e5e5e5; padding-top: 12px; }
.sa-f-prompt-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 12px;
    background: #f0f0f1;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #2271b1;
}
.sa-f-prompt-body { margin-top: 8px; }
.sa-f-prompt-body.sa-prompt-hidden { display: none; }
.sa-f-prompt-text {
    width: 100%;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    padding: 12px;
    background: #1d3557;
    color: #a8dadc;
    border: 1px solid #457b9d;
    border-radius: 4px;
    resize: vertical;
    line-height: 1.6;
}
.sa-f-copy {
    margin-top: 8px;
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}
.sa-f-copy:hover { background: #135e96; }

/* ─── Character Cards ─────────────────────────────────────────────── */
.sa-f-char-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-left: 5px solid #7e5bef;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}
.sa-f-char-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    background: #fafaff;
}
.sa-f-char-head h3 { margin: 0; font-size: 1.15rem; color: #1d3557; }
.sa-f-role { background: #f3e8ff; color: #7e5bef; padding: 4px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; }
.sa-f-toggle { margin-left: auto; font-size: 0.7rem; transition: transform 0.2s; }
.sa-f-char-card.collapsed .sa-f-char-body { display: none; }
.sa-f-char-card.collapsed .sa-f-toggle { transform: rotate(-90deg); }
.sa-f-char-body { padding: 16px 20px; font-size: 0.9rem; }
.sa-f-char-body p { margin: 4px 0; }
.sa-f-char-body em { color: #646970; min-width: 120px; display: inline-block; }

/* ─── Archive Grid ────────────────────────────────────────────────── */
.sa-frontend-header {
    text-align: center;
    margin-bottom: 40px;
}
.sa-frontend-header h1 { font-size: 2.2rem; margin-bottom: 8px; }
.sa-frontend-header p { color: #646970; }
.sa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.sa-card {
    display: block;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 24px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s;
}
.sa-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-2px); }
.sa-card-icon { font-size: 2rem; margin-bottom: 12px; }
.sa-card h2 { font-size: 1.1rem; margin: 0 0 10px; color: #1d3557; }
.sa-card-stats {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: #646970;
    margin-bottom: 12px;
}
.sa-card time { font-size: 0.8rem; color: #a7aaad; }
.sa-empty { text-align: center; color: #646970; font-size: 1.1rem; padding: 60px 0; }

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .sa-fh-stats { gap: 20px; }
    .sa-f-scene-head { flex-direction: column; align-items: flex-start; gap: 6px; }
    .sa-f-scene-head .sa-f-toggle { margin-left: 0; }
    .sa-f-shot-head .sa-f-toggle { margin-left: 0; }
    .sa-f-char-head .sa-f-toggle { margin-left: 0; }
}

/* ════════════════════════════════════════════════════════════════════
   SISTEMA DE COMENTARIOS PARA TOMAS Y PERSONAJES (FRONT-END)
   ════════════════════════════════════════════════════════════════════ */

.sa-comments-block {
    margin-top: 16px;
    border-top: 2px dashed #e5e5e5;
    padding: 14px;
    background: #fafafa;
    border-radius: 6px;
}

.sa-comments-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #1d3557;
    margin-bottom: 12px;
    font-weight: 600;
}

.sa-comments-header .dashicons {
    color: #2271b1;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.sa-comments-count {
    color: #646970;
    font-weight: 400;
}

.sa-comments-list {
    margin-bottom: 12px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.sa-comments-empty {
    color: #a7aaad;
    font-style: italic;
    text-align: center;
    padding: 14px 0;
    margin: 0;
    font-size: 0.85rem;
}

.sa-comment {
    display: flex;
    gap: 10px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.sa-comment-avatar img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.sa-comment-body {
    flex: 1;
    min-width: 0;
}

.sa-comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.sa-comment-author {
    color: #1d3557;
    font-size: 0.9rem;
    font-weight: 600;
}

.sa-comment-date {
    color: #a7aaad;
    font-size: 0.75rem;
}

.sa-comment-delete {
    margin-left: auto;
    background: none;
    border: none;
    color: #d63638;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 3px;
    font-size: 1rem;
}

.sa-comment-delete:hover {
    background: #ffeaea;
}

.sa-comment-content {
    font-size: 0.9rem;
    color: #3c4349;
    line-height: 1.55;
}

.sa-comment-content p {
    margin: 4px 0;
}

.sa-comment-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.sa-att-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 4px 8px;
    text-decoration: none;
    color: #2271b1;
    font-size: 0.8rem;
    transition: background 0.2s, border-color 0.2s;
}

.sa-att-item:hover {
    background: #e7f3ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.sa-att-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 3px;
    display: block;
}

.sa-att-icon .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.sa-att-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Formulario de nuevo comentario ───────────────────────────────── */
.sa-comment-form {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 12px;
}

.sa-comment-form-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #50575e;
    margin-bottom: 8px;
}

.sa-comment-form-user img {
    border-radius: 50%;
    width: 28px;
    height: 28px;
}

.sa-comment-input {
    width: 100%;
    min-height: 60px;
    font-family: inherit;
    font-size: 0.9rem;
    padding: 8px 10px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    resize: vertical;
    line-height: 1.5;
    box-sizing: border-box;
}

.sa-comment-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.sa-comment-attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.sa-att-preview-item {
    position: relative;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 2px;
    background: #fff;
}

.sa-att-preview-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 3px;
    display: block;
}

.sa-att-preview-item .sa-att-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #d63638;
    color: #fff;
    border: 2px solid #fff;
    cursor: pointer;
    padding: 0;
    line-height: 18px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.sa-att-preview-item .sa-att-remove:hover {
    background: #b32d2e;
}

.sa-comment-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.sa-comment-form-actions .button {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}

.sa-comment-form-actions .button:hover {
    background: #135e96;
    color: #fff;
}

.sa-comment-form-actions .button-secondary {
    background: #f6f7f7;
    color: #2271b1;
    border: 1px solid #2271b1;
}

.sa-comment-form-actions .button-secondary:hover {
    background: #e7f3ff;
    color: #1d4ed8;
}

.sa-comment-form-actions .sa-comment-status {
    font-size: 0.8rem;
    margin-left: auto;
}

.sa-comments-login-required {
    background: #fff5f5;
    border: 1px solid #f5c3c3;
    color: #8a2424;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    font-size: 0.85rem;
    margin: 0;
}

.sa-comments-login-required a {
    color: #2271b1;
    font-weight: 600;
}
/* ════════════════════════════════════════════════════════════════════
   v1.2.0 — NUEVOS ESTILOS FRONTEND
   ════════════════════════════════════════════════════════════════════ */

/* ─── Títulos personalizados de escena/toma ───────────────────────── */
.sa-f-scene-custom-title,
.sa-f-shot-custom-title {
    font-style: italic;
    font-weight: 600;
    color: #1d3557;
    margin-left: 4px;
}

/* ─── Estado de tomas: badges y selects ───────────────────────────── */
.sa-status-badge {
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}
.sa-f-shot-status-select,
.sa-gantt-status-select {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #dcdcde;
    background: #fff;
    cursor: pointer;
}

/* ─── Botones front ───────────────────────────────────────────────── */
.sa-f-btn {
    background: #f6f7f7;
    color: #2271b1;
    border: 1px solid #2271b1;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}
.sa-f-btn:hover {
    background: #e7f3ff;
    color: #1d4ed8;
}
.sa-f-btn-primary {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}
.sa-f-btn-primary:hover {
    background: #135e96;
    color: #fff;
}

/* ─── Formularios de edición inline ───────────────────────────────── */
.sa-edit-form-hidden { display: none !important; }
.sa-edit-scene-form,
.sa-edit-shot-form {
    background: #f6f7f7;
    border: 1px dashed #8c8f94;
    border-radius: 6px;
    padding: 14px;
    margin: 10px 0;
}
.sa-edit-scene-form h4,
.sa-edit-shot-form h5 {
    margin: 0 0 12px;
    color: #1d3557;
    font-size: 0.95rem;
}
.sa-edit-scene-form label,
.sa-edit-shot-form label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.85rem;
}
.sa-edit-label {
    display: block;
    font-weight: 600;
    color: #50575e;
    margin-bottom: 4px;
}
.sa-edit-input,
.sa-edit-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    background: #fff;
    box-sizing: border-box;
}
.sa-edit-textarea {
    resize: vertical;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
}
.sa-edit-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.sa-edit-status {
    font-size: 0.8rem;
    color: #646970;
}

/* ─── Pestañas adicionales (panel) ────────────────────────────────── */
/* Compatibilidad: .sa-f-panel activo visible; el resto oculto */
.sa-f-panel { display: none; }
.sa-f-panel.active { display: block; }
/* El partial usa .sa-tab-content para admin, pero también marcamos como panel */
#sa-tab-multimedia,
#sa-tab-script,
#sa-tab-dialogues,
#sa-tab-gantt,
#sa-tab-timeline {
    display: none;
}
#sa-tab-multimedia.active,
#sa-tab-script.active,
#sa-tab-dialogues.active,
#sa-tab-gantt.active,
#sa-tab-timeline.active {
    display: block;
}

.sa-tab-intro {
    background: #f6f7f7;
    border-left: 4px solid #2271b1;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 6px;
}
.sa-tab-intro h3 {
    margin: 0 0 6px;
    color: #1d3557;
    font-size: 1.15rem;
}
.sa-tab-intro p {
    margin: 0;
    color: #50575e;
    font-size: 0.9rem;
}
.sa-tab-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.sa-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #646970;
    font-style: italic;
    background: #fff;
    border: 1px dashed #dcdcde;
    border-radius: 6px;
}

/* ─── Multimedia ──────────────────────────────────────────────────── */
.sa-media-summary {
    display: flex;
    gap: 14px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.sa-media-stat {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: #50575e;
}
.sa-media-stat strong {
    color: #2271b1;
    font-size: 1rem;
}
.sa-media-group { margin-bottom: 25px; }
.sa-media-group-title {
    margin: 0 0 12px;
    font-size: 1rem;
    color: #1d3557;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 8px;
}
.sa-media-group-count {
    color: #646970;
    font-weight: 400;
    font-size: 0.85rem;
}
.sa-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}
.sa-media-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.sa-media-video {
    width: 100%;
    max-height: 240px;
    background: #000;
    display: block;
}
.sa-media-audio {
    width: 100%;
    padding: 10px;
    background: #f0f0f1;
}
.sa-media-image-link {
    display: block;
    background: #fafafa;
    text-align: center;
}
.sa-media-image-link img {
    max-width: 100%;
    max-height: 240px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}
.sa-media-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 30px 15px;
    background: #f0f0f1;
    color: #2271b1;
    text-decoration: none;
}
.sa-media-file .dashicons {
    font-size: 40px;
    width: 40px;
    height: 40px;
}
.sa-media-file-name {
    font-size: 0.85rem;
    text-align: center;
}
.sa-media-meta {
    padding: 10px 12px;
    font-size: 0.8rem;
    color: #50575e;
    background: #fafafa;
    border-top: 1px solid #f0f0f1;
}
.sa-media-title {
    font-weight: 600;
    color: #1d3557;
    margin-bottom: 4px;
    word-break: break-word;
}
.sa-media-target,
.sa-media-author {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 0.75rem;
}
.sa-media-target .dashicons,
.sa-media-author .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
}
.sa-media-type {
    margin-top: 4px;
    color: #646970;
    font-size: 0.7rem;
}

/* ─── Guion Original ──────────────────────────────────────────────── */
.sa-script-print-area {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 25px;
}
.sa-script-text {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    color: #1d2327;
}

/* ─── Diálogos por personaje ──────────────────────────────────────── */
.sa-dialogues-print-area {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 25px;
}
.sa-print-title {
    margin: 0 0 20px;
    color: #1d3557;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 8px;
    font-size: 1.4rem;
}
.sa-character-dialogue {
    margin-bottom: 25px;
    page-break-inside: avoid;
}
.sa-speaker-name {
    margin: 0 0 10px;
    color: #1d3557;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.sa-speaker-count {
    color: #646970;
    font-weight: 400;
    font-size: 0.85rem;
}
.sa-dialogue-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sa-dialogue-list li {
    padding: 8px 0;
    border-bottom: 1px dashed #e5e5e5;
}
.sa-dialogue-list li:last-child { border-bottom: none; }
.sa-dlg-meta {
    font-size: 0.75rem;
    color: #646970;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sa-dlg-line {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #1d2327;
}

/* ─── Gantt ───────────────────────────────────────────────────────── */
.sa-gantt-stats {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.sa-gantt-stat {
    background: #fff;
    border: 2px solid var(--stat-color, #646970);
    border-radius: 6px;
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}
.sa-gantt-stat-label {
    font-size: 0.75rem;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sa-gantt-stat-count {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--stat-color, #2271b1);
}
.sa-gantt-stat-pct {
    font-size: 0.7rem;
    color: #646970;
}
.sa-gantt-total { border-color: #1d3557; }
.sa-gantt-total .sa-gantt-stat-count { color: #1d3557; }
.sa-gantt-filters {
    margin-top: 10px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.sa-gantt-filter-label {
    font-size: 0.85rem;
    color: #50575e;
    font-weight: 600;
}
.sa-gantt-filter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}
.sa-gantt-filter-chip {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}
.sa-gantt-chart {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
}
.sa-gantt-scene-group { margin-bottom: 20px; }
.sa-gantt-scene-header {
    background: #1d3557;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px 6px 0 0;
    font-size: 0.95rem;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.sa-gantt-scene-num { font-weight: 700; }
.sa-gantt-scene-title { font-style: italic; }
.sa-gantt-scene-info { opacity: 0.85; font-size: 0.85rem; }
.sa-gantt-rows {
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-top: none;
    border-radius: 0 0 6px 6px;
}
.sa-gantt-row {
    display: grid;
    grid-template-columns: 200px 1fr 180px;
    gap: 12px;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}
.sa-gantt-row:last-child { border-bottom: none; }
.sa-gantt-row-label {
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sa-gantt-shot-num { font-weight: 600; color: #1d3557; }
.sa-gantt-shot-title { font-style: italic; color: #646970; font-size: 0.8rem; }
.sa-gantt-row-bar {
    background: #f0f0f1;
    border-radius: 4px;
    height: 24px;
    position: relative;
    overflow: hidden;
}
.sa-gantt-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s, background 0.3s;
    display: flex;
    align-items: center;
    padding: 0 8px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
}
.sa-gantt-bar-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sa-gantt-row-status { text-align: right; }

/* ─── Línea de Tiempo ─────────────────────────────────────────────── */
.sa-timeline {
    position: relative;
    padding-left: 30px;
}
.sa-tl-item {
    position: relative;
    padding-bottom: 25px;
    display: flex;
    gap: 15px;
}
.sa-tl-item:last-child { padding-bottom: 0; }
.sa-tl-item:last-child .sa-tl-line { display: none; }
.sa-tl-marker {
    position: absolute;
    left: -25px;
    top: 5px;
    width: 16px;
    height: 100%;
}
.sa-tl-dot {
    width: 16px;
    height: 16px;
    background: #2271b1;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #2271b1;
    position: relative;
    z-index: 2;
}
.sa-tl-line {
    position: absolute;
    left: 7px;
    top: 18px;
    bottom: -5px;
    width: 2px;
    background: #dcdcde;
}
.sa-tl-card {
    flex: 1;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 14px 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.sa-tl-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.sa-tl-num {
    font-weight: 700;
    color: #1d3557;
    font-size: 1rem;
}
.sa-tl-title {
    font-style: italic;
    color: #1d3557;
}
.sa-tl-badge {
    background: #1d3557;
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}
.sa-tl-loc,
.sa-tl-time,
.sa-tl-mood {
    background: #f0f0f1;
    color: #50575e;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}
.sa-tl-desc {
    font-size: 0.9rem;
    color: #3c4349;
    line-height: 1.6;
    margin-bottom: 8px;
}
.sa-tl-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: #646970;
    margin-bottom: 6px;
}
.sa-tl-progress-bar {
    background: #f0f0f1;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}
.sa-tl-progress-fill {
    background: linear-gradient(90deg, #2271b1, #00a32a);
    height: 100%;
    transition: width 0.3s;
}
.sa-tl-shots {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.sa-tl-shot {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 2px 6px 2px 2px;
    font-size: 0.8rem;
}
.sa-tl-shot-num {
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7rem;
}
.sa-tl-shot-title {
    color: #50575e;
    font-style: italic;
}

/* ─── Spinner ─────────────────────────────────────────────────────── */
.sa-spin {
    animation: sa-spin 1s linear infinite;
    display: inline-block;
}
@keyframes sa-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ─── Print / PDF ─────────────────────────────────────────────────── */
@media print {
    body.sa-printing > *:not(#sa-print-container) {
        display: none !important;
    }
    body.sa-printing #sa-print-container {
        display: block !important;
        padding: 0;
        margin: 0;
    }
    body.sa-printing #sa-print-container .sa-print-title {
        font-size: 22px;
    }
    body.sa-printing #sa-print-container .sa-script-text,
    body.sa-printing #sa-print-container .sa-dlg-line {
        font-family: 'Courier New', Courier, monospace;
        font-size: 12px;
        line-height: 1.6;
    }
    body.sa-printing #sa-print-container .sa-character-dialogue {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
}

/* ─── Responsive ajustes adicionales ──────────────────────────────── */
@media (max-width: 768px) {
    .sa-gantt-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .sa-gantt-row-status { text-align: left; }
    .sa-f-tabs {
        flex-wrap: wrap;
    }
    .sa-f-tab {
        flex: 1 1 auto;
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}
