/**
 * Vectorizador VAE — hoja de estilos.
 * Mantiene la paleta de las herramientas DTF: negro con acento lima.
 */

:root {
    --vx-bg: #0d0d0d;
    --vx-panel: #151515;
    --vx-panel-soft: #1b1b1b;
    --vx-border: #2a2a2a;
    --vx-text: #f0f0f0;
    --vx-muted: #888888;
    --vx-accent: #d4ff00;
    --vx-danger: #ff4d4d;
    --vx-warn: #ffb020;
    --vx-font: 'Exo 2', 'Segoe UI', sans-serif;
    --vx-sidebar: 340px;
    --vx-statusbar: 32px;
}

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

/* Varios bloques de esta hoja declaran display:flex, que por especificidad
   ganaría al display:none que el navegador aplica al atributo hidden. */
[hidden] { display: none !important; }

html, body { height: 100%; }

.vx-app {
    height: 100%;
    overflow: hidden;
    font-family: var(--vx-font);
    color: var(--vx-text);
    background:
        radial-gradient(ellipse 70% 55% at 50% 0%, rgba(212, 255, 0, 0.05) 0%, transparent 55%),
        var(--vx-bg);
    display: flex;
    flex-direction: column;
}

.vx-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: var(--vx-sidebar) minmax(0, 1fr);
    /* La fila no debe crecer con su contenido: el panel tiene scroll propio
       y el lienzo se adapta al espacio que le quede. */
    grid-template-rows: minmax(0, 1fr);
}

/* --- Panel lateral --- */

.vx-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--vx-border);
    background: var(--vx-panel);
}

.vx-sidebar__head {
    padding: 1.1rem 1.25rem 0.9rem;
    border-bottom: 1px solid var(--vx-border);
}

.vx-back {
    display: inline-block;
    margin-bottom: 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--vx-muted);
    transition: color 0.15s;
}

.vx-back:hover { color: var(--vx-accent); }

.vx-title {
    font-size: 1.45rem;
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.02em;
}

.vx-subtitle {
    margin-top: 0.3rem;
    font-size: 0.76rem;
    line-height: 1.45;
    color: var(--vx-muted);
}

.vx-sidebar__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.vx-sidebar__body::-webkit-scrollbar { width: 8px; }
.vx-sidebar__body::-webkit-scrollbar-thumb { background: #2f2f2f; border-radius: 4px; }

.vx-sidebar__foot {
    padding: 0.9rem 1.25rem 1.1rem;
    border-top: 1px solid var(--vx-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--vx-panel);
}

/* --- Tarjetas --- */

.vx-card {
    padding: 0.95rem 1rem 1.05rem;
    border: 1px solid var(--vx-border);
    border-radius: 12px;
    background: var(--vx-panel-soft);
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.vx-card__heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    font-style: italic;
    letter-spacing: 0.02em;
}

.vx-card__badge {
    margin-left: auto;
    font-size: 0.66rem;
    font-style: normal;
    font-weight: 600;
    color: var(--vx-muted);
}

.vx-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 18px;
    border-radius: 5px;
    background: var(--vx-accent);
    color: #000;
    font-size: 0.62rem;
    font-style: normal;
    font-weight: 800;
}

.vx-hint {
    font-size: 0.7rem;
    line-height: 1.45;
    color: var(--vx-muted);
}

.vx-hint kbd {
    padding: 0.05rem 0.25rem;
    border: 1px solid var(--vx-border);
    border-radius: 4px;
    background: #101010;
    font-family: inherit;
    font-size: 0.66rem;
}

/* --- Carga de imagen --- */

.vx-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.vx-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 1.5rem 1rem;
    border: 1px dashed #3a3a3a;
    border-radius: 10px;
    background: rgba(212, 255, 0, 0.02);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.vx-dropzone:hover,
.vx-dropzone.is-drop {
    border-color: var(--vx-accent);
    background: rgba(212, 255, 0, 0.06);
}

.vx-dropzone__icon {
    font-size: 1.3rem;
    color: var(--vx-accent);
}

.vx-dropzone__title {
    font-size: 0.82rem;
    font-weight: 700;
}

