/**
 * MÉTRICA RADAR V2 - Estilo Editorial (basado en Carrusel V4)
 * Fondo claro, layout full-width, tipografías Métrica
 * VERSION DEPLOY - Sin fonts locales
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&display=swap');

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

:root {
    /* Fondos y superficies - Métrica */
    --bg: #fafaf8;
    --surface: #ffffff;
    --surface-2: #F5F1EA;
    --surface-dark: #1a1a1a;

    /* Bordes */
    --border: #d4d0c8;
    --border-subtle: #e8e6e0;

    /* Textos */
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --text-light: #999999;
    --text-inverse: #ffffff;

    /* Acentos Métrica */
    --violeta: #8A3F7F;
    --dorado: #c9a87c;
    --bordo: #6B1423;
    --azul-noche: #2a3d4e;

    /* Spotify */
    --spotify: #1db954;
    --spotify-dark: #168d40;

    /* Estados */
    --success: #4a7c59;
    --error: #9a4444;
    --warning: #a67c52;

    /* Primary */
    --primary: var(--violeta);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* ================================
   HEADER PRINCIPAL
   ================================ */

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: none;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: var(--bg);
}

.header {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.header h1 {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
    letter-spacing: 1px;
    text-transform: uppercase;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.header h1 span {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-transform: none;
}

.header p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.header small {
    font-size: 10px;
    color: var(--text-light);
    letter-spacing: 0.5px;
}

/* Perfil mini */
#profile-pill {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 6px 14px 6px 6px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

#profile-pill img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

#profile-pill:hover {
    border-color: var(--primary);
    color: var(--text);
}

/* ================================
   DEMO BANNER
   ================================ */

.demo-banner {
    background: var(--dorado);
    color: var(--text);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    padding: 10px;
    text-align: center;
    display: none;
}

/* ================================
   LAYOUT PRINCIPAL - 2 COLUMNAS
   ================================ */

#app-view {
    display: grid !important;
    grid-template-columns: 420px 1fr;
    flex: 1;
    min-height: calc(100vh - 100px);
}

/* Sidebar izquierda con tabs y formularios */
.tabs {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 0;
    gap: 0;
}

.tab-btn {
    flex: none;
    width: 100%;
    border: none;
    padding: 14px 24px;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    border-left: 3px solid transparent;
}

.tab-btn:hover {
    background: var(--surface-2);
    color: var(--text);
}

.tab-btn.active {
    background: var(--surface-2);
    color: var(--primary);
    border-left-color: var(--primary);
}

/* Secciones de formulario */
.view-section {
    grid-column: 1;
    grid-row: 2;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 28px;
    display: none;
    overflow-y: auto;
    animation: fadeIn 0.25s ease-out;
}

.view-section.active {
    display: block;
}

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

/* Mesa de curaduría - ocupa el lado derecho completo */
#preview-section {
    grid-column: 2;
    grid-row: 1 / 3;
    background: var(--surface-2);
    padding: 32px;
    display: none;
    flex-direction: column;
    overflow-y: auto;
}

#preview-section h3 {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin: 0 0 8px 0;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* ================================
   INPUTS - Estilo V4
   ================================ */

.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: 'Cormorant Garamond', Georgia, serif;
    transition: border-color 0.2s;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: var(--text-light);
    font-style: italic;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

select {
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
}

/* ================================
   RANGE SLIDERS
   ================================ */

.range-container {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    margin-top: 8px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -6px;
    border: 2px solid var(--surface);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
}

.range-val {
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
}

/* ================================
   GRID
   ================================ */

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ================================
   BOTONES - Estilo Métrica V4
   ================================ */

.btn-primary {
    width: 100%;
    margin-top: 8px;
    padding: 14px 20px;
    border-radius: 2px;
    border: none;
    background: var(--primary);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--bordo);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(138, 63, 127, 0.25);
}

.btn-primary:disabled {
    background: var(--border);
    color: var(--text-light);
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

.btn-secondary {
    width: 100%;
    margin-top: 8px;
    padding: 14px 20px;
    border-radius: 2px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-ghost {
    border-radius: 2px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    padding: 10px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--text-light);
}

.btn-chip-ghost {
    border-radius: 2px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-chip-ghost:hover {
    background: var(--surface-2);
    border-color: var(--text-light);
    color: var(--text);
}

/* ================================
   LISTA ARTISTAS
   ================================ */

.artist-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.artist-item:hover {
    border-color: var(--border);
    background: var(--surface);
}

.artist-item.selected {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: inset 3px 0 0 var(--primary);
}

.artist-thumb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--border);
}

/* ================================
   STATUS MESSAGES
   ================================ */

.status {
    margin-top: 20px;
    padding: 16px;
    border-radius: 2px;
    font-size: 13px;
    line-height: 1.6;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: none;
    color: var(--text-muted);
}

