/* Escape Files — lo propio de esta herramienta.

   Botones, tarjetas, formularios, cabecera, tipografía y temas vienen de
   assets/css/escape-ui.css, el sistema compartido de todas las herramientas.
   Aquí va SOLO lo exclusivo de Files: la tabla de archivos, las páginas de
   acceso y descarga, el instalador y la subida.

   Antes esta hoja traía un sistema de diseño entero (botones píldora sin
   borde, efecto cristal con backdrop-filter, radios propios y estilos para
   TODOS los <button>) que se peleaba con el compartido: el resultado era una
   mezcla de los dos y una página muy costosa de pintar. No vuelvas a definir
   aquí .btn, .card, input o body: si algo tiene que cambiar para todas las
   herramientas, se cambia en _comun/escape-ui.css.

   Se carga DESPUÉS de escape-ui.css. */

/* Nombres antiguos que aún usan escape-videos.css y algunos scripts.
   Solo apuntan a las fichas del sistema: aquí no se redefine ningún radio ni
   ningún color. */
:root {
    --surface-solid:  var(--surface);
    --surface-strong: var(--surface-alt);
    --muted:          var(--text-muted);
    --primary-soft:   color-mix(in srgb, var(--primary) 12%, transparent);
    --danger:         var(--error);
    --danger-soft:    var(--error-soft);
    --shadow-md:      var(--shadow-lg);
}

html { scroll-behavior: smooth; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }

body {
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--text) 6%, transparent), transparent 32%),
        var(--bg);
}

/* --- Superficies propias de Files ---------------------------------------- */
.login-container,
.hero,
.modal-content,
.download-card,
.error-card,
.section,
.panel,
.install-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* --- Cabecera ------------------------------------------------------------ */
.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* --- Botones con nombre propio de Files ----------------------------------
   Son el mismo botón principal del sistema; solo cambia la clase que usan
   estas páginas. */
.login-button,
.cta-button,
.password-form button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    background: var(--primary);
    color: var(--text-inverse);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.25s ease, background 0.3s ease, border-color 0.3s ease;
}
.login-button:hover,
.cta-button:hover,
.password-form button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}
.login-button,
.password-form button[type="submit"] { width: 100%; margin-top: 6px; }

.btn-danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
html.dark .btn-danger { color: #111113; }

/* --- Páginas de acceso, portada, descarga y error ------------------------ */
body.auth-page,
body.public-page,
body.error-page,
body.install-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-container,
.download-card,
.error-card { width: min(100%, 460px); padding: 36px; }
.hero { width: min(100%, 640px); padding: 36px; text-align: center; }

.login-header,
.hero-header,
.download-header,
.error-header { text-align: center; margin-bottom: 26px; }

.login-header h1,
.hero h1,
.download-header h1,
.error-header h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 0 8px;
    font-size: clamp(2rem, 5vw, 2.6rem);
}
.login-header p,
.hero p,
.download-header p,
.error-header p { margin: 0; color: var(--text-muted); line-height: 1.6; }

/* --- Formularios: mismo aspecto que .campo del sistema ------------------- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 7px;
    font-family: var(--fuente-corta);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.form-group textarea { min-height: 96px; }
.form-group input[type="file"] {
    width: 100%;
    padding: 0.7rem;
    border: 2px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-alt);
    color: var(--text-muted);
}
.form-group input[type="checkbox"] { width: auto; accent-color: var(--primary); }

.error-message {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--error) 35%, transparent);
    border-left: 3px solid var(--error);
    border-radius: var(--radius);
    background: var(--error-soft);
    color: var(--error);
    font-size: 0.92rem;
    line-height: 1.5;
}
.info,
.notice {
    margin-top: 22px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

/* --- Portada pública ----------------------------------------------------- */
.features { text-align: left; margin: 26px 0 28px; display: grid; gap: 10px; }
.feature {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-alt);
}
.feature-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: var(--text-inverse);
}
.feature-icon .ico { font-size: 19px; }
.feature-text { color: var(--text); line-height: 1.5; }
.hero .cta-button { min-width: 220px; }

