:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #F9FAFB;
    --text-color: #111827;
    --border-color: #E5E7EB;
    --editor-bg: #1a1b24;
    --editor-surface: #272B40;
    --editor-border: #292e42;
    --editor-text: #a9b1d6;
    --editor-input-bg: #16161e;
    --accent-warm: #ff9e64;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

body { background-color: var(--bg-color); color: var(--text-color); line-height: 1.6; }

header { display: flex; justify-content: space-between; padding: 1rem 5%; background: white; border-bottom: 1px solid var(--border-color); }

/* Zonas de Publicidad (Crucial para no generar clics inválidos) */
.ad-zone { background: #f3f4f6; border: 1px dashed #ccc; text-align: center; margin: 1.5rem auto; position: relative; }
.ad-label { font-size: 0.7rem; color: #9ca3af; position: absolute; top: -15px; left: 50%; transform: translateX(-50%); }
.passive-ad { width: 100%; max-width: 728px; height: 90px; }
.active-ad { width: 300px; height: 250px; margin: 1rem auto; }
.sidebar-ad { width: 300px; height: 600px; margin: 0; }
.in-feed-ad { width: 100%; height: 100px; margin: 1rem 0; border: 1px dashed #ccc; background: #eef; display: flex; align-items: center; justify-content: center; }

/* ============ LAYOUT GRID (Fix margen derecho) ============ */
.layout-grid {
    display: flex;
    gap: 1.5rem;
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem;
    align-items: flex-start;
}
.content-area { flex: 1; min-width: 0; text-align: center; }
.sidebar { width: 300px; flex-shrink: 0; display: none; }
@media (min-width: 1024px) {
    .sidebar { display: block; }
}
.sticky-ad { position: sticky; top: 2rem; }

.subtitle { color: #6B7280; margin-bottom: 2rem; }

.tool-box { background: white; border-radius: 12px; padding: 2rem; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); border: 1px solid var(--border-color); }

.drop-zone { border: 2px dashed var(--primary-color); border-radius: 8px; padding: 3rem 1rem; cursor: pointer; transition: background 0.3s; }
.drop-zone:hover { background: #EEF2FF; }

.controls { margin-top: 2rem; text-align: left; }
.time-controls { display: flex; gap: 1rem; }
.control-group { margin-bottom: 1rem; flex: 1; }
.control-group label { display: block; font-weight: 600; margin-bottom: 0.5rem; }
.control-group input, .control-group select { width: 100%; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 6px; }

.cta-button { width: 100%; background: var(--primary-color); color: white; border: none; padding: 1rem; font-size: 1.1rem; font-weight: bold; border-radius: 6px; cursor: pointer; transition: background 0.3s; margin-top: 1rem; }
.cta-button:hover { background: var(--primary-hover); }

/* ============ FILE LIST (Accordion) ============ */
.file-list { margin-top: 2rem; text-align: left; }
.file-item { border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 1rem; overflow: hidden; }
.file-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; background: #fff; cursor: pointer; }
.file-header:hover { background: #f9fafb; }
.file-actions { display: flex; gap: 0.5rem; align-items: center; }
.btn-edit { background: var(--primary-color); color: white; border: none; padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; }
.btn-delete { background: #ef4444; color: white; border: none; padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; }
.btn-delete:hover { background: #dc2626; }
.file-content { display: none; padding: 1rem; border-top: 1px solid var(--border-color); background: #fafafa; }
.file-item.active .file-content { display: block; }

/* ============ DARK EDITOR (WaveSurfer) ============ */
.editor-box { background: var(--editor-bg); border-radius: 12px; padding: 1.5rem; text-align: left; }
.editor-text { color: var(--editor-text); font-size: 0.85rem; margin-bottom: 1rem; font-weight: 500; }
.waveform-ui { position: relative; width: 100%; border: 1px solid var(--editor-border); background: var(--editor-surface); border-radius: 8px; margin-bottom: 1.5rem; padding: 10px 0; overflow: hidden; min-height: 100px; }

/* WaveSurfer Region Handles — Hacerlos visibles y grandes */
.waveform-ui [data-resize] {
    width: 14px !important;
    background: var(--accent-warm) !important;
    border-radius: 4px !important;
    cursor: col-resize !important;
    opacity: 0.9 !important;
    transition: opacity 0.15s !important;
    z-index: 10 !important;
}
.waveform-ui [data-resize]:hover {
    opacity: 1 !important;
    width: 16px !important;
}

/* ============ SLIDER CONTROLS (noUiSlider themed) ============ */
.slider-controls { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.slider-group {
    flex: 1 1 220px;
    min-width: 0;
}
.slider-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.slider-label-row label {
    color: #c0caf5;
    font-size: 0.82rem;
    font-weight: 600;
}
.slider-value {
    color: var(--accent-warm);
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 50px;
    text-align: right;
}

/* noUiSlider Theme Override (Dark) */
.slider-group .noUi-target {
    background: var(--editor-input-bg);
    border: 1px solid #414868;
    border-radius: 6px;
    box-shadow: none;
    height: 10px;
}
.slider-group .noUi-connect {
    background: var(--primary-color);
    border-radius: 6px;
}
.slider-group .noUi-handle {
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    background: var(--accent-warm) !important;
    border: 2px solid #fff !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
    cursor: grab !important;
    top: -7px !important;
    right: -11px !important;
}
.slider-group .noUi-handle:active { cursor: grabbing !important; }
.slider-group .noUi-handle::before,
.slider-group .noUi-handle::after { display: none; } /* Quitar las barras internas */

/* Play Button */
.play-btn { width: 100%; background: #3b4261; color: #fff; border: 1px solid #414868; border-radius: 8px; padding: 0.8rem; font-weight: 600; cursor: pointer; transition: 0.2s; }
.play-btn:hover { background: #4f5882; }

/* ============ RESPONSIVE ============ */
@media (max-width: 600px) {
    .waveform-ui { min-height: 80px; }
    .slider-group { flex: 1 1 100%; }
    .waveform-ui [data-resize] {
        width: 20px !important;
    }
    .slider-group .noUi-handle {
        width: 28px !important;
        height: 28px !important;
        top: -10px !important;
        right: -14px !important;
    }
    .editor-box { padding: 1rem; }
    .file-header { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
}

/* ============ MODAL ============ */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: white; padding: 2rem; border-radius: 12px; text-align: center; width: 90%; max-width: 400px; }
.loader { border: 4px solid #f3f3f3; border-top: 4px solid var(--primary-color); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 1rem auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* SEO Content */
.divider { margin: 3rem 0; border: 0; border-top: 1px solid var(--border-color); }
.seo-container { max-width: 800px; margin: 0 auto 3rem; padding: 0 1rem; }
.seo-container h2 { margin-top: 2rem; margin-bottom: 1rem; }
.hidden { display: none !important; }