.status a {
    color: var(--primary);
    text-decoration: none;
}

.status a:hover {
    text-decoration: underline;
}

/* ================================
   SPINNER
   ================================ */

.spinner {
    border: 2px solid rgba(255,255,255,0.3);
    border-left-color: white;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    animation: spin 0.7s linear infinite;
    display: none;
}

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

/* ================================
   LOGS / CUADERNOS
   ================================ */

.logs-empty {
    padding: 32px 20px;
    text-align: center;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-light);
    border: 1px dashed var(--border);
    background: var(--surface-2);
    border-radius: 2px;
}

#logs-list {
    margin-top: 16px;
}

.log-card {
    border-radius: 2px;
    border: 1px solid var(--border-subtle);
    background: var(--surface-2);
    padding: 16px;
    margin-bottom: 12px;
    font-size: 12px;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.log-card:hover {
    border-color: var(--border);
    background: var(--surface);
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.log-header-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    color: var(--text);
    font-size: 14px;
}

.log-header-pill {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 2px;
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    letter-spacing: 0.5px;
}

.log-meta {
    color: var(--text-light);
    margin-bottom: 8px;
}

.log-link a {
    color: var(--spotify);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
}

.log-link a:hover {
    text-decoration: underline;
}

/* ================================
   TRACK LIST (Mesa de Curaduría)
   ================================ */

.track-list-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 24px;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
}

.track-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface);
    cursor: grab;
    transition: background 0.15s ease;
}

.track-row:last-child {
    border-bottom: none;
}

.track-row:hover {
    background: var(--surface-2);
}

.track-row.dragging {
    opacity: 0.5;
}

.track-row.over {
    border-bottom: 2px solid var(--primary);
}

.track-img {
    width: 44px;
    height: 44px;
    border-radius: 2px;
    margin-right: 14px;
    object-fit: cover;
    background: var(--border);
}

.track-info {
    flex: 1;
    min-width: 0;
}

.track-name {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-remove-track {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 2px;
    margin-left: 8px;
    transition: all 0.2s ease;
}

.btn-remove-track:hover {
    color: var(--error);
    background: rgba(154, 68, 68, 0.08);
}

/* Scrollbar elegante */
.track-list-container::-webkit-scrollbar {
    width: 6px;
}
.track-list-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
.track-list-container::-webkit-scrollbar-track {
    background: var(--surface-2);
}

/* ================================
   BOTONES DE ACCIÓN EN PREVIEW
   ================================ */

#preview-section .btn-primary {
    background: var(--spotify);
}

#preview-section .btn-primary:hover {
    background: var(--spotify-dark);
    box-shadow: 0 4px 12px rgba(29, 185, 84, 0.25);
}

#preview-section > div:last-child {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

#preview-section > div:last-child .btn-primary,
#preview-section > div:last-child .btn-secondary {
    flex: 1;
}

/* ================================
   LOGIN VIEW
   ================================ */

#login-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 100px);
    padding: 40px;
    background: var(--surface-2);
}

#login-view h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 24px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 12px;
}

#login-view > p {
    max-width: 400px;
    text-align: center;
}

#login-view .input-group {
    max-width: 400px;
    width: 100%;
}

#login-view .btn-primary,
#login-view .btn-ghost {
    max-width: 400px;
}

/* ================================
   SORTING BUTTONS
   ================================ */

.btn-small {
    background: var(--surface) !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border) !important;
    padding: 8px 14px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    letter-spacing: 0.5px !important;
    border-radius: 2px !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: var(--surface-2) !important;
    border-color: var(--text-light) !important;
    color: var(--text) !important;
}

#staging-controls {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 2px !important;
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
}

/* ================================
   RESPONSIVE
   ================================ */

@media (max-width: 900px) {
    #app-view {
        grid-template-columns: 1fr !important;
    }

    .tabs {
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
    }

    .tab-btn {
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 12px 16px;
        white-space: nowrap;
    }

    .tab-btn.active {
        border-left-color: transparent;
        border-bottom-color: var(--primary);
    }

    .view-section {
        border-right: none;
    }

    #preview-section {
        grid-column: 1;
        border-top: 1px solid var(--border);
    }

    .header {
        padding: 16px 20px;
    }

    #profile-pill {
        right: 20px;
    }
}

@media (max-width: 600px) {
    .header h1 {
        font-size: 14px;
    }

    .header h1 span {
        display: none;
    }

    .tab-btn {
        font-size: 9px;
        padding: 10px 12px;
    }

    .view-section {
        padding: 20px;
    }

    #preview-section {
        padding: 20px;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ==================== CATÁLOGO DE SELLOS ==================== */
.label-cat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sello-chip:hover {
    transform: scale(1.02);
}

.label-album-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    border-color: var(--primary);
}

.label-album-card img {
    transition: transform 0.3s ease;
}

.label-album-card:hover img {
    transform: scale(1.05);
}
