:root {
    --bg-dark: #2b2b2b;
    --bg-panel: #3c3c3c;
    --bg-input: #1a1a1a;
    --text-main: #ffffff;
    --text-secondary: #aaaaaa;
    --accent-red: #ff3c3c;
    --accent-green: #4caf50;
    --accent-yellow: #fdd835;
    --accent-blue: #2196f3;
    --accent-magenta: #e91e63;
    --border-color: #555;
    --font-ui: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    user-select: none;
    background-color: #121212;
    color: var(--text-main);
    font-family: var(--font-ui);
    overflow: hidden;
    /* Desktop app feel */
    height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    border: 1px solid #000;
}

/* Header & Tool Bar */
.title-bar {
    background-color: #1a1a1a;
    display: flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 13px;
    border-bottom: 1px solid #444;
}

.logo-area {
    font-weight: bold;
    margin-right: 20px;
}

.top-menu ul {
    display: flex;
    list-style: none;
    gap: 15px;
}

.top-menu li:hover {
    background: #444;
    cursor: pointer;
    border-radius: 3px;
}

.status-indicators {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.on-air-badge {
    background-color: var(--accent-red);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 900;
    animation: blink 2s infinite;
}

.mode-badge {
    background-color: #333;
    border: 1px solid #555;
    color: var(--accent-yellow);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.tool-bar {
    background-color: var(--bg-panel);
    padding: 8px;
    display: flex;
    gap: 5px;
    align-items: center;
    border-bottom: 1px solid #555;
}

.tool-btn {
    background: transparent;
    border: 1px solid transparent;
    color: white;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.tool-btn:hover {
    background: #555;
    border-color: #777;
}

.separator {
    width: 1px;
    height: 20px;
    background: #666;
    margin: 0 10px;
}

/* Dashboard */
.dashboard {
    display: grid;
    grid-template-columns: 180px 1fr 2fr 1fr 60px;
    gap: 2px;
    background-color: #000;
    padding: 2px;
}

.dash-item {
    background-color: var(--bg-panel);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    border: 1px solid #444;
}

.clock-section {
    background-color: #111;
    color: var(--accent-green);
    font-family: var(--font-mono);
    text-align: center;
}

.time-now {
    font-size: 24px;
    font-weight: bold;
}

.date-now {
    font-size: 12px;
}

.timer-countdown {
    font-size: 18px;
    margin-top: 5px;
}

.track-box {
    border-radius: 0;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.track-box.previous {
    background-color: #2c2c2c;
    color: #ffd54f;
    border-left: 4px solid #ffd54f;
}

.track-box.next {
    background-color: #2c2c2c;
    color: #4fc3f7;
    border-left: 4px solid #4fc3f7;
}

.track-box.current {
    background-color: #c8e6c988;
    color: white;
    display: block;
    overflow: hidden;
}

.label {
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: bold;
    color: #888;
    z-index: 2;
}

.automation-toolbar {
    padding: 10px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auto-switches {
    display: flex;
    gap: 5px;
}

.auto-btn {
    flex: 1;
    background: #333;
    border: 1px solid #444;
    color: #666;
    font-size: 9px;
    font-weight: 800;
    padding: 5px 2px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.auto-btn i {
    font-size: 12px;
}

.auto-btn.active {
    color: #fff;
    border-color: #555;
}

.auto-btn#toggle-time.active {
    background: #004d40;
    border-color: #00c853;
    color: #00e676;
    box-shadow: inset 0 0 10px #000, 0 0 5px #00c853;
}

.auto-btn#toggle-jingles.active {
    background: #311b92;
    border-color: #6200ea;
    color: #b388ff;
    box-shadow: inset 0 0 10px #000, 0 0 5px #6200ea;
}

.auto-btn#toggle-mix.active {
    background: #4a148c;
    border-color: #aa00ff;
    color: #ea80fc;
    box-shadow: inset 0 0 10px #000, 0 0 5px #aa00ff;
}

.auto-btn#toggle-save.active {
    background: #1b5e20;
    border-color: #2e7d32;
    color: #a5d6a7;
    box-shadow: inset 0 0 10px #000, 0 0 5px #2e7d32;
}

.auto-switches.horizontal {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 4 en una sola fila */
    gap: 4px;
}

.sidebar-auto {
    background: #1a1a1a;
    border-top: 1px solid #333;
    padding: 8px 5px;
}

.sidebar-auto .label {
    position: static;
    margin-bottom: 4px;
    display: block;
    font-size: 9px;
    color: #666;
}

.sidebar-auto .auto-btn {
    padding: 5px 2px;
    aspect-ratio: 1.1 / 1;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    font-size: 7.5px;
    text-align: center;
    height: auto;
    letter-spacing: -0.2px;
}

.sidebar-auto .auto-btn i {
    font-size: 11px;
    margin-bottom: 0;
}

.track-title {
    font-weight: bold;
    font-size: 13px;
    padding: 5px 10px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.waveform-container {
    height: 100%;
    width: 100%;
    background: #111;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    border: 1px solid #555;
    overflow: hidden;
}

#waveform-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#progress-bar {
    position: absolute;
    left: 0;
    width: 2px;
    height: 100%;
    background: #fff;
    box-shadow: 0 0 10px #fff;
    z-index: 5;
    pointer-events: none;
}

.track-info {
    position: relative;
    z-index: 2;
    padding: 10px;
    font-weight: bold;
    text-shadow: 0 0 5px #000;
}

.waveform-time {
    z-index: 2;
    display: flex;
    justify-content: space-between;
    padding: 2px 5px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.speaker-icon {
    align-items: center;
    font-size: 24px;
}

/* Main Workspace Panels */
.main-workspace {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    flex-grow: 1;
    overflow: hidden;
    background-color: #222;
    min-height: 0;
    /* Asegura que grid no se estire más allá del contenedor flex */
}

.side-panel {
    display: flex;
    flex-direction: column;
    border: 1px solid #444;
    background-color: var(--bg-dark);
    min-height: 0;
}

.panel-header {
    background-color: #333;
    padding: 5px;
    display: flex;
    align-items: center;
}

.tabs-small {
    display: flex;
    gap: 15px;
    color: var(--text-secondary);
    font-size: 14px;
    padding-left: 10px;
}

.tabs-small i.active {
    color: orange;
    border-bottom: 2px solid orange;
}

.explorer-split {
    display: flex;
    flex-grow: 1;
    min-height: 0;
}

.file-explorer {
    flex-grow: 1;
    background-color: var(--bg-input);
    padding: 10px;
    font-size: 12px;
    overflow-y: auto;
    min-height: 0;
}

.folder-item {
    color: orange;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-list {
    list-style: none;
    padding-left: 10px;
}

.file-list li {
    margin-bottom: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 240px;
}

.file-list li:hover {
    color: white;
}

/* VU Meter Vertical */
.meter-panel {
    width: 70px;
    background: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-left: 1px solid #555;
    position: relative;
}

.vu-meter {
    display: flex;
    gap: 4px;
    height: 80%;
    padding: 10px 5px;
    background: #111;
    border: 1px solid #000;
    position: relative;
}

.meter-ticks {
    position: absolute;
    left: -17px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 95%;
    font-size: 8px;
    color: #888;
    text-align: right;
    width: 15px;
}

.meter-bar {
    width: 8px;
    background: #222;
    height: 100%;
    position: relative;
}

.meter-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(to top, #04ff08, #04ff08, #FFEB3B, #F44336);
    transition: height 0.1s;
}

.mic-btn {
    margin-top: 20px;
    background: #444;
    border: 1px solid #666;
    color: white;
    padding: 10px 5px;
    width: 90%;
    font-size: 10px;
    font-weight: bold;
    border-radius: 4px;
}

/* Header & Dashboard refinements... */
.search-mini {
    display: flex;
    align-items: center;
    background: #111;
    border-radius: 4px;
    padding: 2px 8px;
    margin-left: 10px;
    border: 1px solid #333;
}

.search-mini input {
    background: transparent;
    border: none;
    color: white;
    font-size: 0.8rem;
    outline: none;
    width: 100px;
}

.playlist-tabs .tab {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.85rem;
    border-right: 1px solid #333;
    transition: background 0.2s;
}

.playlist-tabs .tab:hover {
    background: #333;
}

.playlist-tabs .tab.active {
    background: #444;
    color: var(--accent-red);
    font-weight: bold;
}

/* Center Panel (Playlist) */
.center-panel {
    display: flex;
    flex-direction: column;
    border: 1px solid #444;
    background-color: var(--bg-dark);
    height: 100%;
    /* Forzar altura total del grid */
    overflow: hidden;
    /* Evitar que sus hijos lo estiren */
}

.playlist-tabs {
    display: flex;
    background-color: #333;
}

.tab {
    padding: 8px 20px;
    background-color: #444;
    font-size: 13px;
    border-right: 1px solid #222;
    cursor: pointer;
}

.tab.active {
    background-color: var(--bg-dark);
    font-weight: bold;
    border-top: 2px solid orange;
}

.playlist-content {
    flex-grow: 1;
    background-color: var(--bg-input);
    overflow-y: auto;
    min-height: 0;
    /* Vital para que flexbox respete el overflow */
}

/* Custom Scrollbar (Estilo Industrial Dark para Playlist y Explorador) */
.playlist-content::-webkit-scrollbar,
.file-explorer::-webkit-scrollbar,
.jingle-grid::-webkit-scrollbar {
    width: 10px;
}

.playlist-content::-webkit-scrollbar-track,
.file-explorer::-webkit-scrollbar-track,
.jingle-grid::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-left: 1px solid #333;
}

.playlist-content::-webkit-scrollbar-thumb,
.file-explorer::-webkit-scrollbar-thumb,
.jingle-grid::-webkit-scrollbar-thumb {
    background: #444;
    border: 2px solid #1a1a1a;
    border-radius: 5px;
}

.playlist-content::-webkit-scrollbar-thumb:hover,
.file-explorer::-webkit-scrollbar-thumb:hover,
.jingle-grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.playlist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.playlist-table th {
    background: #333;
    text-align: left;
    padding: 8px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.playlist-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #333;
}

.playing {
    background-color: var(--accent-red) !important;
    color: white;
}

.playlist-table tr {
    cursor: pointer;
    position: relative;
}

.row-jingle {
    color: var(--accent-magenta);
    font-weight: 500;
}

.row-jingle i {
    color: var(--accent-magenta) !important;
}

.row-time {
    color: #e040fb;
    /* Magenta/Purple for time */
    font-weight: 600;
}

.row-time i {
    color: #e040fb !important;
}

.playlist-table tr:hover {
    background-color: #444;
}

.playlist-table tr.dragging {
    opacity: 0.4;
    background: #666;
}

.playlist-table tr.drag-over {
    border-top: 2px solid orange;
}

.col-actions {
    width: 40px;
    text-align: center;
}

.btn-del-track {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.playlist-table tr:hover .btn-del-track {
    opacity: 1;
}

.btn-del-track:hover {
    color: var(--accent-red);
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #333;
}

.playlist-actions {
    display: flex;
    gap: 10px;
    padding-right: 15px;
}

.action-btn-mini {
    background: #444;
    border: 1px solid #555;
    color: #ccc;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
}

.action-btn-mini:hover {
    background: #555;
    color: white;
}

/* Control row */
.playback-controls {
    background-color: var(--bg-panel);
    border-top: 1px solid #555;
    padding: 10px;
}

.status-bar {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.play-btns button,
.loop-btns button {
    width: 45px;
    height: 35px;
    font-size: 16px;
    background: linear-gradient(to bottom, #555, #333);
    border: 1px solid #666;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.play-btns button:hover,
.loop-btns button:hover {
    background: linear-gradient(to bottom, #666, #444);
    border-color: #888;
}

.play-btns .btn-play {
    color: var(--accent-green);
}

.play-btns .btn-stop {
    color: var(--accent-red);
}

#btn-shuffle.active {
    color: var(--accent-yellow);
    border-color: var(--accent-yellow);
    box-shadow: 0 0 5px var(--accent-yellow);
}

#btn-loop.active {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    box-shadow: 0 0 5px var(--accent-blue);
}

.btn-success {
    color: var(--accent-green) !important;
    border-color: var(--accent-green) !important;
    box-shadow: 0 0 10px var(--accent-green) !important;
}


.volume-slider {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
}

.volume-slider input {
    flex-grow: 1;
}

/* Right Panel Jingle Grid */
.jingle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 120px;
    gap: 4px;
    padding: 5px;
    background-color: var(--bg-input);
    flex-grow: 1;
    overflow-y: auto;
}

.jingle-btn {
    border: 1px solid #444;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px;
    font-size: 10px;
    cursor: pointer;
    border-radius: 2px;
    position: relative;
}

.jingle-btn span:first-child {
    font-weight: bold;
    color: #fff;
}

.jingle-btn strong {
    font-size: 11px;
    text-align: center;
    display: block;
    margin: auto;
}

.jingle-btn .time {
    font-size: 9px;
    align-self: flex-end;
    opacity: 0.7;
}

/* Jingle Playing State */
.playing-jingle {
    filter: brightness(1.5);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    animation: jingle-pulse 1s infinite alternate;
}

@keyframes jingle-pulse {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

.jingle-btn.blue {
    background: #0d47a1;
    border: 1px solid #1976d2;
}

.jingle-btn.green {
    background: #1b5e20;
    border: 1px solid #388e3c;
}

.jingle-btn.magenta {
    background: #4a148c;
    border: 1px solid #7b1fa2;
}

.jingle-btn.orange {
    background: #e65100;
    border: 1px solid #f57c00;
}

.jingle-btn.red {
    background: #b71c1c;
    border: 1px solid #d32f2f;
}

.jingle-btn.teal {
    background: #004d40;
    border: 1px solid #00796b;
}

.jingle-btn.gray {
    background: #37474f;
    border: 1px solid #546e7a;
    color: #cfd8dc;
}

.jingle-btn.horahora {
    background: #004d40;
    color: #4caf50;
    border: 2px solid #00c853;
}

.jingle-btn.horahora strong {
    font-size: 14px;
    color: #00e676;
    text-shadow: 0 0 5px #00e676;
}
/* Modal Settings Styles */
.modal { display: none; position: fixed; z-index: 999999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.85); backdrop-filter: blur(8px); }
.modal-content { background-color: #3c3c3c; margin: 8% auto; padding: 0; width: 450px; border: 1px solid #444; border-radius: 8px; box-shadow: 0 0 30px rgba(0,0,0,0.5); animation: modal-anim 0.3s ease-out; }
@keyframes modal-anim { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { background-color: #333; padding: 15px 20px; border-bottom: 1px solid #444; display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 16px; color: #ff9800; margin: 0; }
.close-modal { color: #888 !important; font-size: 24px; font-weight: bold; cursor: pointer; }
.close-modal:hover { color: #fff !important; }
.modal-body { padding: 20px; }
.setting-group { margin-bottom: 20px; }
.setting-group label { display: block; font-size: 13px; margin-bottom: 8px; color: #bbb; }
.setting-group input { width: 100%; padding: 10px; background: #111; border: 1px solid #444; color: white; font-size: 14px; border-radius: 4px; }
.setting-group small { display: block; font-size: 11px; color: #666; margin-top: 5px; }
.modal-footer { padding: 15px 20px; background: #252525; border-top: 1px solid #444; text-align: right; display: flex; justify-content: flex-end; gap: 10px; }
.btn-primary { background: #1976d2; color: #fff; border: none; padding: 10px 20px; cursor: pointer; border-radius: 4px; font-weight: bold; }
.btn-primary:hover { background: #2196f3; }
.btn-cancel { background: #444; color: #fff; border: 1px solid #555; padding: 10px 20px; cursor: pointer; border-radius: 4px; }
.btn-cancel:hover { background: #555; }
