/* =====================================================
   Aideas Herramientas — Estilos de la suite web
   Hereda la estética glassmorphism de la app v2 de escritorio
   (paleta dual violeta MP4 / naranja MP3, blobs, shimmer).
   ===================================================== */

:root {
    --brand-purple: #7a3cf6;
    --brand-purple-dark: #581cda;
    --brand-purple-light: #a37cff;
    --mp3-orange: #ff9d3c;
    --mp3-orange-dark: #d65d00;
    --bg-1: #0f0c29;
    --bg-2: #302b63;
    --bg-3: #24243e;
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-bg-strong: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --color-success: #22c55e;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #7dd3fc;
    --accent: var(--brand-purple);
    --accent-dark: var(--brand-purple-dark);
}
body.modo-mp3 { --accent: var(--mp3-orange); --accent-dark: var(--mp3-orange-dark); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; overflow-x: hidden; }

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(-45deg, var(--bg-1), var(--bg-2), var(--bg-3), var(--brand-purple-dark));
    background-size: 400% 400%;
    animation: gradientBG 22s ease infinite;
    color: #fff;
    min-height: 100vh;
    padding: 1.2rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.blob {
    position: fixed; filter: blur(90px); z-index: -1; opacity: 0.5;
    border-radius: 50%; animation: float 14s infinite alternate ease-in-out;
    pointer-events: none;
}
.blob-1 { top: -10%; left: -10%; width: 450px; height: 450px; background: #ff00cc; }
.blob-2 { bottom: -10%; right: -10%; width: 550px; height: 550px; background: var(--brand-purple); animation-delay: -5s; }
.blob-3 { top: 40%; left: 60%; width: 320px; height: 320px; background: #00d4ff; opacity: 0.25; animation-delay: -8s; }
@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 60px) scale(1.15); }
}

.window {
    width: 100%; max-width: 880px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    animation: slideDown 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}
.body { padding: 1.8rem 1.8rem 1.4rem; }

/* ===== Header ===== */
.header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.header img {
    width: 56px; height: 56px; background: rgba(255,255,255,0.95);
    border-radius: 14px; padding: 5px;
    box-shadow: 0 8px 20px rgba(122, 60, 246, 0.3);
    transition: transform 0.3s ease;
}
.logo-link img:hover { transform: scale(1.05) rotate(-3deg); }
.titles { flex: 1; min-width: 200px; }
.title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.subtitle { font-size: 0.85rem; opacity: 0.65; margin-top: 2px; }

.user-chip {
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
    border-radius: 999px; padding: 0.3rem 0.7rem 0.3rem 0.35rem; font-size: 0.85rem;
}
.user-chip img { width: 28px; height: 28px; border-radius: 50%; padding: 0; background: none; box-shadow: none; }
.chip-link { text-decoration: none; opacity: 0.7; font-size: 1rem; }
.chip-link:hover { opacity: 1; }

/* ===== Paneles ===== */
.panel {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 18px; padding: 1.2rem; margin-bottom: 1.2rem;
}
.panel-titulo {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 700; margin-bottom: 0.9rem; font-size: 1.02rem;
}
.label { display: block; font-size: 0.8rem; opacity: 0.7; margin-bottom: 0.35rem; font-weight: 500; }
.ayuda { font-size: 0.85rem; opacity: 0.75; line-height: 1.5; margin-bottom: 0.9rem; }
.oculto { display: none !important; }

/* ===== Inputs ===== */
textarea, select, input[type="text"], input:not([type]) {
    width: 100%; background: rgba(0,0,0,0.25); color: #fff;
    border: 1px solid var(--glass-border); border-radius: 12px;
    padding: 0.7rem 0.9rem; font-family: inherit; font-size: 0.95rem;
    outline: none; transition: border-color 0.2s;
    resize: vertical;
}
textarea:focus, select:focus, input:focus { border-color: var(--accent); }
select option { background: var(--bg-3); }

.fila-url { display: flex; gap: 0.5rem; align-items: flex-start; }
.fila-url textarea { flex: 1; min-height: 46px; }

