/* Base */
:root {
    --bg: #0b1224;
    --panel: #0f172a;
    --panel-strong: #0c1020;
    --stroke: #1c2335;
    --muted: #9ba7bf;
    --text: #e7edf7;
    --accent: #06b6d4;
    --accent-2: #fbbf24;
    --success: #22c55e;
    --danger: #ef4444;
    --shadow: 0 20px 60px rgba(3, 7, 18, 0.45);
    --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
    overflow-x: hidden;
    min-height: 100vh;
    font-size: 13px; /* Reducido de 14px */
}

body {
    margin: 0;
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
    background: radial-gradient(circle at 20% 20%, rgba(6, 182, 212, 0.12), transparent 30%),
                radial-gradient(circle at 80% 0%, rgba(251, 191, 36, 0.12), transparent 28%),
                linear-gradient(120deg, #0b1224, #0c172f 50%, #0b1224);
    color: var(--text);
    min-height: 100vh;
}

.page {
    max-width: 1800px; /* Aumentado de 1600px */
    margin: 0 auto;
    padding: 12px 16px; /* Reducido padding */
    min-height: calc(100vh - 24px);
}
/* Agregar al final de style.css */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 10px 0;
    background: rgba(11, 18, 36, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--stroke);
    z-index: 10;
    font-size: 12px;
}

footer p {
    margin: 0;
    color: var(--muted);
}

footer a {
    color: var(--accent);
    text-decoration: none;
    margin-left: 5px;
    transition: color 0.15s ease;
}

footer a:hover {
    color: var(--accent-2);
    text-decoration: underline;
}
.topbar {
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius);
    padding: 10px 14px; /* Reducido */
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    margin-bottom: 6px;
}

.brand { 
    display: flex; 
    gap: 12px; 
    align-items: center; 
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    /* Si quieres seguir usando la sombra, la puedes dejar */
    box-shadow: 0 10px 25px rgba(14,165,233,0.35);
    overflow: hidden;               /* Para que la imagen no se salga */
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;        /* Opcional: quitar el degradado antiguo */
}

/* La imagen ocupa todo el recuadro, sin deformarse raro */
.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;            /* o "cover", según lo que prefieras */
    display: block;
}


.brand h1 { 
    margin: 0; 
    font-size: 16px; /* Reducido */
}

.brand p { 
    margin: 1px 0 0; 
    color: var(--muted); 
    font-size: 11px; /* Reducido */
}

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

.layout {
    display: grid;
    /* Tres columnas proporcionales: izquierda, centro, derecha */
    grid-template-columns: 0.26fr 0.48fr 0.26fr;
    gap: 10px;
    margin-top: 8px;
    height: calc(100vh - 110px);
    min-height: 600px;
}


.panel {
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    padding: 14px; /* Reducido */
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-left, .panel-right { 
    height: calc(100vh - 130px); 
    overflow-y: auto;
}

.workspace {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Reducido */
    min-width: 0;
    height: 100%;
}

.section { 
    background: var(--panel-strong); 
    border: 1px solid var(--stroke); 
    border-radius: 12px; /* Reducido */
    padding: 10px; /* Reducido */
    margin-bottom: 8px; /* Reducido */
    font-size: 12px; /* Reducido */
}

.section-head { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 8px; /* Reducido */
    margin-bottom: 8px; /* Reducido */
}

.section h3 { 
    margin: 2px 0 0; 
    font-size: 15px; /* Reducido */
}

.eyebrow { 
    text-transform: uppercase; 
    letter-spacing: .08em; 
    font-size: 11px; /* Reducido */
    color: var(--muted); 
    margin: 0; 
}

.muted { 
    color: var(--muted); 
}

.small { 
    font-size: 11px; /* Reducido */
}

.small-gap { 
    gap: 6px !important; /* Reducido */
}

.control { 
    margin-bottom: 8px; /* Reducido */
}

.control-label { 
    font-weight: 600; 
    font-size: 12px; /* Reducido */
    margin-bottom: 4px; /* Reducido */
}

.stacked { 
    display: grid; 
    gap: 8px; /* Reducido */
}

.slider-row { 
    display: flex; 
    align-items: center; 
    gap: 8px; /* Reducido */
}

.two-cols { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 8px; /* Reducido */
}

.chip-group { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 6px; /* Reducido */
}

.chip {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--stroke);
    color: var(--text);
    padding: 6px 8px; /* Reducido */
    border-radius: 999px;
    cursor: pointer;
    transition: all .15s ease;
    font-weight: 600;
    font-size: 12px; /* Reducido */
}

