/* ========================================
   GADGET POPUPS - SPECTACULAR STYLES
   Portfolio Cristian Corrales
   ======================================== */

/* === CURSOR OVERRIDE (fix para custom cursor global) === */
/* Ocultar custom cursor cuando popup está abierto */
body.gadget-popup-open .cursor-dot,
body.gadget-popup-open .cursor-outline {
    display: none !important;
    opacity: 0 !important;
}
/* Hide floating elements when any popup is open */
body.gadget-popup-open .avatar-chatbot,
body.gadget-popup-open .lm-float {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s !important;
}
body.gadget-popup-open {
    cursor: auto !important;
}
.gadget-expand-backdrop,
.gadget-expand-backdrop *,
.prop-backdrop,
.prop-backdrop * {
    cursor: auto !important;
}
.gadget-expand-backdrop button,
.gadget-expand-backdrop a,
.gadget-expand-backdrop [role="button"],
.gadget-expand-backdrop input[type="range"],
.prop-backdrop button,
.prop-backdrop a,
.prop-backdrop [role="button"] {
    cursor: pointer !important;
}
.gadget-expand-backdrop input[type="text"],
.gadget-expand-backdrop input[type="email"],
.gadget-expand-backdrop textarea,
.prop-backdrop input[type="text"],
.prop-backdrop textarea {
    cursor: text !important;
}
.ss-canvas,
#lego3DCanvas {
    cursor: grab !important;
}
.ss-canvas:active,
#lego3DCanvas:active {
    cursor: grabbing !important;
}

/* === BACKDROP === */
.gadget-expand-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    z-index: 50000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: clamp(0.25rem, 2vw, 1rem);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.gadget-expand-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

/* === CONTENT CONTAINER === */
.gadget-expand-content {
    width: 100%;
    max-width: 1000px;
    max-height: calc(100dvh - clamp(0.5rem, 4vw, 2rem));
    background: linear-gradient(180deg, #0a0a12 0%, #050508 100%);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: clamp(12px, 2vw, 20px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 0 60px rgba(0, 240, 255, 0.1),
        0 25px 50px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Wide variant for complex gadgets like OCR */
.gadget-expand-content.gadget-expand-wide {
    max-width: 1150px;
}

/* Extra wide for 3D immersive experiences (Solar System, Lego) */
.gadget-expand-content.gadget-expand-fullwidth {
    max-width: calc(100vw - 2rem);
    width: calc(100vw - 2rem);
    height: calc(100dvh - 2rem);
    max-height: calc(100dvh - 2rem);
}

/* Lego canvas fills fullwidth container */
.gadget-expand-content.gadget-expand-fullwidth .expand-visual-3d {
    flex: 1;
    min-height: 0;
    border-radius: 8px;
    overflow: hidden;
}

.gadget-expand-content.gadget-expand-fullwidth #lego3DCanvas {
    height: 100% !important;
    flex: 1;
    min-height: 0;
}

/* ═══ FULLWIDTH: Immersive layout with stats visible ═══ */
.gadget-expand-content.gadget-expand-fullwidth .expand-body {
    grid-template-columns: 1fr !important;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0.5rem;
}

/* Solar: no side panel */
.gadget-expand-content.gadget-expand-fullwidth .expand-body .expand-info {
    display: none !important;
}

/* Lego: show stats as overlay bar at top-right */
.gadget-expand-content.gadget-expand-fullwidth .expand-body-lego {
    grid-template-columns: 1fr 280px !important;
    gap: 0.5rem;
}

.gadget-expand-content.gadget-expand-fullwidth .expand-body-lego .expand-info {
    display: flex !important;
    overflow-y: auto;
    max-height: 100%;
    scrollbar-width: none;
}

.gadget-expand-content.gadget-expand-fullwidth .expand-body-lego .expand-info::-webkit-scrollbar {
    display: none;
}

/* ═══ FULLWIDTH: Lego controls as overlay ═══ */
.gadget-expand-content.gadget-expand-fullwidth .lego-3d-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85) 30%);
    gap: 0.45rem;
    justify-content: center;
    z-index: 20;
    flex-wrap: wrap;
}

