/**
 * DEVBox|WARE - Estilos Principales v3.0
 * Premium Dark Theme — Glassmorphism + Modern UI
 *
 * @version 3.0-premium
 * @author DEVBoxWARE Team
 */

/* ═══════════════════════════════════════════════════════════════
   GOOGLE FONTS
═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ═══════════════════════════════════════════════════════════════
   VARIABLES CSS — Premium Dark Theme
═══════════════════════════════════════════════════════════════ */
:root {
    /* Alias hacia dbw-theme.css (fuente unica del design system).
       No cambies valores aca: edita dbw-theme.css y se propaga solo. */
    --vscode-bg: var(--dbw-bg, #0b0b12);
    --vscode-sidebar: var(--dbw-surface, #10101a);
    --vscode-editor: var(--dbw-bg, #0b0b12);
    --vscode-border: var(--dbw-border, rgba(255,255,255,0.08));
    --vscode-border-subtle: var(--dbw-border-subtle, rgba(255,255,255,0.05));
    --vscode-text: var(--dbw-text, #e6e6ee);
    --vscode-text-secondary: var(--dbw-text-secondary, #9a9aac);
    --vscode-accent: var(--dbw-accent, #7C8CFF);
    --vscode-accent-hover: var(--dbw-accent-hover, #95A2FF);
    --vscode-accent-2: var(--dbw-accent-2, #8B5CF6);
    --vscode-accent-rgb: var(--dbw-accent-rgb, 124,140,255);
    --vscode-accent-dim: var(--dbw-accent-dim, rgba(124,140,255,0.13));
    --vscode-success: var(--dbw-success, #34D399);
    --vscode-warning: var(--dbw-warning, #FBBF24);
    --vscode-error: var(--dbw-error, #F87171);
    --vscode-activity-bar: var(--dbw-surface, #10101a);
    --vscode-tab-inactive: var(--dbw-bg-deep, #07070d);
    --vscode-scrollbar: var(--dbw-scrollbar-thumb, rgba(255,255,255,0.09));

    /* Premium extras */
    --glass-bg: var(--dbw-glass-bg, rgba(255,255,255,0.03));
    --glass-border: var(--dbw-glass-border, rgba(255,255,255,0.06));
    --shadow-sm: var(--dbw-shadow-sm, 0 1px 2px rgba(0,0,0,0.3));
    --shadow-md: var(--dbw-shadow-md, 0 4px 16px rgba(0,0,0,0.25));
    --shadow-lg: var(--dbw-shadow-lg, 0 8px 32px rgba(0,0,0,0.4));
    --ease-out: var(--dbw-ease-out, cubic-bezier(0.16, 1, 0.3, 1));
    --ease-smooth: var(--dbw-ease-smooth, cubic-bezier(0.4, 0, 0.2, 1));
    --font: var(--dbw-font, 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif);

    /* Viewport */
    --actual-vh: 1vh;
    --actual-vw: 1vw;
    --sidebar-height: calc(100vh - 56px - 32px);
}

/* ═══════════════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════════════ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background-color: var(--vscode-bg);
    /* Aurora ambiental sutil de marca (indigo→violeta) */
    background-image:
        radial-gradient(ellipse 70% 45% at 12% -5%, rgba(var(--vscode-accent-rgb), 0.06), transparent 60%),
        radial-gradient(ellipse 55% 40% at 92% 110%, rgba(139,92,246,0.05), transparent 60%);
    color: var(--vscode-text);
    height: 100vh;
    overflow: hidden;
    padding-bottom: 32px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

a {
    color: var(--vscode-accent);
    text-decoration: none;
    transition: color .2s var(--ease-out);
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE HEADER — Glassmorphism
═══════════════════════════════════════════════════════════════ */
.mobile-header {
    display: flex;
    height: 56px;
    background: rgba(11,11,18,0.82);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid var(--vscode-border);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
}

.hamburger-menu {
    background: none;
    border: none;
    color: var(--vscode-text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    transition: all 0.25s var(--ease-out);
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.hamburger-menu:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--vscode-text);
}

.hamburger-menu:active {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(0.92);
}

.mobile-title {
    font-family: var(--dbw-font-display, var(--font));
    font-size: 17px;
    font-weight: 600;
    color: var(--vscode-text);
    display: flex;
    align-items: center;
    flex: 1;
    letter-spacing: -0.01em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS — Modern Style
═══════════════════════════════════════════════════════════════ */
.btn {
    background: var(--vscode-accent);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    min-height: 36px;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.btn:hover {
    background: var(--vscode-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(var(--vscode-accent-rgb), 0.28);
}

.btn:active {
    transform: translateY(0) scale(0.97);
}

.install-btn {
    background: linear-gradient(135deg, var(--vscode-accent), var(--vscode-accent-2));
    animation: installPulse 2.5s ease-in-out infinite;
}

.update-btn {
    background: var(--vscode-warning);
    color: #0b0b12;
}

@keyframes installPulse {
    0%   { box-shadow: 0 0 0 0 rgba(var(--vscode-accent-rgb), 0.5); }
    70%  { box-shadow: 0 0 0 12px rgba(var(--vscode-accent-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--vscode-accent-rgb), 0); }
}

/* ═══════════════════════════════════════════════════════════════
   PWA STATUS
═══════════════════════════════════════════════════════════════ */
.pwa-status {
    font-size: 9px;
    padding: 2px 8px;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(var(--vscode-accent-rgb), 0.2), rgba(139,92,246,0.15));
    border: 1px solid rgba(var(--vscode-accent-rgb), 0.2);
    color: var(--vscode-accent);
    display: none;
    font-weight: 500;
    letter-spacing: 0.06em;
}

.pwa-status.installed {
    display: inline-block;
}

.pwa-status.installed::after {
    content: "PWA";
}

/* ═══════════════════════════════════════════════════════════════
   CONNECTION INDICATOR
═══════════════════════════════════════════════════════════════ */
.connection-status {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.3s var(--ease-out);
}

.connection-status.online {
    color: var(--vscode-success);
}

.connection-status.offline {
    background: rgba(251,191,36,0.1);
    color: var(--vscode-warning);
}

.connection-status.offline i::before {
    content: "\f127";
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT PRINCIPAL
═══════════════════════════════════════════════════════════════ */
.vscode-container {
    display: flex;
    height: calc(100vh - 56px - 32px);
    position: relative;
    margin-top: 56px;
}

/* ═══════════════════════════════════════════════════════════════
   ACTIVITY BAR — Premium sidebar icons
═══════════════════════════════════════════════════════════════ */
.activity-bar {
    width: 56px;
    background-color: var(--vscode-activity-bar);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    border-right: 1px solid var(--vscode-border);
    z-index: 50;
    transition: transform 0.3s var(--ease-smooth);
    position: fixed;
    top: 56px;
    left: 0;
    height: calc(100vh - 56px - 32px);
    bottom: 32px;
}

.activity-bar.hidden {
    transform: translateX(-100%);
}

.activity-item {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    cursor: pointer;
    color: var(--vscode-text-secondary);
    transition: all 0.25s var(--ease-out);
    border-radius: 12px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    font-size: 15px;
}

.activity-item:hover {
    color: var(--vscode-text);
    background-color: rgba(255, 255, 255, 0.05);
}

.activity-item:active {
    background-color: rgba(255, 255, 255, 0.08);
    transform: scale(0.92);
}

.activity-item.active {
    color: var(--vscode-accent);
    background-color: var(--vscode-accent-dim);
}

.activity-item.active::before {
    content: '';
    position: absolute;
    left: -7px;
    width: 3px;
    height: 20px;
    background: linear-gradient(180deg, var(--vscode-accent), var(--vscode-accent-2));
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px rgba(var(--vscode-accent-rgb), 0.45);
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR — Glassmorphism panel
═══════════════════════════════════════════════════════════════ */
.sidebar {
    width: fit-content;
    background: rgba(16,16,26,0.92);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border-right: 1px solid var(--vscode-border);
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header"
        "content";
    transition: transform 0.35s var(--ease-out);
    position: fixed;
    top: 56px;
    left: 56px;
    min-height: var(--sidebar-height);
    max-height: var(--sidebar-height);
    overflow: hidden;
    z-index: 49;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
}

.sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    grid-area: header;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--vscode-text-secondary);
    border-bottom: 1px solid var(--vscode-border);
    flex-shrink: 0;
    white-space: nowrap;
}

.sidebar-close {
    display: flex;
    background: none;
    border: none;
    color: var(--vscode-text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s var(--ease-out);
    min-height: 32px;
    min-width: 32px;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.sidebar-close:hover {
    color: var(--vscode-text);
    background-color: rgba(255, 255, 255, 0.06);
}

.sidebar-close:active {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
}

.sidebar-content {
    grid-area: content;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    scroll-behavior: smooth;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   NAV ITEMS — Modern hover effects
═══════════════════════════════════════════════════════════════ */
.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin: 2px 0;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s var(--ease-out);
    color: var(--vscode-text-secondary);
    text-decoration: none;
    min-height: 48px;
    font-size: 14px;
    font-weight: 450;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    border: 1px solid transparent;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--vscode-text);
    border-color: var(--vscode-border);
}

.nav-item:active {
    background-color: rgba(255, 255, 255, 0.06);
    transform: scale(0.98);
}

.nav-item.active {
    background: var(--vscode-accent-dim);
    color: var(--vscode-accent);
    border-color: rgba(var(--vscode-accent-rgb), 0.16);
    font-weight: 500;
}

.nav-item i {
    width: 22px;
    margin-right: 12px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active i {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT AREA
═══════════════════════════════════════════════════════════════ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--vscode-editor);
    min-width: 0;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 32px;
    z-index: 10;
    margin-left: 0;
    transition: margin-left 0.3s var(--ease-smooth);
}

/* ═══════════════════════════════════════════════════════════════
   TAB BAR — Modern minimalist
═══════════════════════════════════════════════════════════════ */
.tab-bar {
    height: 44px;
    background-color: var(--vscode-tab-inactive);
    border-bottom: 1px solid var(--vscode-border);
    display: flex;
    align-items: center;
    overflow-x: auto;
    margin-left: 0;
    transition: margin-left 0.3s var(--ease-smooth);
    position: relative;
    z-index: 15;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tab-bar::-webkit-scrollbar {
    display: none;
}

.tab-bar.sidebar-hidden {
    margin-left: 0;
}

.tab {
    height: 100%;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border-right: 1px solid var(--vscode-border-subtle);
    cursor: pointer;
    font-size: 13px;
    font-weight: 450;
    white-space: nowrap;
    position: relative;
    color: var(--vscode-text-secondary);
    transition: all 0.2s var(--ease-out);
    min-width: 130px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Doble click = pantalla completa del módulo: no seleccionar el texto del tab */
    user-select: none;
    -webkit-user-select: none;
}

.tab.active {
    background-color: var(--vscode-editor);
    color: var(--vscode-text);
}

/* Indicador de tab activo — línea superior degradada */
.tab.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--vscode-accent), var(--vscode-accent-2));
    border-radius: 0 0 2px 2px;
    box-shadow: 0 1px 8px rgba(var(--vscode-accent-rgb), 0.35);
}

.tab:hover {
    color: var(--vscode-text);
    background-color: rgba(255, 255, 255, 0.03);
}

.tab:active {
    background-color: rgba(255, 255, 255, 0.05);
}

.tab i {
    margin: 4px;
    font-size: 13px;
    opacity: 0.6;
}

.tab.active i {
    opacity: 1;
}

.tab-close {
    margin-left: 8px;
    opacity: 0.4;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s var(--ease-out);
    min-width: 24px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.tab-close:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.08);
}

.tab-close:active {
    background-color: rgba(255, 255, 255, 0.12);
    transform: scale(0.85);
}

/* ═══════════════════════════════════════════════════════════════
   IFRAME SYSTEM v3 — Premium transitions
═══════════════════════════════════════════════════════════════ */
.content-area {
    flex: 1;
    overflow: hidden;
    position: relative;
    padding: 0;
    margin: 0;
    background-color: var(--vscode-editor);
    width: 100%;
    height: 100%;
    isolation: isolate;
}

.content-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    margin: 0;
    padding: 0;
    background-color: var(--vscode-editor);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: opacity, transform;
    transition:
        opacity 200ms ease-in,
        transform 200ms ease-in,
        visibility 0s linear 200ms;
}

.content-iframe.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateZ(0);
    transition:
        opacity 320ms var(--ease-smooth),
        transform 320ms var(--ease-smooth),
        visibility 0s linear 0s;
}

.content-iframe.is-entering {
    animation: iframeSlideIn 350ms var(--ease-out) forwards;
}

@keyframes iframeSlideIn {
    from { opacity: 0; transform: translateY(6px) scale(0.997); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.content-iframe.optimized {
    contain: strict;
}

/* ═══════════════════════════════════════════════════════════════
   PANTALLA COMPLETA POR MÓDULO
   Doble click / doble tap en un tab → #contentArea entra en
   fullscreen nativo (solo se ve el módulo activo). Arriba queda una
   BARRA fina (estilo barra de estado del móvil) que reserva su
   propio espacio — el módulo se ve completo DEBAJO, nunca tapado.
   Se sale con el botón de la barra, con ESC o doble click/tap en
   la propia barra.
═══════════════════════════════════════════════════════════════ */
.content-area {
    /* Alto de la barra de fullscreen. En móvil la barra OCUPA la misma zona
       donde el sistema pone la hora/cobertura (safe-area), no se suma a ella:
       max() → 32px en PC, o exactamente el alto del notch si es mayor. */
    --fs-bar-h: max(32px, env(safe-area-inset-top, 0px));
}

.content-area:fullscreen,
.content-area:-webkit-full-screen {
    background-color: var(--vscode-editor);
}

/* En fullscreen, el iframe cede el espacio de la barra (los iframes son
   position:absolute, el padding del contenedor no los desplaza) */
.content-area:fullscreen .content-iframe,
.content-area:-webkit-full-screen .content-iframe {
    top: var(--fs-bar-h);
    height: calc(100% - var(--fs-bar-h));
}

/* Barra superior — SOLO visible en fullscreen */
.module-fs-bar {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--fs-bar-h);
    /* Sin padding-top: el título y el botón se centran DENTRO de la zona
       segura, igual que el reloj/batería en la barra de estado del móvil */
    padding: 0 6px 0 14px;
    z-index: 500; /* por encima de iframes y overlays del manager */
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background-color: var(--vscode-sidebar);
    border-bottom: 1px solid var(--vscode-border);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.content-area:fullscreen .module-fs-bar,
.content-area:-webkit-full-screen .module-fs-bar {
    display: flex;
}

/* Nombre del módulo a la izquierda (discreto, estilo barra de estado) */
.module-fs-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--vscode-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.module-fs-title i {
    margin-right: 7px;
    opacity: 0.8;
}

/* Botón de salir, en la esquina derecha DE LA BARRA */
.module-fs-exit {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--vscode-text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.module-fs-exit:hover,
.module-fs-exit:focus-visible {
    color: var(--vscode-text);
    background: rgba(255, 255, 255, 0.08);
}

.module-fs-exit:active {
    transform: scale(0.94);
}

/* ═══════════════════════════════════════════════════════════════
   SKELETON LOADER — Premium shimmer
═══════════════════════════════════════════════════════════════ */
.module-skeleton {
    position: absolute;
    inset: 0;
    background: var(--vscode-editor);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 20;
    overflow: hidden;
    opacity: 1;
    transition: opacity 300ms var(--ease-out);
    pointer-events: none;
}

.module-skeleton.is-hiding {
    opacity: 0;
}

.module-skeleton__topbar {
    position: absolute;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, var(--vscode-accent), var(--vscode-accent-2), #06D6F2);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 12px rgba(var(--vscode-accent-rgb), 0.4);
    transition: width 200ms ease-out;
    z-index: 30;
}

.module-skeleton__topbar.is-progressing {
    animation: skeletonTopbar 2.4s var(--ease-smooth) forwards;
}

.module-skeleton__topbar.is-complete {
    width: 100% !important;
    transition: width 150ms ease-out;
}

@keyframes skeletonTopbar {
    0%   { width: 0%;  }
    30%  { width: 45%; }
    60%  { width: 68%; }
    85%  { width: 82%; }
    100% { width: 88%; }
}

.module-skeleton__header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    padding-top: 8px;
}

.module-skeleton__icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(90deg,
            rgba(255,255,255,0.04) 25%,
            rgba(255,255,255,0.08) 50%,
            rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.8s ease-in-out infinite;
    flex-shrink: 0;
}

.module-skeleton__title-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.module-skeleton__title {
    height: 16px;
    border-radius: 6px;
    background: linear-gradient(90deg,
            rgba(255,255,255,0.04) 25%,
            rgba(255,255,255,0.08) 50%,
            rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.8s ease-in-out infinite;
}

.module-skeleton__title--wide  { width: 55%; }
.module-skeleton__title--short { width: 35%; height: 12px; }

.module-skeleton__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.module-skeleton__block {
    border-radius: 8px;
    background: linear-gradient(90deg,
            rgba(255,255,255,0.04) 25%,
            rgba(255,255,255,0.07) 50%,
            rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.8s ease-in-out infinite;
}

.module-skeleton__block--full   { height: 14px; width: 100%; }
.module-skeleton__block--wide   { height: 14px; width: 85%; }
.module-skeleton__block--medium { height: 14px; width: 65%; }
.module-skeleton__block--short  { height: 14px; width: 45%; }
.module-skeleton__block--card   { height: 80px; width: 100%; border-radius: 12px; margin-top: 4px; }
.module-skeleton__block--spacer { height: 20px; background: transparent !important; animation: none !important; }

.module-skeleton__block:nth-child(1) { animation-delay: 0ms; }
.module-skeleton__block:nth-child(2) { animation-delay: 80ms; }
.module-skeleton__block:nth-child(3) { animation-delay: 160ms; }
.module-skeleton__block:nth-child(4) { animation-delay: 240ms; }
.module-skeleton__block:nth-child(5) { animation-delay: 80ms; }
.module-skeleton__block:nth-child(6) { animation-delay: 160ms; }
.module-skeleton__block:nth-child(7) { animation-delay: 240ms; }

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Badge de estado */
.module-skeleton__badge {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 11px;
    color: var(--vscode-text-secondary);
    letter-spacing: 0.3px;
    pointer-events: none;
    backdrop-filter: blur(8px);
}

.module-skeleton__badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--vscode-accent);
    box-shadow: 0 0 6px rgba(var(--vscode-accent-rgb), 0.4);
    animation: pulseDot 1.4s ease-in-out infinite;
}

@keyframes pulseDot {
    0%,100% { opacity: 1; transform: scale(1); }
    50%     { opacity: 0.4; transform: scale(0.7); }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE OVERLAY — blur premium
═══════════════════════════════════════════════════════════════ */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 25;
    display: none;
    opacity: 0;
    transition: opacity 0.35s var(--ease-out);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.mobile-overlay.show {
    display: block;
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background-color: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--vscode-scrollbar);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255,255,255,0.14);
}

/* ═══════════════════════════════════════════════════════════════
   STATUS BAR — Gradient premium
═══════════════════════════════════════════════════════════════ */
.status-bar {
    height: 32px;
    background-color: var(--vscode-tab-inactive);
    background-image: linear-gradient(90deg, transparent 0%, rgba(var(--vscode-accent-rgb), 0.08) 50%, transparent 100%);
    border-top: 1px solid var(--vscode-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 11px;
    color: var(--vscode-text-secondary);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 55;
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-left {
    flex: 1;
}

.status-right {
    flex-shrink: 0;
    gap: 12px;
}

.status-right a {
    color: var(--vscode-text-secondary);
    transition: color 0.2s var(--ease-out);
    font-size: 12px;
}

.status-right a:hover {
    color: var(--vscode-accent);
}

/* ═══════════════════════════════════════════════════════════════
   ERROR STATES
═══════════════════════════════════════════════════════════════ */
.error-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--vscode-editor);
    padding: 40px 20px;
    z-index: 100;
}

.error-icon {
    color: var(--vscode-error);
    font-size: 44px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.error-title {
    color: var(--vscode-text);
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
}

.error-message {
    color: var(--vscode-text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    text-align: center;
    max-width: 400px;
    line-height: 1.6;
}

.retry-btn {
    background: var(--vscode-accent);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    transition: all 0.25s var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.retry-btn:hover {
    background: var(--vscode-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--vscode-accent-rgb), 0.3);
}

.retry-btn:active {
    transform: translateY(0) scale(0.97);
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════════════════════════════ */
.pwa-toast {
    position: fixed;
    bottom: 44px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16,16,26,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--vscode-text);
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    max-width: 90vw;
    text-align: center;
    opacity: 0;
    transition: all 0.35s var(--ease-out);
    pointer-events: none;
}

.pwa-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px);
}

.pwa-toast.success { border-color: rgba(52,211,153,0.3); color: var(--vscode-success); }
.pwa-toast.error   { border-color: rgba(248,113,113,0.3); color: var(--vscode-error); }
.pwa-toast.warning { border-color: rgba(251,191,36,0.3); color: var(--vscode-warning); }

/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s var(--ease-smooth);
}

/* Keyboard adjustments */
.keyboard-open .sidebar {
    min-height: var(--sidebar-height) !important;
    max-height: var(--sidebar-height) !important;
}

/* Dynamic viewport support */
@supports (height: 100dvh) {
    :root { --sidebar-height: calc(100dvh - 56px - 32px); }
    .vscode-container { height: calc(100dvh - 56px - 32px); }
    .activity-bar, .main-content { height: calc(100dvh - 56px - 32px); }
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    .mobile-header {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-top: env(safe-area-inset-top);
        height: calc(56px + env(safe-area-inset-top));
    }

    :root { --sidebar-height: calc(100vh - 56px - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
    .vscode-container { margin-top: calc(56px + env(safe-area-inset-top)); height: calc(100vh - 56px - 32px - env(safe-area-inset-top)); }
    .activity-bar, .sidebar, .main-content { top: calc(56px + env(safe-area-inset-top)); height: calc(100vh - 56px - 32px - env(safe-area-inset-top)); }
    .status-bar { padding-bottom: env(safe-area-inset-bottom); height: calc(32px + env(safe-area-inset-bottom)); }

    @supports (height: 100dvh) {
        :root { --sidebar-height: calc(100dvh - 56px - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
        .vscode-container { height: calc(100dvh - 56px - 32px - env(safe-area-inset-top)); }
        .activity-bar, .sidebar, .main-content { height: calc(100dvh - 56px - 32px - env(safe-area-inset-top)); }
    }
}

/* Utility */
.hidden { display: none !important; }
.loading { opacity: 0.5; pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */

/* Tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar { max-width: 450px; }
}

/* Mobile */
@media (max-width: 768px) {
    .mobile-header { height: 52px; padding: 0 12px; }
    :root { --sidebar-height: calc(100vh - 52px - 32px); }
    .vscode-container { height: calc(100vh - 52px - 32px); margin-top: 52px; }
    .activity-bar, .sidebar, .main-content { top: 52px; height: calc(100vh - 52px - 32px); }
    .sidebar { width: fit-content; max-width: calc(100vw - 56px); }
    .sidebar.hidden { transform: translateX(calc(-100% - 56px)); }
    .status-left { gap: 6px; font-size: 10px; }
    .tab { padding: 0 14px; min-width: 120px; }
    .error-icon { font-size: 38px; }
    .error-title { font-size: 15px; }

    @supports (height: 100dvh) {
        :root { --sidebar-height: calc(100dvh - 52px - 32px); }
        .vscode-container { height: calc(100dvh - 52px - 32px); }
        .activity-bar, .sidebar, .main-content { height: calc(100dvh - 52px - 32px); }
    }

    @supports (padding: max(0px)) {
        .mobile-header { height: calc(52px + env(safe-area-inset-top)); }
        :root { --sidebar-height: calc(100vh - 52px - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
        .vscode-container { height: calc(100vh - 52px - 32px - env(safe-area-inset-top)); margin-top: calc(52px + env(safe-area-inset-top)); }
        .activity-bar, .sidebar, .main-content { top: calc(52px + env(safe-area-inset-top)); height: calc(100vh - 52px - 32px - env(safe-area-inset-top)); }

        @supports (height: 100dvh) {
            :root { --sidebar-height: calc(100dvh - 52px - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
            .vscode-container { height: calc(100dvh - 52px - 32px - env(safe-area-inset-top)); }
            .activity-bar, .sidebar, .main-content { height: calc(100dvh - 52px - 32px - env(safe-area-inset-top)); }
        }
    }
}

/* Very small devices */
@media (max-width: 480px) {
    .btn { padding: 6px 10px; font-size: 11px; min-height: 32px; }
    .header-actions { gap: 4px; }
    .mobile-title { font-size: 15px; }
    .connection-status { width: 28px; height: 28px; font-size: 12px; }
    .tab { padding: 0 12px; min-width: 100px; font-size: 12px; }
}

/* Landscape */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-header { height: 48px; }
    :root { --sidebar-height: calc(100vh - 48px - 32px); }
    .vscode-container { height: calc(100vh - 48px - 32px); margin-top: 48px; }
    .activity-bar, .sidebar, .main-content { top: 48px; height: calc(100vh - 48px - 32px); }
    .error-container { padding: 20px; }
    .error-icon { font-size: 32px; margin-bottom: 14px; }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    .activity-item, .nav-item, .tab, .hamburger-menu, .sidebar-close, .tab-close, .retry-btn {
        min-height: 44px;
        min-width: 44px;
    }
    .activity-item:hover, .nav-item:hover, .tab:hover { transform: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .content-iframe { transition: none; }
}

/* High contrast */
@media (prefers-contrast: high) {
    :root { --vscode-border: rgba(255,255,255,0.3); --vscode-accent: #0099ff; }
    .content-iframe { border: 1px solid var(--vscode-border); }
}

/* ═══════════════════════════════════════════════════════════════
   MODULE ERROR STATE
═══════════════════════════════════════════════════════════════ */
.module-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--vscode-editor);
    padding: 40px 20px;
    z-index: 20;
    text-align: center;
    animation: fadeInError 350ms var(--ease-out) forwards;
}

@keyframes fadeInError {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.module-error__icon-wrap {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: rgba(248,113,113,0.08);
    border: 1px solid rgba(248,113,113,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.module-error__icon-wrap i {
    font-size: 24px;
    color: var(--vscode-error);
}

.module-error__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--vscode-text);
    margin-bottom: 10px;
}

.module-error__message {
    font-size: 13px;
    color: var(--vscode-text-secondary);
    margin-bottom: 28px;
    max-width: 360px;
    line-height: 1.6;
}

.module-error__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.module-error__btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    min-height: 40px;
    transition: all 0.25s var(--ease-out);
    touch-action: manipulation;
}

.module-error__btn--primary {
    background: var(--vscode-accent);
    color: #fff;
}

.module-error__btn--primary:hover {
    background: var(--vscode-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124,140,255,0.25);
}

.module-error__btn--secondary {
    background: transparent;
    color: var(--vscode-text-secondary);
    border: 1px solid var(--vscode-border);
}

.module-error__btn--secondary:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--vscode-text);
    border-color: rgba(255,255,255,0.12);
}

.module-error__btn:active {
    transform: translateY(0) scale(0.97);
}

.module-error__code {
    margin-top: 20px;
    font-size: 11px;
    color: var(--vscode-text-secondary);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.03);
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--vscode-border);
}

/* ═══════════════════════════════════════════════════════════════
   SLOW LOAD WARNING
═══════════════════════════════════════════════════════════════ */
.module-slow-load {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(251,191,36,0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(251,191,36,0.15);
    color: var(--vscode-warning);
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 25;
    animation: slideUpToast 300ms var(--ease-out) forwards;
}

@keyframes slideUpToast {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.module-slow-load i { font-size: 13px; flex-shrink: 0; }

.module-slow-load__retry {
    background: rgba(251,191,36,0.1);
    border: 1px solid rgba(251,191,36,0.2);
    color: var(--vscode-warning);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    margin-left: 4px;
    transition: background 0.2s var(--ease-out);
}

.module-slow-load__retry:hover {
    background: rgba(251,191,36,0.18);
}

/* Tab activation flash */
@keyframes tabActivate {
    0%   { background-color: rgba(124,140,255,0.12); }
    100% { background-color: transparent; }
}

.tab.just-activated {
    animation: tabActivate 500ms var(--ease-out) forwards;
}

.content-iframe.optimized {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

/* Responsive skeleton/error */
@media (max-width: 768px) {
    .module-skeleton { padding: 16px; }
    .module-skeleton__header { margin-bottom: 20px; }
    .module-skeleton__icon { width: 34px; height: 34px; }
    .module-skeleton__badge { bottom: 14px; right: 14px; font-size: 10px; }
    .module-error { padding: 28px 16px; }
    .module-error__icon-wrap { width: 48px; height: 48px; }
    .module-error__title { font-size: 15px; }
    .module-slow-load { font-size: 11px; padding: 8px 12px; bottom: 48px; white-space: normal; text-align: center; max-width: calc(100vw - 40px); }
}

@media (max-width: 480px) {
    .module-error__actions { flex-direction: column; width: 100%; max-width: 260px; }
    .module-error__btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .content-iframe, .content-iframe.is-visible, .content-iframe.is-entering,
    .module-skeleton, .module-skeleton__topbar, .module-skeleton__icon,
    .module-skeleton__title, .module-skeleton__block, .module-error,
    .module-slow-load, .tab.just-activated {
        animation: none !important;
        transition: none !important;
    }
    .content-iframe.is-visible { opacity: 1; visibility: visible; }
}

/* Hide body scrollbar */
body {
    overflow: -moz-scrollbars-none;
    -ms-overflow-style: none;
}

body::-webkit-scrollbar {
    display: none;
}