.chip.active, .chip:hover { 
    background: rgba(6,182,212,0.15); 
    border-color: #0ea5e9; 
    color: #e0f2fe; 
}

.fill-group .chip i { 
    margin-right: 4px; /* Reducido */
}

.pill-row { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 6px; /* Reducido */
}

.pill {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--stroke);
    padding: 8px 10px; /* Reducido */
    border-radius: 10px; /* Reducido */
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    transition: all .15s ease;
    font-size: 12px; /* Reducido */
}

.pill:hover { 
    border-color: #0ea5e9; 
}

.select, textarea, input[type="text"], input[type="number"] {
    width: 100%;
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border: 1px solid var(--stroke);
    padding: 6px 8px; /* Reducido */
    border-radius: 8px; /* Reducido */
    font-family: inherit;
    appearance: none;
    font-size: 12px; /* Reducido */
}

.select {
    background-color: rgba(255,255,255,0.06);
    background-image:
        linear-gradient(45deg, transparent 50%, #0ea5e9 50%),
        linear-gradient(135deg, #0ea5e9 50%, transparent 50%);
    background-position:
        calc(100% - 14px) calc(50% - 3px), /* Ajustado */
        calc(100% - 8px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px; /* Reducido */
    background-repeat: no-repeat;
}

.select option { 
    color: #0b1224; 
}

textarea { 
    min-height: 100px; /* Reducido de 120px */
    resize: vertical; 
    font-size: 12px; /* Reducido */
}

.color-input { 
    width: 100%; 
    height: 36px; /* Reducido */
    padding: 0; 
    border-radius: 8px; /* Reducido */
    border: 1px solid var(--stroke); 
    background: transparent; 
    border: 2px solid var(--stroke); 
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.04); 
}

.color-input.small { 
    width: 56px; /* Reducido */
    height: 28px; /* Reducido */
}

.name-row input { 
    width: 100%; 
}

.color-row { 
    display: flex; 
    align-items: center; 
    gap: 8px; /* Reducido */
}

.color-row label { 
    width: 50px; /* Reducido */
    color: var(--muted); 
    font-size: 12px; /* Reducido */
}

input[type="range"] { 
    width: 100%; 
    accent-color: #0ea5e9; 
    height: 6px; /* Reducido */
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { 
    filter: invert(80%); 
}

.color-input::-webkit-color-swatch { 
    border: 2px solid var(--stroke); 
    border-radius: 6px; /* Reducido */
}

.color-input::-moz-color-swatch { 
    border: 2px solid var(--stroke); 
    border-radius: 6px; /* Reducido */
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px; /* Reducido */
    border-radius: 999px;
    border: 1px solid var(--stroke);
    background: rgba(255,255,255,0.04);
    font-weight: 600;
    color: var(--muted);
    font-size: 11px; /* Reducido */
}

.primary-btn, .ghost-btn, .ghost-icon, .toggle-btn {
    border: 1px solid transparent;
    border-radius: 10px; /* Reducido */
    padding: 6px 10px; /* Reducido */
    font-weight: 700;
    cursor: pointer;
    background: none;
    color: var(--text);
    transition: all .15s ease;
    font-size: 12px; /* Reducido */
}

.primary-btn {
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    color: #031120;
    box-shadow: 0 10px 25px rgba(14, 165, 233, 0.35); /* Reducido */
}

.ghost-btn { 
    border-color: var(--stroke); 
    background: rgba(255,255,255,0.03); 
}

.ghost-btn.small { 
    padding: 4px 6px; /* Reducido */
    font-size: 11px; /* Reducido */
}

.ghost-icon { 
    border-color: var(--stroke); 
    background: rgba(255,255,255,0.03); 
    width: 32px; /* Reducido */
    height: 32px; /* Reducido */
    display: grid; 
    place-items: center; 
    font-size: 14px; /* Reducido */
}

.toggle-btn { 
    border-color: var(--stroke); 
    background: rgba(255,255,255,0.03); 
}

.toggle-btn.active { 
    border-color: #0ea5e9; 
    background: rgba(6,182,212,0.14); 
}

.workspace-toolbar {
    background: var(--panel-strong);
    border: 1px solid var(--stroke);
    border-radius: 12px; /* Reducido */
    padding: 6px 8px; /* Reducido */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px; /* Reducido */
    font-size: 12px; /* Reducido */
}

.toolbar-left, .toolbar-right { 
    display: flex; 
    align-items: center; 
    gap: 6px; /* Reducido */
    flex-wrap: wrap; 
}

.preview-card {
    background: var(--panel-strong);
    border: 1px solid var(--stroke);
    border-radius: 12px; /* Reducido */
    padding: 10px; /* Reducido */
    box-shadow: var(--shadow);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.preview-head { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 8px; /* Reducido */
    margin-bottom: 6px; /* Reducido */
}

.preview-head h2 { 
    font-size: 16px; /* Reducido */
    margin: 0;
}

.status { 
    padding: 4px 8px; /* Reducido */
    border-radius: 999px;
    font-weight: 700; 
    font-size: 11px; /* Reducido */
}

.status-ok { 
    background: rgba(34,197,94,0.16); 
    color: #bbf7d0; 
    border: 1px solid rgba(34,197,94,0.35); 
}

.status-warn { 
    background: rgba(251,191,36,0.16); 
    color: #fef3c7; 
    border: 1px solid rgba(251,191,36,0.35); 
}

.status-error { 
    background: rgba(239,68,68,0.16); 
    color: #fecaca; 
    border: 1px solid rgba(239,68,68,0.35); 
}
/* Asegurar que el modal móvil se vea bien */
#mobile-warning-modal .modal-card {
    background: var(--panel-strong);
    border: 2px solid var(--accent-2);
}

#mobile-warning-modal .modal-head h3 {
    color: var(--accent-2);
}

#mobile-warning-modal .help-list {
    margin: 12px 0;
    padding-left: 20px;
}

#mobile-warning-modal .help-list li {
    margin-bottom: 8px;
    color: var(--text);
}