.gadget-expand-content.gadget-expand-fullwidth .lego-3d-btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.72rem;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.gadget-expand-content.gadget-expand-fullwidth .lego-hint {
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 20;
    white-space: nowrap;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═══ FULLWIDTH: Compact header for immersive experience ═══ */
.gadget-expand-content.gadget-expand-fullwidth .expand-header {
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.gadget-expand-content.gadget-expand-fullwidth .expand-title h3 {
    font-size: 1rem;
}

.gadget-expand-content.gadget-expand-fullwidth .expand-title p {
    display: none;
}

.gadget-expand-content.gadget-expand-fullwidth .expand-title > i {
    font-size: 1.2rem;
}

/* Solar System Container */
#solarSystemContainer {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#solarSystemContainer .ss-viewport {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
}
#solarSystemContainer .ss-canvas {
    width: 100% !important;
    height: 100% !important;
}

.gadget-expand-backdrop.open .gadget-expand-content {
    transform: scale(1) translateY(0);
}

/* === HEADER === */
.expand-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(0.75rem, 2vw, 1.25rem) clamp(1rem, 2vw, 1.5rem);
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.expand-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.expand-title > i {
    font-size: 1.75rem;
    color: #00f0ff;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

.expand-title h3 {
    font-family: 'Syne', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.expand-title p {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #71717a;
    margin: 0.2rem 0 0;
}

.close-expand {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #a1a1aa;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.close-expand:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: #00f0ff;
    color: #00f0ff;
    transform: rotate(90deg);
}

/* === BODY === */
.expand-body {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: clamp(1rem, 2vw, 1.5rem);
    padding: clamp(0.75rem, 2vw, 1.5rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.expand-info {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* === SLIDER POPUP === */
.expand-body-slider {
    grid-template-columns: 1fr 1fr;
}

.expand-visual-large {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.slider-wrapper-large {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    cursor: col-resize;
    overflow: hidden;
}

.slider-wrapper-large img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.slider-wrapper-large .img-after {
    clip-path: inset(0 50% 0 0);
}

.slider-wrapper-large .slider-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    background: #00f0ff;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.8);
    z-index: 10;
}

.slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: #00f0ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 1rem;
    z-index: 11;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.6);
    cursor: col-resize;
}

.slider-wrapper-large .slider-label {
    position: absolute;
    bottom: 15px;
    padding: 0.4rem 0.8rem;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    border-radius: 6px;
    z-index: 5;
    letter-spacing: 0.1em;
}

.slider-wrapper-large .slider-label-before { left: 15px; }
.slider-wrapper-large .slider-label-after { right: 15px; }

/* Percentage indicator */
.ba-pct {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.2rem 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #00f0ff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 12px;
    z-index: 12;
    pointer-events: none;
    transition: opacity 0.2s;
    letter-spacing: 0.05em;
}

/* Side-by-side mode */
.ba-side-by-side {
    display: flex !important;
}
.ba-side-by-side img {
    position: relative !important;
    width: 50% !important;
    height: 100% !important;
}
.ba-side-by-side .slider-label-before { left: 10px; }
.ba-side-by-side .slider-label-after { right: 10px; }

/* Toolbar */
.ba-toolbar {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem 0.6rem;
    background: rgba(255, 255, 255, 0.015);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    align-items: center;
    flex-wrap: wrap;
}
.ba-tool-btn {
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    color: #a1a1aa;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.62rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}
.ba-tool-btn:hover {
    border-color: rgba(0, 240, 255, 0.3);
    color: #00f0ff;
    background: rgba(0, 240, 255, 0.04);
}
.ba-tool-btn.active {
    border-color: #00f0ff;
    color: #00f0ff;
    background: rgba(0, 240, 255, 0.08);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
}
.ba-tool-primary {
    border-color: rgba(124, 58, 237, 0.25) !important;
    background: rgba(124, 58, 237, 0.06) !important;
    color: #c4b5fd !important;
}
.ba-tool-primary:hover {
    border-color: #7c3aed !important;
    background: rgba(124, 58, 237, 0.12) !important;
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.15);
}
.ba-separator {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0 0.15rem;
}

/* Upload zone */
.ba-upload-zone {
    background: rgba(255, 255, 255, 0.015);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.75rem;
}
.ba-upload-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    color: #52525b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.ba-upload-title i { color: #7c3aed; }
.ba-upload-row {
    display: flex;
    gap: 0.3rem;
}
.ba-upload-btn {
    flex: 1;
    padding: 0.4rem;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.02);
    color: #71717a;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    text-align: center;
}
.ba-upload-btn:hover {
    border-color: rgba(124, 58, 237, 0.25);
    color: #c4b5fd;
    background: rgba(124, 58, 237, 0.04);
}
.ba-upload-btn.ba-uploaded {
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
    background: rgba(34, 197, 94, 0.04);
}
.ba-upload-reset {
    flex: 0 0 auto;
    padding: 0.4rem 0.6rem;
    color: #71717a;
    border-color: rgba(239, 68, 68, 0.15);
}
.ba-upload-reset:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.04);
}

