/* ═══════════════════════════════════════════════════════════════════════════
   estudio.css — JELYIA V2
   Mobile-First: diseñado para iPhone 16 Pro (393px) y escalado hacia arriba.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── LAYOUT PRINCIPAL ─────────────────────────────────────────────────────── */

.estudio-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: calc(100vh - 140px);
}

/* Tablet y Desktop: dos columnas */
@media (min-width: 1024px) {
    .estudio-grid {
        display: grid;
        grid-template-columns: 1fr 360px;
        gap: 24px;
        
        /* 👇 RESTAURAMOS UN VALOR NORMAL */
        height: calc(100vh - 280px); 
        
        /* 👇 ¡ESTA ES LA LÍNEA MÁGICA QUE FALTABA! 👇 */
        min-height: 0; 
        
        overflow: hidden; 
    }
}
/* ── BARRA DE CLIENTE ─────────────────────────────────────────────────────── */

.client-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    backdrop-filter: blur(12px);
    
    /* 👇 ESTAS SON LAS DOS LÍNEAS NUEVAS 👇 */
    position: relative;
    z-index: 500;
}

.client-select {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 700;
    outline: none;
    min-width: 180px;
    max-width: 260px;
    width: 100%;
}

.client-select:focus { border-color: var(--accent); }

/* ── PANELES (Drive y Chat) ───────────────────────────────────────────────── */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(12px);
    
    /* MODIFICACIÓN: Cambiamos 400px por 0 para que no empuje hacia abajo */
    min-height: 0; 
    
    height: 100%;
    max-height: 100%;
}

.panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

/* ── TOOLBAR SUPERIOR DEL DRIVE ───────────────────────────────────────────── */

.panel-header-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-wrap: wrap;
}

.drive-search-input {
    flex: 1;
    min-width: 120px;
    max-width: 280px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 7px 14px;
    border-radius: 20px;
    color: white;
    outline: none;
    font-size: 0.82rem;
}

.drive-search-input:focus { border-color: var(--accent); }

/* ── CHIPS DE SELECCIÓN ───────────────────────────────────────────────────── */

.selection-chips-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px;
    min-height: 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: min-height 0.2s;
}

.selection-chips-bar:empty {
    padding: 0;
    border-bottom: none;
}

.sel-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(16,185,129,0.12);
    border: 1px solid rgba(16,185,129,0.3);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.75rem;
    color: #10b981;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
}

.sel-chip-pending {
    background: rgba(245,158,11,0.12);
    border-color: rgba(245,158,11,0.3);
    color: #f59e0b;
}

.chip-remove {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0 2px;
    opacity: 0.7;
    line-height: 1;
    flex-shrink: 0;
}

.chip-remove:hover { opacity: 1; }

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-paired { background: #10b981; }
.dot-pending { background: #f59e0b; }

/* ── FILTROS PASTILLA ─────────────────────────────────────────────────────── */

.filter-pill {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-main);
    border-radius: 20px;
    padding: 5px 14px;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-pill:hover { background: rgba(255,255,255,0.05); }
.filter-pill.active { background: rgba(255,255,255,0.1); border-color: var(--accent); color: var(--accent); }

/* ── ENCABEZADO Y CUERPO DE LA LISTA ─────────────────────────────────────── */

.drive-list-header {
    display: grid;
    grid-template-columns: 4fr 2fr 2fr 40px;
    padding: 8px 16px;
    font-size: 0.62rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

/* En móvil ocultamos columnas secundarias */
@media (max-width: 600px) {
    .drive-list-header {
        grid-template-columns: 1fr 40px;
    }
    .drive-list-header div:nth-child(2),
    .drive-list-header div:nth-child(3) {
        display: none;
    }
}

.drive-list-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 300px;
    max-height: calc(100vh - 340px);
}

@media (max-width: 1024px) {
    .drive-list-body {
        max-height: 55vh;
    }
}

/* ── TARJETA DE ARCHIVO ───────────────────────────────────────────────────── */

.file-card {
    display: grid;
    grid-template-columns: 4fr 2fr 2fr 40px;
    align-items: center;
    padding: 7px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 8px;
    border-left: 3px solid transparent;
}

.file-card:hover { background: rgba(255,255,255,0.04); }

.file-card.selected-video {
    background: rgba(245,158,11,0.08);
    border-left-color: #f59e0b;
}

.file-card.selected-paired {
    background: rgba(16,185,129,0.08);
    border-left-color: #10b981;
}

/* En móvil ocultamos columnas secundarias */
@media (max-width: 600px) {
    .file-card {
        grid-template-columns: 1fr 40px;
    }
    .file-card > div:nth-child(2),
    .file-card > div:nth-child(3) {
        display: none;
    }
}

.f-thumb {
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.f-thumb img { width: 100%; height: 100%; object-fit: cover; }
.f-name { font-size: 0.83rem; font-weight: 600; color: var(--text-main); }

/* ── BOTONES GLASS ────────────────────────────────────────────────────────── */

.glass-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main);
    padding: 7px 14px;
    border-radius: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    font-size: 0.78rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.glass-btn:hover { background: rgba(255,255,255,0.1); }
.glass-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.glass-btn.primary { background: linear-gradient(135deg, #3b82f6, #06b6d4); border: none; color: white; }

/* ── CHAT IA ──────────────────────────────────────────────────────────────── */
.chat-messages {
    flex: 1 1 0; 
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0; 
}

.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.ai { align-self: flex-start; align-items: flex-start; }

/* --- ESTILOS DE BURBUJAS MODERNAS --- */
.msg-bubble-modern {
    max-width: 260px;
    word-wrap: break-word;
    padding: 10px 14px;
    font-size: 0.875rem;
    box-shadow: 0 10px 20px -6px rgba(0,0,0,0.15);
}

.msg.user .msg-bubble-modern {
    border-radius: 14px 14px 6px 14px;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.msg.ai .msg-bubble-modern {
    border-radius: 14px 14px 14px 6px;
    background: #4f46e5;
    color: white;
    border: none;
}

/* --- ZONA DE INPUT (CÁPSULA) --- */
.chat-input-container {
    padding: 0 16px 16px 16px;
    background: transparent;
    border: none;
    flex-shrink: 0; /* Para evitar que la cápsula se encoja */
}

.chat-input-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #101010;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 6px;
    box-shadow: 0 10px 20px -6px rgba(0,0,0,0.3);
}

.chat-textarea-modern {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 0.9rem;
    padding: 8px;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 120px;
}

.chat-textarea-modern::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chat-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    flex-shrink: 0;
}

.chat-icon-btn:active {
    transform: scale(0.95);
}

.chat-icon-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
}

.chat-icon-btn.primary {
    background: #4f46e5; 
    color: white;
}

/* ── MODAL DE PORTADA (Cover Picker) ─────────────────────────────────────── */

.cover-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 1100;
    display: flex;
    align-items: flex-end;   /* Mobile: sube desde abajo */
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 0;
}

@media (min-width: 600px) {
    .cover-modal-overlay {
        align-items: center;
        padding: 20px;
    }
}

.cover-modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px 20px 0 0;
    padding: 24px 20px 32px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: slideUp 0.25s ease;
}