.vx-dropzone__hint {
    font-size: 0.68rem;
    line-height: 1.4;
    color: var(--vx-muted);
}

.vx-file {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem;
    border: 1px solid var(--vx-border);
    border-radius: 10px;
    background: #101010;
}

.vx-file__thumb {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--vx-border);
    background-color: #1a1a1a;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.vx-file__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.vx-file__name {
    font-size: 0.76rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vx-file__meta {
    font-size: 0.66rem;
    color: var(--vx-muted);
}

.vx-file__remove {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border: 1px solid var(--vx-border);
    border-radius: 6px;
    background: transparent;
    color: var(--vx-muted);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.vx-file__remove:hover {
    color: var(--vx-danger);
    border-color: var(--vx-danger);
}

/* --- Campos --- */

.vx-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.vx-field__label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #cfcfcf;
}

.vx-field__value {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--vx-accent);
}

.vx-select {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--vx-border);
    border-radius: 8px;
    background: #101010;
    color: var(--vx-text);
    font-family: inherit;
    font-size: 0.76rem;
    cursor: pointer;
}

.vx-select:focus-visible {
    outline: 2px solid rgba(212, 255, 0, 0.5);
    outline-offset: 1px;
}

.vx-select--compact {
    width: auto;
    padding: 0.3rem 0.45rem;
    font-size: 0.7rem;
}

.vx-range {
    width: 100%;
    height: 4px;
    appearance: none;
    border-radius: 2px;
    background: #333;
    cursor: pointer;
}

.vx-range::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: var(--vx-accent);
    box-shadow: 0 0 0 3px rgba(212, 255, 0, 0.15);
}

.vx-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: var(--vx-accent);
}

.vx-check {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: #cfcfcf;
    cursor: pointer;
}

.vx-check input {
    margin-top: 0.1rem;
    accent-color: var(--vx-accent);
}

.vx-details {
    border-top: 1px solid var(--vx-border);
    padding-top: 0.65rem;
}

.vx-details__summary {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--vx-muted);
    cursor: pointer;
    list-style: none;
}

.vx-details__summary::marker,
.vx-details__summary::-webkit-details-marker { display: none; }

.vx-details__summary::before {
    content: '+ ';
    color: var(--vx-accent);
}

.vx-details[open] .vx-details__summary::before { content: '− '; }

.vx-details[open] .vx-details__summary { margin-bottom: 0.7rem; }

.vx-details > .vx-field,
.vx-details > .vx-check {
    margin-bottom: 0.7rem;
}

/* --- Paleta --- */

.vx-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 0.35rem;
}

.vx-palette:empty::after {
    content: 'Aún sin vectorizar';
    grid-column: 1 / -1;
    padding: 0.6rem 0;
    font-size: 0.7rem;
    color: #555;
}

.vx-swatch {
    position: relative;
    aspect-ratio: 1.35;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.05rem;
    padding: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.85);
    font-family: inherit;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.12s, border-color 0.12s;
}

.vx-swatch:hover {
    transform: translateY(-1px);
    border-color: var(--vx-accent);
}

.vx-swatch.is-light { color: rgba(0, 0, 0, 0.7); }

.vx-swatch__hex {
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.vx-swatch__share {
    font-size: 0.5rem;
    font-weight: 600;
    opacity: 0.75;
}

.vx-color-picker {
    position: fixed;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.vx-link-btn {
    align-self: flex-start;
    border: none;
    background: none;
    color: var(--vx-muted);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.15s;
}

.vx-link-btn:hover:not(:disabled) { color: var(--vx-accent); }
.vx-link-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* --- Botones --- */

.vx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1rem;
    border-radius: 9px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: transform 0.12s, background 0.15s, border-color 0.15s, color 0.15s;
}

.vx-btn:hover:not(:disabled) { transform: translateY(-1px); }
.vx-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.vx-btn--primary {
    background: var(--vx-accent);
    border-color: var(--vx-accent);
    color: #000;
}

.vx-btn--ghost {
    background: #101010;
    border-color: var(--vx-border);
    color: var(--vx-text);
}

.vx-btn--ghost:hover:not(:disabled) {
    border-color: rgba(212, 255, 0, 0.45);
    color: var(--vx-accent);
}

.vx-btn--compact {
    padding: 0.4rem 0.7rem;
    font-size: 0.7rem;
}

/* --- Progreso --- */

.vx-progress {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.vx-progress__track {
    height: 4px;
    border-radius: 2px;
    background: #2a2a2a;
    overflow: hidden;
}

.vx-progress__bar {
    width: 0;
    height: 100%;
    background: var(--vx-accent);
    transition: width 0.2s ease;
}

.vx-progress__label {
    font-size: 0.66rem;
    color: var(--vx-muted);
}

/* --- Área de trabajo --- */

.vx-workspace {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 0;
}

.vx-toolbar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--vx-border);
    background: rgba(21, 21, 21, 0.6);
}