/* Keyboard shortcuts hint */
.ba-shortcuts {
    display: flex;
    gap: 1rem;
    padding: 0.4rem 0;
    flex-wrap: wrap;
}
.ba-shortcuts span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.52rem;
    color: #3f3f46;
}
.ba-shortcuts kbd {
    display: inline-block;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #52525b;
    font-size: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    margin: 0 0.1rem;
}

/* Enhanced handle pulse */
.slider-handle {
    animation: baPulse 2.5s ease-in-out infinite;
}
@keyframes baPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 240, 255, 0.4); }
    50% { box-shadow: 0 0 35px rgba(0, 240, 255, 0.7), 0 0 60px rgba(0, 240, 255, 0.2); }
}

/* 🆕 Lens magnifier */
.ba-lens {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 2px solid rgba(0, 240, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2), inset 0 0 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    pointer-events: none;
    z-index: 20;
    display: flex;
}
.ba-lens-before, .ba-lens-after {
    width: 50%;
    height: 100%;
    background-size: cover;
    background-repeat: no-repeat;
}
.ba-lens-divider {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    pointer-events: none;
}

/* 🆕 Filter panel */
.ba-filter-panel {
    background: rgba(5, 5, 12, 0.95);
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 10px;
    padding: 0.8rem;
    margin-top: 0.5rem;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.ba-filter-target {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
}
.ba-filter-target-btn {
    flex: 1;
    padding: 0.3rem 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    color: #71717a;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    cursor: pointer;
    transition: all 0.2s;
}
.ba-filter-target-btn.active {
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(124, 58, 237, 0.25);
    color: #c4b5fd;
}
.ba-filter-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.3rem 0;
    cursor: pointer;
}
.ba-filter-row span:first-child {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    color: #71717a;
    min-width: 70px;
}
.ba-filter-row input[type="range"] {
    flex: 1;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    outline: none;
}
.ba-filter-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #7c3aed;
    cursor: pointer;
}
.ba-filter-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5rem;
    color: #52525b;
    min-width: 30px;
    text-align: right;
}
.ba-filter-reset {
    margin-top: 0.4rem;
    padding: 0.25rem 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    color: #52525b;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.52rem;
    cursor: pointer;
    width: 100%;
}
.ba-filter-reset:hover {
    background: rgba(124, 58, 237, 0.06);
    color: #c4b5fd;
}

/* Case Study */
.expand-case-study {
    background: rgba(0, 240, 255, 0.03);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 12px;
    padding: 1.25rem;
}

.case-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    background: linear-gradient(135deg, #00f0ff, #7c3aed);
    color: #000;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 20px;
    margin-bottom: 0.75rem;
}

.expand-case-study h4 {
    font-family: 'Syne', sans-serif;
    font-size: 1.1rem;
    color: #fff;
    margin: 0 0 0.5rem;
}