@media (min-width: 600px) {
    .cover-modal-box {
        border-radius: 20px;
        padding: 28px 24px;
    }
}

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

.cover-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cover-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--accent);
}

.cover-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.cover-modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cover-option {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 12px 14px;
    transition: border-color 0.2s;
}

.cover-option:has(input:checked) {
    border-color: var(--accent);
    background: rgba(34,211,238,0.05);
}

.cover-option-header {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.cover-option-header label {
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-main);
}

.cover-option-preview {
    margin-top: 10px;
}

.cover-manual-controls {
    margin-top: 8px;
}

.cover-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* ── BANDEJA DE SALIDA: Tarjetas de Borradores ───────────────────────────── */

.draft-card {
    padding: 18px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.draft-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.draft-client { font-weight: 700; font-size: 0.88rem; color: var(--text-main); }
.draft-date { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.draft-excerpt { font-size: 0.83rem; color: var(--text-muted); line-height: 1.5; margin: 0; }

.draft-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-ok { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.badge-muted { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.1); }

.btn-accent {
    background: linear-gradient(135deg, hsl(var(--hue1) 70% 50%), hsl(var(--hue2) 70% 50%));
    border: none;
    color: white;
}

.btn-accent:hover { opacity: 0.85; }

/* ── DRIVE GRID (modo cuadrícula, no usado por defecto) ──────────────────── */

.drive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    padding: 16px;
    overflow-y: auto;
}

.drive-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.drive-card:hover { border-color: var(--accent); background: rgba(255,255,255,0.05); }
.drive-card.selected { border-color: var(--accent); background: hsl(var(--hue1) 70% 50% / 0.1); }

.drive-thumb {
    height: 72px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    overflow: hidden;
}

.drive-thumb img { width: 100%; height: 100%; object-fit: cover; }
/* ── DROPDOWN CUSTOMIZADO (Estilo Moderno / Smooth) ───────────────────────── */
.custom-dropdown {
    position: relative;
    min-width: 220px;
}

.custom-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 0;
    gap: 10px;
    user-select: none;
}

.custom-dropdown-trigger .dropdown-arrow {
    color: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Animación de la flecha al abrir */
.custom-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 12px;
    width: 280px;
    background: rgba(15, 23, 42, 0.95); /* Fondo oscuro */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px; /* Bordes bien curvos como en el ejemplo */
    padding: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
    z-index: 100;
    
    /* Animación de entrada (estilo Framer Motion) */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-15px);
    transition: all 0.25s cubic-bezier(0.215, 0.610, 0.355, 1);
}

.custom-dropdown.open .custom-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-dropdown-item {
    padding: 12px 16px;
    border-radius: 12px;
    color: #e2e8f0;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s, color 0.2s;
}

.custom-dropdown-item:hover {
    background: rgba(139, 92, 246, 0.15); /* Color de hover sutil */
    color: #fff;
}

.custom-dropdown-item.selected {
    background: rgba(139, 92, 246, 0.25);
    color: #c4b5fd; /* Violeta claro */
    font-weight: 600;
}