/* REEMPLAZAR toda la sección .canvas-shell y #venn-canvas con esto: */
/* REEMPLAZAR la sección .canvas-shell con esto: */
.canvas-shell {
    position: relative;
    border: 1px dashed var(--stroke);
    border-radius: 10px;
    background: #ffffff;
    height: var(--preview-height, 520px);
    min-height: 320px;
    overflow: hidden;

    /* Antes: width: 100%; margin-top: 8px; */
    width: 100%;
    max-width: 900px;   /* <- Vista previa “fija” máxima */
    margin: 8px auto 0; /* <- Centrar dentro de la columna */

    aspect-ratio: 4 / 4;
}


#venn-canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    cursor: grab;
    /* Mantener relación de aspecto */
    object-fit: contain;
}

#venn-canvas.dragging {
    cursor: grabbing;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(11,18,36,0.65);
}

.canvas-overlay.active {
    display: flex;
}

.tab-row { 
    display: flex; 
    gap: 6px; /* Reducido */
    flex-wrap: wrap; 
}

.tab-row button {
    padding: 5px 8px; /* Reducido */
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--stroke);
    border-radius: 8px; /* Reducido */
    color: var(--text);
    cursor: pointer;
    font-size: 12px; /* Reducido */
}

.tab-row button.active { 
    border-color: #0ea5e9; 
    color: #bae6fd; 
}

