/* ================================================================
   CSARIEL'S · VIDEOS · MÓDULO PUBLICAR v1.4 (Diseño Plano y Video Ancho)
   ================================================================
   Cambios:
   - Eliminado el botón punteado tipo "lego".
   - Eliminadas las cajas de "Sin sonido", "Sin ubicación", etc.
   - Eliminado el fondo pesado del contenedor de preview.
   - Todo basado en líneas divisorias finas.
   - El video de vista previa ahora ocupa todo el ancho disponible.
   ================================================================ */

/* ----------------------------------------------------------------
   HEADER · Botones agregados con mejor espaciado
   ---------------------------------------------------------------- */
.header .header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cs-btn-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: #D4AF37;
    font-family: 'Orbitron', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.cs-btn-header:hover {
    background: rgba(212, 175, 55, 0.05);
    border-color: #D4AF37;
}
.cs-btn-header:active { transform: scale(0.96); }
.cs-btn-header .cs-ico {
    font-size: 0.9rem;
    line-height: 1;
}
.cs-btn-sonido { border-color: rgba(212, 175, 55, 0.3); }
.cs-btn-ubicacion {
    border-color: rgba(0, 229, 255, 0.3);
    color: #00E5FF;
}
.cs-btn-ubicacion:hover {
    background: rgba(0, 229, 255, 0.05);
    border-color: #00E5FF;
}

@media (max-width: 640px) {
    .header .header-actions { gap: 6px; }
    .cs-btn-header { font-size: 0.55rem; padding: 5px 10px; }
    .cs-btn-header .cs-ico { font-size: 0.75rem; }
    .cs-btn-header .cs-btn-txt { display: none; }
    .cs-btn-header { padding: 6px 10px; }
}

/* ----------------------------------------------------------------
   BOTÓN DE ARCHIVO PLANO (ADIÓS AL BORDE AMARILLO PUNTEADO)
   ---------------------------------------------------------------- */
#inputArchivoVideo,
input#inputArchivoVideo[type="file"] {
    display: none !important;
    visibility: hidden !important;
}

.cs-file-btn-wrap {
    margin-bottom: 8px;
    display: block;
}

.cs-file-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: transparent;
    /* Aquí quitamos el punteado y lo dejamos con una línea sólida fina */
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    text-align: center;
}

.cs-file-btn:hover {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.02);
}
.cs-file-btn:active { transform: scale(0.99); }

.cs-file-btn-ico {
    font-size: 1.5rem;
    line-height: 1;
    color: var(--gold);
    margin-bottom: 2px;
}
.cs-file-btn-txt {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.cs-file-btn-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.cs-file-con-archivo .cs-file-btn {
    border-color: var(--success);
}
.cs-file-con-archivo .cs-file-btn-ico { color: var(--success); }
.cs-file-con-archivo .cs-file-btn-txt { color: var(--success); }
.cs-file-con-archivo .cs-file-btn-hint { color: var(--success); }

/* ----------------------------------------------------------------
   CHIPS DE METADATA EN LAS CARDS
   ---------------------------------------------------------------- */
.video-meta-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.video-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.62rem;
    font-weight: 600;
    font-family: 'Orbitron', monospace;
    white-space: nowrap;
}
.video-chip-sonido {
    background: rgba(212, 175, 55, 0.2);
    border: 1px solid rgba(212, 175, 55, 0.55);
    color: #D4AF37;
}
.video-chip-ubicacion {
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid rgba(0, 229, 255, 0.5);
    color: #00E5FF;
}

/* ----------------------------------------------------------------
   TOAST PROPIO
   ---------------------------------------------------------------- */
.cs-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    background: var(--green-deep);
    border: 1px solid var(--gold);
    border-radius: 14px;
    color: var(--gold);
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    z-index: 99999;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    pointer-events: none;
    max-width: min(92vw, 420px);
}
.cs-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.cs-toast-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    font-family: 'Orbitron', monospace;
    font-weight: 900;
}
.cs-toast-txt { flex: 1; min-width: 0; word-wrap: break-word; }

.cs-toast-info { border-color: var(--cyan); color: var(--cyan); }
.cs-toast-success { border-color: var(--success); color: var(--success); }
.cs-toast-warning { border-color: var(--warning); color: var(--warning); }
.cs-toast-error { border-color: var(--danger); color: var(--danger); }

/* ----------------------------------------------------------------
   CONFIRM MODAL
   ---------------------------------------------------------------- */
.cs-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.cs-confirm-overlay.show { opacity: 1; visibility: visible; }

.cs-confirm-modal {
    width: min(100%, 420px);
    background: var(--green-deep);
    border: 1px solid var(--gold);
    border-radius: 20px;
    padding: 24px 22px 20px;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}
.cs-confirm-overlay.show .cs-confirm-modal { transform: scale(1); }

.cs-confirm-ico {
    width: 54px;
    height: 54px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold);
    font-family: 'Orbitron', monospace;
    font-size: 1.4rem;
}
.cs-confirm-titulo {
    font-family: 'Orbitron', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 8px;
}
.cs-confirm-mensaje {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.cs-confirm-acciones { display: flex; gap: 8px; }
.cs-confirm-btn {
    flex: 1;
    padding: 11px 16px;
    border-radius: 24px;
    font-family: 'Orbitron', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
}
.cs-confirm-cancel {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
}
.cs-confirm-cancel:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}
.cs-confirm-ok {
    background: var(--gold);
    color: var(--space);
}
.cs-confirm-danger {
    background: var(--danger);
    color: #fff;
}

/* ----------------------------------------------------------------
   BOTTOM SHEETS
   ---------------------------------------------------------------- */