/* ===== Botones ===== */
.btn {
    border: none; border-radius: 12px; cursor: pointer;
    font-family: inherit; font-weight: 600; font-size: 0.95rem;
    padding: 0.7rem 1.1rem; color: #fff; transition: all 0.2s ease;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    text-decoration: none;
}
.btn-primario {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    box-shadow: 0 6px 18px rgba(122, 60, 246, 0.35);
}
.btn-primario:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn-primario:disabled { opacity: 0.5; cursor: wait; transform: none; }
.btn-glass { background: var(--glass-bg-strong); border: 1px solid var(--glass-border); }
.btn-glass:hover { background: rgba(255,255,255,0.16); }
.btn-grande { width: 100%; padding: 0.9rem; font-size: 1.05rem; margin-top: 1rem; }
.btn-mini { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-peligro:hover { background: rgba(239,68,68,0.25); }

/* ===== Preview ===== */
.preview {
    display: flex; gap: 0.9rem; margin-top: 0.9rem; align-items: center;
    background: rgba(0,0,0,0.2); border: 1px solid var(--glass-border);
    border-radius: 14px; padding: 0.7rem; animation: slideDown 0.4s ease;
}
.preview img { width: 120px; height: 68px; object-fit: cover; border-radius: 8px; background: #000; }
.pv-titulo { font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.pv-meta { font-size: 0.8rem; opacity: 0.65; margin-top: 4px; }

/* ===== Opciones ===== */
.opciones { display: flex; gap: 1.2rem; margin-top: 1rem; flex-wrap: wrap; align-items: flex-end; }
.opcion { flex: 1; min-width: 160px; }
.opcion.check { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.88rem; min-width: 210px; }
.opcion.check label { display: flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.opcion.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.hint {
    display: inline-flex; width: 16px; height: 16px; border-radius: 50%;
    background: var(--glass-bg-strong); font-size: 0.7rem;
    align-items: center; justify-content: center; cursor: help; opacity: 0.7;
}

.fila-recorte { display: flex; gap: 0.4rem; }
.fila-recorte input { padding: 0.55rem 0.6rem; font-size: 0.85rem; min-width: 0; }

.toggle-formato { display: flex; background: rgba(0,0,0,0.25); border-radius: 12px; padding: 4px; gap: 4px; }
.toggle-formato button {
    flex: 1; border: none; background: transparent; color: #fff; opacity: 0.6;
    padding: 0.55rem 0.6rem; border-radius: 9px; cursor: pointer;
    font-family: inherit; font-weight: 600; font-size: 0.9rem; transition: all 0.2s;
}
.toggle-formato button.activo {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    opacity: 1;
}

/* ===== Lista de jobs ===== */
.lista-jobs { display: flex; flex-direction: column; gap: 0.7rem; }
.vacio { text-align: center; opacity: 0.5; padding: 1.2rem 0; font-size: 0.9rem; }

.job {
    display: flex; gap: 0.8rem; align-items: center;
    background: rgba(0,0,0,0.2); border: 1px solid var(--glass-border);
    border-radius: 14px; padding: 0.7rem 0.9rem; animation: slideDown 0.3s ease;
}
.job-icono { font-size: 1.4rem; width: 34px; text-align: center; flex-shrink: 0; }
.job-thumb { width: 74px; height: 42px; object-fit: cover; border-radius: 7px; background: #000; flex-shrink: 0; }
.job-centro { flex: 1; min-width: 0; }
.job-titulo { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-detalle { font-size: 0.75rem; opacity: 0.65; margin-top: 2px; }
.job-msj { font-size: 0.75rem; margin-top: 2px; color: var(--color-error); }

.job-barra { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.job-barra-fill {
    height: 100%; border-radius: 3px; width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-dark), var(--accent));
    background-size: 200% 100%;
    animation: shimmer 1.6s linear infinite;
    transition: width 0.4s ease;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.job.completado .job-barra-fill { background: var(--color-success); animation: none; }

.job-acciones { display: flex; gap: 0.4rem; flex-shrink: 0; }
.badge {
    font-size: 0.68rem; padding: 2px 8px; border-radius: 999px;
    background: var(--glass-bg-strong); white-space: nowrap;
}
.badge.ok { background: rgba(34,197,94,0.25); color: #7ee2a3; }
.badge.err { background: rgba(239,68,68,0.25); color: #f3a1a1; }

/* ===== Login / portal ===== */
.login-box { text-align: center; padding: 2rem 0.5rem 2.4rem; }
.login-texto { opacity: 0.8; margin-bottom: 1.4rem; line-height: 1.5; }
.login-box .btn-grande { max-width: 320px; margin: 0 auto; }

.grilla-herramientas {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem; margin-top: 0.4rem;
}
.card-herramienta {
    position: relative; display: block; text-decoration: none; color: #fff;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 18px; padding: 1.4rem 1.2rem; transition: all 0.25s ease;
}
.card-herramienta:not(.inactiva):hover {
    transform: translateY(-4px);
    border-color: var(--brand-purple-light);
    box-shadow: 0 12px 30px rgba(122, 60, 246, 0.25);
}
.card-herramienta.inactiva { opacity: 0.45; }
.card-icono { font-size: 2rem; margin-bottom: 0.6rem; }
.card-nombre { font-weight: 700; font-size: 1.05rem; }
.card-desc { font-size: 0.82rem; opacity: 0.7; margin-top: 4px; line-height: 1.4; }
.card-badge {
    position: absolute; top: 12px; right: 12px; font-size: 0.65rem;
    background: var(--glass-bg-strong); border-radius: 999px; padding: 2px 9px;
}

/* ===== Admin ===== */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; }
.stat { background: rgba(0,0,0,0.2); border-radius: 12px; padding: 0.8rem; }
.stat .v { font-size: 1.3rem; font-weight: 800; }
.stat .k { font-size: 0.72rem; opacity: 0.65; margin-top: 2px; }

.lista-cookies { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.cookie-item {
    display: flex; align-items: center; gap: 0.8rem;
    background: rgba(0,0,0,0.2); border-radius: 12px; padding: 0.6rem 0.9rem; font-size: 0.88rem;
}
.cookie-item .dominio { font-weight: 700; flex: 1; }
.cookie-item .meta { opacity: 0.6; font-size: 0.78rem; }
.form-cookies { display: flex; flex-direction: column; gap: 0.6rem; }

/* ===== Historial ===== */
.historial-cuerpo { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.4rem; }
.hist-item {
    display: flex; gap: 0.7rem; align-items: baseline; font-size: 0.83rem;
    padding: 0.45rem 0.6rem; border-radius: 9px; background: rgba(0,0,0,0.18);
}
.hist-item .fecha { opacity: 0.55; font-size: 0.74rem; white-space: nowrap; }
.hist-item .titulo { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Transcribe ===== */
.separador-o {
    display: flex; align-items: center; gap: 0.8rem; margin: 0.9rem 0;
    font-size: 0.78rem; opacity: 0.55;
}
.separador-o::before, .separador-o::after {
    content: ""; flex: 1; height: 1px; background: var(--glass-border);
}
.input-archivo { padding: 0.5rem; font-size: 0.85rem; }
.input-archivo::file-selector-button {
    background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
    color: #fff; border-radius: 9px; padding: 0.45rem 0.8rem;
    font-family: inherit; cursor: pointer; margin-right: 0.7rem;
}
.texto-transcripcion {
    overflow-y: auto; white-space: pre-wrap; font-family: inherit;
    font-size: 0.9rem; line-height: 1.6; background: rgba(0,0,0,0.25);
    border-radius: 12px; padding: 1rem; max-height: 60vh;
}

/* ===== Modal ===== */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 50;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-caja {
    width: 100%; max-width: 640px; max-height: 80vh; overflow: hidden;
    background: var(--bg-3); border: 1px solid var(--glass-border);
    border-radius: 18px; padding: 1.1rem; display: flex; flex-direction: column;
}
.modal-cabecera { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 0.8rem; }

/* ===== Alertas y toasts ===== */
.alerta { border-radius: 12px; padding: 0.8rem 1rem; font-size: 0.9rem; margin-bottom: 1rem; }
.alerta.error { background: rgba(239,68,68,0.18); border: 1px solid rgba(239,68,68,0.4); }

#toasts { position: fixed; bottom: 1.2rem; right: 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 100; }
.toast {
    background: var(--bg-3); border: 1px solid var(--glass-border);
    border-left: 4px solid var(--color-info);
    border-radius: 12px; padding: 0.7rem 1rem; font-size: 0.88rem;
    box-shadow: var(--glass-shadow); animation: slideDown 0.3s ease;
    max-width: 340px;
}
.toast.ok { border-left-color: var(--color-success); }
.toast.err { border-left-color: var(--color-error); }

/* ===== Footer ===== */
.footer {
    display: flex; gap: 0.5rem; justify-content: center; margin-top: 1.4rem;
    font-size: 0.75rem; opacity: 0.45;
}
.footer a { color: #fff; }

@media (max-width: 560px) {
    .body { padding: 1.1rem; }
    .opciones { flex-direction: column; align-items: stretch; }
    .preview img { width: 90px; height: 52px; }
    .job-thumb { display: none; }
}