.expand-case-study > p {
    font-size: 0.85rem;
    color: #a1a1aa;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.case-feature {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.case-feature i {
    color: #00f0ff;
    font-size: 1rem;
    margin-top: 0.1rem;
}

.case-feature strong {
    display: block;
    color: #fff;
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
}

.case-feature span {
    font-size: 0.75rem;
    color: #71717a;
}

.expand-tech {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 1rem;
}

.expand-tech h5 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #00f0ff;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.expand-tech p {
    font-size: 0.8rem;
    color: #a1a1aa;
    line-height: 1.5;
    margin: 0;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tech-tags span {
    padding: 0.3rem 0.6rem;
    background: rgba(124, 58, 237, 0.15);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: #a78bfa;
}

/* === LEGO 3D POPUP === */
.expand-body-lego {
    grid-template-columns: 1.2fr 1fr;
}

.expand-visual-3d {
    position: relative;
    background: linear-gradient(180deg, #0a0a0f 0%, #050508 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden; /* Prevent scrollbars after fullscreen exit */
}

#lego3DCanvas {
    width: 100% !important;
    height: 380px;
    max-width: 100%;
    border-radius: 8px;
    background: #0a0a0f;
    display: block; /* Prevent inline-block spacing gaps */
}

.lego-3d-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.lego-3d-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
}

.lego-3d-btn:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: #00f0ff;
    transform: translateY(-2px);
}

.lego-3d-btn.special {
    background: linear-gradient(135deg, rgba(255, 42, 109, 0.2), rgba(124, 58, 237, 0.2));
    border-color: rgba(255, 42, 109, 0.4);
}

.lego-hint {
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #52525b;
}

/* ═══ LEGO 3D TOOLBAR ═══ */
.lego-3d-toolbar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 100;
}
.lego-fullscreen-btn,
.lego-autorotate-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    color: #aaa;
    font-size: 1rem;
    cursor: pointer !important;
    transition: all 0.3s;
}
.lego-fullscreen-btn:hover,
.lego-autorotate-btn:hover {
    background: rgba(0, 240, 255, 0.15);
    border-color: #00f0ff;
    color: #00f0ff;
}
.lego-fullscreen-btn.active {
    background: rgba(0, 255, 157, 0.15);
    border-color: #00ff9d;
    color: #00ff9d;
}
.lego-autorotate-btn.active {
    background: rgba(255, 149, 0, 0.15);
    border-color: #ff9500;
    color: #ff9500;
}
.lego-autorotate-btn.active i {
    animation: lego-spin 3s linear infinite;
}
@keyframes lego-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 🆕 Camera preset bar */
.lego-3d-camera-bar {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    display: flex;
    gap: 0.2rem;
    z-index: 10;
}
.lego-cam-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #71717a;
    font-size: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lego-cam-btn:hover {
    background: rgba(124, 58, 237, 0.15);
    border-color: rgba(124, 58, 237, 0.3);
    color: #c4b5fd;
}
.nb-legend-row { transition: opacity 0.2s; }
.nb-legend-row:hover { background: rgba(124, 58, 237, 0.03); }