.cs-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(5px);
    z-index: 9500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.cs-sheet-backdrop.show { opacity: 1; visibility: visible; }

.cs-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9501;
    max-height: 80vh;
    background: #0b1410;
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    border: 1px solid var(--glass-border);
    border-bottom: none;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}
.cs-sheet.show { transform: translateY(0); }

.cs-sheet-handle {
    padding: 8px 0 4px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}
.cs-sheet-handle::before {
    content: '';
    width: 42px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.cs-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 16px 12px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.cs-sheet-titulo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gold);
}
.cs-sheet-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}
.cs-sheet-close:hover { color: var(--danger); }

.cs-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 14px 0;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.cs-tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.cs-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.cs-sheet-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 14px;
}
.cs-buscar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border-bottom: 1px solid var(--glass-border);
    padding: 8px 0;
    margin-bottom: 12px;
}
.cs-buscar-wrap .cs-ico-buscar { color: var(--text-muted); }
.cs-buscar-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* Listas de sonidos y ubicaciones planas */
.cs-sonidos-lista { display: flex; flex-direction: column; }
.cs-sonido-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    transition: background 0.2s ease;
}
.cs-sonido-item:hover { background: rgba(255, 255, 255, 0.02); }
.cs-sonido-item.activo { background: rgba(212, 175, 55, 0.05); }
.cs-sonido-ico { font-size: 0.8rem; color: var(--gold); }
.cs-sonido-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cs-sonido-nombre { color: var(--text-primary); font-weight: 600; font-size: 0.85rem; }
.cs-sonido-artista { color: var(--text-muted); font-size: 0.7rem; }
.cs-sonido-check { color: var(--gold); font-size: 0.9rem; opacity: 0; }
.cs-sonido-item.activo .cs-sonido-check { opacity: 1; }

.cs-ubicaciones-lista { display: flex; flex-direction: column; }
.cs-ubicacion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
}
.cs-ubicacion-item:hover { background: rgba(255, 255, 255, 0.02); }
.cs-ubicacion-item.activo { background: rgba(0, 229, 255, 0.05); }
.cs-ubicacion-ico { font-size: 0.8rem; color: var(--cyan); }
.cs-ubicacion-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cs-ubicacion-nombre { color: var(--text-primary); font-weight: 600; font-size: 0.85rem; }
.cs-ubicacion-pais { color: var(--text-muted); font-size: 0.7rem; }
.cs-ubicacion-check { color: var(--cyan); font-size: 0.9rem; opacity: 0; }
.cs-ubicacion-item.activo .cs-ubicacion-check { opacity: 1; }

.cs-sheet-footer {
    flex-shrink: 0;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
}
.cs-sonido-actual, .cs-ubicacion-actual {
    flex: 1;
    min-width: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cs-btn-primary {
    padding: 10px 22px;
    background: var(--gold);
    color: var(--space);
    border: none;
    border-radius: 24px;
    font-family: 'Orbitron', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}
.cs-btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ----------------------------------------------------------------
   PREVIEW EN UPLOAD (DISEÑO PLANO Y VIDEO ANCHO)
   ---------------------------------------------------------------- */
.cs-preview-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 0;
    background: transparent;
    border-top: 1px solid var(--glass-border);
    margin-top: 16px;
    margin-bottom: 12px;
}

/* El contenedor del video ocupa todo el ancho */
.cs-preview-video {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    width: 100%;
    /* Quitamos la restricción vertical para que aproveche todo el espacio */
    max-height: 400px; 
    display: flex;
    align-items: center;
    justify-content: center;
}

.cs-preview-video video {
    width: 100%;
    height: 100%;
    max-height: 400px;
    object-fit: contain;
    background: #000;
    display: block;
}

.cs-preview-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 10px;
    background: rgba(212, 175, 55, 0.9);
    color: #05080f;
    font-family: 'Orbitron', monospace;
    font-size: 0.55rem;
    font-weight: 700;
    border-radius: 12px;
}
.cs-preview-meta { display: flex; flex-direction: column; gap: 4px; }
.cs-preview-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
}
.cs-preview-line .cs-ico { color: var(--text-muted); }
.cs-preview-txt {
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cs-preview-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.cs-btn-ghost {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
}
.cs-btn-ghost:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.cs-vacio { text-align: center; padding: 30px 20px; color: var(--text-muted); }
.cs-vacio .cs-ico-vacio { display: block; font-size: 2rem; color: var(--gold); opacity: 0.3; margin-bottom: 10px; }
.cs-vacio p { font-size: 0.8rem; margin: 0; }
.cs-borradores-lista { display: flex; flex-direction: column; gap: 10px; }

/* ----------------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------------- */
@media (min-width: 640px) {
    .cs-preview-wrap { flex-direction: row; align-items: flex-start; }
    .cs-preview-video { width: 100%; max-height: 400px; } /* Ancho completo en desktop también */
    .cs-preview-meta { flex: 1; }
}
@media (max-width: 480px) {
    .cs-sheet { max-height: 86vh; }
    .cs-sheet-header { padding: 4px 12px 10px; }
    .cs-sheet-body { padding: 10px 12px; }
    .cs-sheet-footer { padding: 10px 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
    .cs-btn-primary { padding: 9px 16px; font-size: 0.65rem; }
}

/* ----------------------------------------------------------------
   PULL TO REFRESH
   ---------------------------------------------------------------- */
html, body {
    overscroll-behavior-y: auto !important;
    -webkit-overflow-scrolling: touch;
}
#videosContainer {
    overscroll-behavior-y: auto !important;
}