/* --- Panel: estadísticas -------------------------------------------------
   El número y la etiqueta (.stat-value, .stat-label) los pone el sistema; aquí
   solo la caja, igual que .stat. */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.stat-card {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.stat-card.success { border-left-color: var(--success); }
.stat-card.danger  { border-left-color: var(--error); }

/* --- Panel: secciones ---------------------------------------------------- */
.section,
.panel { padding: 22px; margin-bottom: 20px; }

.section-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    font-family: var(--fuente-titulo);
    font-size: 1.35rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.section-title .file-meta {
    font-family: var(--fuente);
    font-size: 0.85rem;
    letter-spacing: 0.015em;
    text-transform: none;
}

/* --- Tabla de archivos: mismo aspecto que table.tabla -------------------- */
.file-list { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.file-list thead th {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--line);
    font-family: var(--fuente-corta);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}
.file-list td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: top;
}
.file-list tbody tr:hover { background: var(--surface-alt); }
.file-list tbody tr:last-child td { border-bottom: 0; }

.file-name { font-weight: 600; word-break: break-word; }
.file-size,
.file-meta { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; }
.file-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    font-weight: 600;
    word-break: break-all;
    text-decoration: underline;
    text-decoration-color: var(--line-strong);
    text-underline-offset: 3px;
}
.file-description {
    max-width: 280px;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
    word-break: break-word;
}

/* --- Estado del archivo: mismo aspecto que .badge ------------------------ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    font-family: var(--fuente-corta);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}
.status-active  { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.status-expired { border-color: var(--error);   color: var(--error);   background: var(--error-soft); }

/* --- Acciones de cada fila: botones pequeños de borde -------------------- */
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.action-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 0.8rem;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color var(--fast), background var(--fast), color var(--fast);
}
.action-link:hover { border-color: var(--gray-400); background: var(--gray-100); opacity: 1; text-decoration: none; }
.action-edit { color: var(--warning); }
.action-edit:hover { border-color: var(--warning); background: var(--warning-soft); }
.action-delete { color: var(--error); }
.action-delete:hover { border-color: var(--error); background: var(--error-soft); }

/* --- Ventanas -------------------------------------------------------------
   El fondo oscuro, el centrado y el desenfoque los pone .modal del sistema.
   Files las abre con la clase .active (el sistema usa .abierto). */
.modal.active { display: flex; animation: escape-aparece 200ms ease-out; }
.modal-content {
    width: min(100%, 540px);
    max-height: 88vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: var(--shadow-xl);
    animation: escape-sube 300ms ease-out;
}
.modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-family: var(--fuente-titulo);
    font-size: 1.35rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.progress {
    display: none;
    width: 100%;
    height: 8px;
    margin: 12px 0 16px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--gray-200);
}
.progress-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width 200ms ease;
}

.file-edit-info {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-alt);
}
.duplicate-item {
    margin-bottom: 8px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
    border-radius: var(--radius);
    background: var(--warning-soft);
}

/* --- Soltar archivos encima del panel -------------------------------------
   Estaba escrito dentro de dashboard.php con un recuadro blanco fijo: en tema
   oscuro el texto (del color de marca, blanco) no se veía. */
#dropOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 900;
    padding: 24px;
    align-items: center;
    justify-content: center;
    background: rgba(7, 7, 9, 0.55);
    pointer-events: none;
}
#dropOverlay.active { display: flex; }
#dropOverlay .drop-inner {
    width: min(100%, 620px);
    padding: 48px 32px;
    border: 3px dashed var(--primary);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xl);
    color: var(--text);
    font-family: var(--fuente-titulo);
    font-size: 1.8rem;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}