.tab-panels { 
    margin-top: 8px; /* Reducido */
}

.tab-panels .panel-body { 
    display: none; 
}

.tab-panels .panel-body.active { 
    display: block; 
}

.inline-inputs { 
    display: flex; 
    gap: 6px; /* Reducido */
    align-items: center; 
    margin-top: 4px; /* Reducido */
}

.inline-inputs input { 
    width: 100%; 
}

.inline-inputs span { 
    color: var(--muted); 
    font-size: 12px; /* Reducido */
}

.radio-row { 
    display: flex; 
    align-items: center; 
    gap: 8px; /* Reducido */
    flex-wrap: wrap; 
}

.radio-row input { 
    margin-right: 4px; /* Reducido */
}

.result-card {
    margin-top: 8px; /* Reducido */
    padding: 10px; /* Reducido */
    border-radius: 10px; /* Reducido */
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--stroke);
    font-size: 12px; /* Reducido */
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(5,8,16,0.72);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px; /* Reducido */
    z-index: 20;
}

.modal.show { 
    display: flex; 
}

.modal-card {
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-radius: 14px; /* Reducido */
    padding: 12px; /* Reducido */
    width: min(680px, 100%); /* Reducido */
    box-shadow: var(--shadow);
}

.modal-card.narrow { 
    width: min(480px, 100%); /* Reducido */
}

.modal-head, .modal-foot { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 6px; /* Reducido */
}

.modal-body { 
    margin: 10px 0; /* Reducido */
}

.modal-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); /* Ajustado */
    gap: 10px; /* Reducido */
}

.help-list { 
    padding-left: 16px; /* Reducido */
    color: var(--muted); 
    line-height: 1.5; /* Reducido */
    font-size: 12px; /* Reducido */
}

.help-list li { 
    margin-bottom: 6px; /* Reducido */
}

.tab-panels textarea { 
    font-size: 12px; /* Reducido */
}

.cardinality-row {
    display: flex;
    align-items: center;
    gap: 8px; /* Reducido */
    padding: 6px 8px; /* Reducido */
    border: 1px solid var(--stroke);
    border-radius: 8px; /* Reducido */
    background: rgba(255,255,255,0.02);
    font-size: 12px; /* Reducido */
}

.cardinality-row span { 
    min-width: 110px; /* Ajustado */
    color: var(--muted); 
    font-size: 12px; /* Reducido */
}

.cardinality-row small {
    font-size: 11px; /* Reducido */
}

.pill.operations { 
    gap: 4px; /* Reducido */
}


@media (max-width: 900px) {
    .layout { 
        grid-template-columns: 1fr; 
        height: auto;
        gap: 10px;
    }
    
    .panel-left, .panel-right { 
        height: auto;
        max-height: 450px;
    }
    
    .workspace {
        order: 2;
    }
    
    .panel-left {
        order: 1;
    }
    
    .panel-right {
        order: 3;
    }
}


@media (max-width: 768px) {
    .page {
        padding: 8px 10px;
    }
    
    .layout {
        gap: 6px;
    }
    
    .brand {
        gap: 8px;
    }
    
    .brand-mark {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .brand h1 {
        font-size: 14px;
    }
    
    .brand p {
        font-size: 10px;
    }
    
    .top-actions {
        gap: 6px;
    }
    
    .two-cols {
        grid-template-columns: 1fr;
        gap: 6px;
    }
        
    .workspace-toolbar { 
        flex-direction: column; 
        align-items: stretch; 
        gap: 4px;
    }
    
    .toolbar-right { 
        width: 100%; 
        justify-content: space-between; 
    }
    
    .panel {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .layout {
        gap: 4px;
    }
    
    
    .workspace-toolbar {
        padding: 4px 6px;
    }
    
    .section {
        padding: 8px;
    }
    
    .preview-head h2 {
        font-size: 14px;
    }
    
    .preview-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .status {
        align-self: flex-start;
    }
}