.vx-toolbar__group {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.vx-toolbar__group--center {
    margin-left: auto;
    margin-right: auto;
}

.vx-tab {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--vx-border);
    border-radius: 7px;
    background: #101010;
    color: var(--vx-muted);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.vx-tab:hover { color: var(--vx-text); }

.vx-tab.is-active {
    background: rgba(212, 255, 0, 0.12);
    border-color: var(--vx-accent);
    color: var(--vx-accent);
}

.vx-icon-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--vx-border);
    border-radius: 7px;
    background: #101010;
    color: var(--vx-muted);
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.vx-icon-btn:hover:not(:disabled) {
    color: var(--vx-accent);
    border-color: rgba(212, 255, 0, 0.45);
}

.vx-icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.vx-icon-btn.is-active {
    color: var(--vx-accent);
    border-color: var(--vx-accent);
    background: rgba(212, 255, 0, 0.1);
}

.vx-zoom {
    min-width: 48px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #cfcfcf;
}

.vx-canvas-frame {
    position: relative;
    min-height: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse 60% 60% at 50% 40%, rgba(255, 255, 255, 0.025) 0%, transparent 60%),
        #0a0a0a;
}

.vx-canvas-frame.is-drop::after {
    content: '';
    position: absolute;
    inset: 12px;
    border: 2px dashed var(--vx-accent);
    border-radius: 14px;
    pointer-events: none;
}

/* Absoluto a propósito: los atributos width/height del canvas se fijan por JS
   en píxeles de dispositivo, y en el flujo normal ese tamaño intrínseco haría
   crecer la fila del grid, que a su vez agrandaría el canvas. */
.vx-canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

.vx-canvas.is-dragging { cursor: grabbing; }

.vx-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    pointer-events: none;
    text-align: center;
}

.vx-empty__title {
    font-size: 0.95rem;
    font-weight: 700;
    font-style: italic;
    color: #4a4a4a;
}

.vx-empty__hint {
    font-size: 0.74rem;
    color: #3d3d3d;
}

/* --- Barra inferior --- */

.vx-statsbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.55rem 0.9rem;
    border-top: 1px solid var(--vx-border);
    background: rgba(21, 21, 21, 0.6);
}

.vx-stats {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.vx-stat dt {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5c5c5c;
}

.vx-stat dd {
    font-size: 0.72rem;
    font-weight: 600;
    color: #cfcfcf;
}

.vx-export {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
}

.vx-export__scale {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #5c5c5c;
}

/* --- Barra de estado --- */

.vx-statusbar {
    flex: 0 0 var(--vx-statusbar);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-top: 1px solid var(--vx-border);
    background: var(--vx-panel);
    font-size: 0.7rem;
    color: var(--vx-muted);
}

.vx-statusbar[data-tone="ok"] { color: var(--vx-accent); }
.vx-statusbar[data-tone="warn"] { color: var(--vx-warn); }
.vx-statusbar[data-tone="error"] { color: var(--vx-danger); }

/* --- Adaptación a pantallas pequeñas --- */

@media (max-width: 900px) {
    .vx-app { overflow: auto; height: auto; min-height: 100%; }

    .vx-layout {
        grid-template-columns: 1fr;
    }

    .vx-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--vx-border);
    }

    .vx-sidebar__body { overflow: visible; }

    .vx-canvas-frame { height: 60vh; }

    .vx-statsbar { justify-content: space-between; }
    .vx-export { margin-left: 0; }
    .vx-statusbar { position: sticky; bottom: 0; }
}