/* ═══ LEGO 3D FULLSCREEN MODE ═══ */
.expand-visual-3d.lego-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    z-index: 99999 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #050508 !important;
    overflow: hidden !important;
}
.expand-visual-3d.lego-fullscreen #lego3DCanvas {
    width: 100% !important;
    height: calc(100dvh - 100px) !important;
    border-radius: 0 !important;
}
.expand-visual-3d.lego-fullscreen .lego-3d-toolbar {
    top: 1.5rem;
    right: 1.5rem;
}
.expand-visual-3d.lego-fullscreen .lego-fullscreen-btn,
.expand-visual-3d.lego-fullscreen .lego-autorotate-btn {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
}
.expand-visual-3d.lego-fullscreen .lego-3d-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 2rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9) 30%);
    gap: 0.75rem;
    justify-content: center;
}
.expand-visual-3d.lego-fullscreen .lego-3d-btn {
    padding: 0.8rem 1.4rem;
    font-size: 0.9rem;
}
.expand-visual-3d.lego-fullscreen .lego-hint {
    position: absolute;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Neural Bricks Stats Panel */
.nb-stats-panel {
    background: rgba(0, 240, 255, 0.02);
    border: 1px solid rgba(0, 240, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.nb-stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.nb-stats-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    background: linear-gradient(135deg, #00f0ff, #7c3aed);
    color: #000;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    font-weight: 700;
    border-radius: 14px;
    letter-spacing: 0.05em;
}
.nb-stats-model {
    font-family: 'Syne', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}
.nb-stats-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}
.nb-kpi {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 0.5rem 0.4rem;
    text-align: center;
}
.nb-kpi-val {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: #00f0ff;
    line-height: 1;
}
.nb-kpi-label {
    display: block;
    font-size: 0.5rem;
    color: #52525b;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.2rem;
}

/* Color legend */
.nb-color-legend {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.nb-legend-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.nb-legend-title i { color: #7c3aed; font-size: 0.6rem; }
.nb-legend-bars {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 0.25rem;
}
.nb-legend-bars::-webkit-scrollbar { width: 3px; }
.nb-legend-bars::-webkit-scrollbar-thumb { background: #27272a; border-radius: 3px; }
.nb-legend-row {
    display: grid;
    grid-template-columns: 12px 1fr 60px 28px;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0;
}
.nb-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.nb-legend-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.58rem;
    color: #a1a1aa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nb-legend-bar-bg {
    height: 4px;
    background: rgba(255,255,255,0.04);
    border-radius: 2px;
    overflow: hidden;
}
.nb-legend-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
    opacity: 0.8;
}
.nb-legend-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    color: #71717a;
    text-align: right;
}

/* Utilization bar */
.nb-utilization {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.nb-util-label {
    display: flex;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.52rem;
    color: #52525b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.nb-util-label span:last-child { color: #00f0ff; font-weight: 700; }
.nb-util-bar-bg {
    height: 5px;
    background: rgba(255,255,255,0.04);
    border-radius: 3px;
    overflow: hidden;
}
.nb-util-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00f0ff, #7c3aed);
    border-radius: 3px;
    transition: width 0.6s ease;
}

.expand-description h4 {
    font-family: 'Syne', sans-serif;
    font-size: 1rem;
    color: #fff;
    margin: 0 0 0.5rem;
}

.expand-description p {
    font-size: 0.85rem;
    color: #a1a1aa;
    line-height: 1.6;
    margin: 0;
}

.expand-features-list {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 1rem;
}

.expand-features-list h5 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #00ff9d;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.expand-features-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.expand-features-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    font-size: 0.8rem;
    color: #d4d4d8;
}

.expand-features-list li i {
    color: #00ff9d;
    font-size: 0.7rem;
}

.expand-use-cases h5 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #ff9500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.use-case-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.use-case {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem;
    background: rgba(255, 149, 0, 0.05);
    border: 1px solid rgba(255, 149, 0, 0.15);
    border-radius: 8px;
}

.use-case i { color: #ff9500; font-size: 0.9rem; }
.use-case span { font-size: 0.7rem; color: #a1a1aa; }

/* === WEATHER POPUP - NUEVO LAYOUT === */
.expand-body-weather-new {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
}

.weather-main-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.weather-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 900px) {
    .expand-body-weather-new {
        grid-template-columns: 1fr;
    }
}

/* === WEATHER POPUP === */
.expand-body-weather {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.weather-search-box {
    display: flex;
    gap: 0.5rem;
}

.weather-input-large {
    flex: 1;
    padding: 0.9rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
}

.weather-input-large:focus {
    outline: none;
    border-color: #00f0ff;
}

.weather-search-btn {
    padding: 0 1.5rem;
    background: linear-gradient(135deg, #00f0ff, #00c4cc);
    border: none;
    border-radius: 10px;
    color: #000;
    font-size: 1.1rem;
    cursor: pointer;
}

.weather-quick-cities {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.weather-quick-cities button {
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    color: #a1a1aa;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    cursor: pointer;
}

.weather-quick-cities button:hover {
    border-color: #00f0ff;
    color: #00f0ff;
}

.weather-display-large {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.03), rgba(124, 58, 237, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 1.5rem;
    min-height: 200px;
}

.weather-loading, .weather-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 150px;
    color: #71717a;
    gap: 1rem;
}

.weather-loading i { font-size: 2rem; color: #00f0ff; }
.weather-error i { font-size: 2rem; color: #ff2a6d; }

.weather-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.weather-current { text-align: center; }
.weather-icon-large { font-size: 4rem; }
.weather-temp-large {
    font-family: 'Syne', sans-serif;
    font-size: 3.5rem;
    font-weight: 800;
    color: #fff;
}

.weather-desc { font-size: 0.95rem; color: #a1a1aa; margin: 0.5rem 0; }
.weather-location {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #00f0ff;
}

.weather-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-content: center;
}

.weather-detail {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 0.75rem;
    text-align: center;
}

.weather-detail i { color: #00f0ff; font-size: 1rem; margin-bottom: 0.3rem; }
.detail-value { display: block; font-size: 1.25rem; font-weight: 700; color: #fff; }
.detail-label {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    color: #71717a;
    text-transform: uppercase;
}

.weather-forecast { border-top: 1px solid rgba(255, 255, 255, 0.06); padding-top: 1rem; }
.weather-forecast h5 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #71717a;
    margin: 0 0 0.75rem;
}

.forecast-grid { display: flex; gap: 0.5rem; justify-content: space-between; }
.forecast-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.forecast-name { font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; color: #a1a1aa; }
.forecast-icon { font-size: 1.25rem; }
.forecast-temps { display: flex; gap: 0.4rem; font-size: 0.75rem; }
.temp-max { color: #fff; font-weight: 600; }
.temp-min { color: #71717a; }

.weather-info-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }

/* Dead CSS removed: Image Generator, sentiment-demo, pricing-formula, email-example (Feb 2026) */

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .expand-body,
    .expand-body-slider,
    .expand-body-lego,
    .expand-body-weather-new { grid-template-columns: 1fr !important; }
    .weather-main { grid-template-columns: 1fr; }
    .weather-info-panel { grid-template-columns: 1fr; }
    #lego3DCanvas { height: 320px !important; }
    .gadget-expand-content.gadget-expand-fullwidth #lego3DCanvas { height: 100% !important; }
    .gadget-expand-content.gadget-expand-wide { max-width: 100%; }
    .lego-3d-toolbar { top: 0.5rem; right: 0.5rem; gap: 0.3rem; }
    .lego-fullscreen-btn, .lego-autorotate-btn { width: 36px; height: 36px; font-size: 0.85rem; }
    .lego-3d-camera-bar { top: 0.5rem; left: 0.5rem; }
    .expand-visual-3d { overflow: visible; }
    .gadget-expand-content.gadget-expand-fullwidth .expand-visual-3d { overflow: hidden; }
    .gadget-expand-content.gadget-expand-fullwidth .lego-hint { font-size: 0.55rem; padding: 0.25rem 0.5rem; }
    .gadget-expand-content.gadget-expand-fullwidth .lego-3d-btn { padding: 0.4rem 0.65rem; font-size: 0.65rem; }
    .gadget-expand-content.gadget-expand-fullwidth .lego-3d-controls { padding: 0.4rem 0.5rem; gap: 0.3rem; }
    /* Hide stats panel on mobile in fullwidth */
    .gadget-expand-content.gadget-expand-fullwidth .expand-body-lego {
        grid-template-columns: 1fr !important;
    }
    .gadget-expand-content.gadget-expand-fullwidth .expand-body-lego .expand-info {
        display: none !important;
    }
    .expand-title h3 { font-size: 1.1rem; }
    .expand-title > i { font-size: 1.4rem; }
    /* Solar System + Lego fullwidth → no margins on mobile */
    .gadget-expand-content.gadget-expand-fullwidth {
        max-width: 100vw;
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }
    .gadget-expand-backdrop { padding: 0; }
}

@media (max-width: 600px) {
    .expand-title { gap: 0.6rem; }
    .expand-title > i { font-size: 1.15rem; }
    .expand-title h3 { font-size: 0.95rem; }
    .expand-title p { font-size: 0.6rem; }
    .close-expand { width: 34px; height: 34px; font-size: 1.25rem; }
    .weather-temp-large { font-size: 2.5rem; }
    .forecast-grid { flex-wrap: wrap; }
    .forecast-day { flex: 0 0 calc(33.33% - 0.4rem); }
    
    .factor-list { grid-template-columns: 1fr; }
    .ba-toolbar { gap: 0.2rem; padding: 0.35rem; }
    .ba-tool-btn { font-size: 0.55rem; padding: 0.2rem 0.35rem; }
    .ba-shortcuts { display: none; }
    .slider-handle { width: 38px; height: 38px; font-size: 0.85rem; }
    .expand-case-study { padding: 0.75rem; }
    .expand-case-study h4 { font-size: 0.9rem; }
    .expand-tech { padding: 0.75rem; }
    .nb-stats-kpis { grid-template-columns: repeat(3, 1fr); gap: 0.25rem; }
    .nb-kpi-val { font-size: 1rem; }
    .nb-kpi-label { font-size: 0.45rem; }
    .lego-3d-controls { gap: 0.25rem; }
    .lego-3d-btn { padding: 0.35rem 0.6rem; font-size: 0.6rem; }
    #lego3DCanvas { height: 280px !important; }
    .gadget-expand-content.gadget-expand-fullwidth #lego3DCanvas { height: 100% !important; }
    .expand-visual-3d { overflow: visible; }
    .gadget-expand-content.gadget-expand-fullwidth .expand-visual-3d { overflow: hidden; }
    .gadget-expand-content.gadget-expand-fullwidth .lego-hint { display: none; }
    .gadget-expand-content.gadget-expand-fullwidth .lego-3d-camera-bar { top: 0.3rem; left: 0.3rem; }
    .gadget-expand-content.gadget-expand-fullwidth .lego-cam-btn { width: 24px; height: 24px; font-size: 0.4rem; }
    .gadget-expand-content.gadget-expand-fullwidth .lego-3d-btn { padding: 0.3rem 0.5rem; font-size: 0.56rem; }
    .gadget-expand-content.gadget-expand-fullwidth .lego-3d-controls { padding: 0.3rem; gap: 0.2rem; }
    .gadget-expand-content.gadget-expand-fullwidth .expand-header { padding: 0.35rem 0.6rem; }
    .demo-box { padding: 1rem; }
    .demo-box i { font-size: 1.75rem; }
    .use-case-item { font-size: 0.72rem; padding: 0.45rem 0.6rem; }
    .tech-tags span { font-size: 0.55rem; padding: 0.2rem 0.45rem; }
    .case-feature strong { font-size: 0.78rem; }
    .case-feature span { font-size: 0.68rem; }
    .case-feature i { font-size: 0.85rem; }
}



.use-case-item i {
    color: #00f0ff;
    width: 20px;
    text-align: center;
}

/* Sentiment Demo */
.sentiment-demo {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
}

.scale-item.negative i { color: #ff2a6d; }
.scale-item.neutral i { color: #71717a; }
.scale-item.positive i { color: #00ff9d; }

.scale-item span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #a1a1aa;
}

/* Pricing Formula */


/* Email Example */
.email-example {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
}

.email-before, .email-after {
    flex: 1;
    padding: 0.75rem;
    border-radius: 8px;
}

.email-before {
    background: rgba(255, 42, 109, 0.1);
    border: 1px solid rgba(255, 42, 109, 0.2);
}

.email-after {
    background: rgba(0, 255, 157, 0.1);
    border: 1px solid rgba(0, 255, 157, 0.2);
}

.email-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.email-before p, .email-after p {
    font-size: 0.8rem;
    color: #d4d4d8;
    font-style: italic;
    margin: 0;
}

.email-arrow {
    font-size: 1.5rem;
    color: #00f0ff;
}

/* Small screens handled above */