#dropOverlay .drop-inner small {
    display: block;
    margin-top: 8px;
    font-family: var(--fuente);
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.015em;
    text-transform: none;
    color: var(--text-muted);
}

/* --- Aviso flotante de subida ---------------------------------------------
   Lo usan el panel de archivos y el de videos; antes estaba copiado en los
   dos sitios. */
.upload-toast {
    display: none;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2000;
    max-width: min(90vw, 420px);
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--text-muted);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xl);
    color: var(--text);
    font-weight: 500;
    white-space: pre-line;
    word-break: break-word;
}
.upload-toast.active   { display: block; }
.upload-toast.success  { border-left-color: var(--success); }
.upload-toast.error    { border-left-color: var(--error); color: var(--error); }
.upload-toast.progress { border-left-color: var(--primary); }

/* --- Página de descarga y de error --------------------------------------- */
.download-card,
.error-card { text-align: center; }
.password-form { margin-top: 22px; text-align: left; }
.error-code {
    margin-bottom: 8px;
    font-family: var(--fuente-corta);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    padding: 0.6rem 1.1rem;
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--text);
    font-weight: 500;
}
.back-link:hover { border-color: var(--gray-400); background: var(--gray-100); opacity: 1; }

/* --- Diagnóstico ---------------------------------------------------------- */
.diag-table { width: 100%; margin-top: 10px; border-collapse: collapse; }
.diag-table th,
.diag-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: top;
    font-size: 0.88rem;
}
.diag-table th {
    font-family: var(--fuente-corta);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.diag-table code { font-size: 0.82rem; word-break: break-all; }
.si  { color: var(--success); font-weight: 600; }
.no  { color: var(--error);   font-weight: 600; }
.ojo { color: var(--warning); font-weight: 600; }

/* --- Instalador ----------------------------------------------------------- */
.install-card { width: min(100%, 760px); padding: 36px; }
.install-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}
.install-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--primary);
    color: var(--text-inverse);
    font-family: var(--fuente-corta);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.install-title { margin: 10px 0 8px; font-size: clamp(2.2rem, 5vw, 3rem); }
.install-subtitle { margin: 0; color: var(--text-muted); line-height: 1.6; }
.install-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 18px;
    margin-top: 22px;
}
.install-panel {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-alt);
}
.install-panel h2,
.install-panel h3 { margin: 0 0 12px; font-size: 1.3rem; }
.install-status-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.install-status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.install-status-ok  { color: var(--success); background: var(--success-soft); }
.install-status-bad { color: var(--error);   background: var(--error-soft); }
.install-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.install-note { margin-top: 16px; color: var(--text-muted); font-size: 0.92rem; }

/* --- Pantallas estrechas -------------------------------------------------- */
@media (max-width: 768px) {
    .login-container,
    .hero,
    .download-card,
    .error-card { padding: 24px; }

    .section,
    .panel { padding: 16px; }

    .header-actions { width: 100%; }
    .header-actions .btn { flex: 1 1 auto; }

    /* La tabla pasa a tarjetas: cada archivo, un bloque. */
    .file-list,
    .file-list thead,
    .file-list tbody,
    .file-list th,
    .file-list td,
    .file-list tr { display: block; }
    .file-list thead { display: none; }
    .file-list tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
    .file-list tbody tr:hover { background: transparent; }
    .file-list td { padding: 6px 0; border: 0; }
    .file-description { max-width: none; }

    .install-hero,
    .install-grid { display: grid; grid-template-columns: 1fr; }
    .install-card { padding: 22px; }

    #dropOverlay .drop-inner { font-size: 1.4rem; padding: 36px 20px; }
}

/* --- Iconos dentro de títulos grandes y del aviso de soltar -------------- */
.login-header h1 .ico,
.hero h1 .ico { font-size: 0.78em; }
#dropOverlay .drop-inner .ico { display: block; margin: 0 auto 14px; font-size: 44px; }
