/* ==========================================================================
   ENFINI OS DESKTOP STYLES
   Entorno de escritorio, panel superior, iconos y widgets
   ========================================================================== */

#desktop-environment {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: #060914;
  background-image: 
    /* 1. Iluminación y glow ambiental del servidor central */
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(14, 165, 233, 0.14) 0%, transparent 70%),
    radial-gradient(circle at 88% 85%, rgba(99, 102, 241, 0.08) 0%, transparent 48%),
    radial-gradient(circle at 12% 78%, rgba(16, 185, 129, 0.05) 0%, transparent 42%),
    /* 2. Micro-nodos en intersecciones mayores */
    radial-gradient(rgba(56, 189, 248, 0.3) 1.25px, transparent 1.25px),
    /* 3. Rejilla técnica menor (32px) */
    linear-gradient(rgba(56, 189, 248, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.022) 1px, transparent 1px),
    /* 4. Rejilla estructural mayor (128px) */
    linear-gradient(rgba(56, 189, 248, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.055) 1px, transparent 1px),
    /* 5. Trazas diagonales de circuito wafer */
    repeating-linear-gradient(45deg, transparent, transparent 160px, rgba(14, 165, 233, 0.012) 160px, rgba(14, 165, 233, 0.012) 161px);
  background-size: 
    100% 100%,
    100% 100%,
    100% 100%,
    128px 128px,
    32px 32px,
    32px 32px,
    128px 128px,
    128px 128px,
    100% 100%;
  background-position:
    0 0,
    0 0,
    0 0,
    -1px -1px,
    0 0,
    0 0,
    0 0,
    0 0,
    0 0;
}

/* Capa estática de interconexión con cero sobrecarga de CPU */
#computing-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.6;
}

/* Panel Superior / Barra de Tareas */
#top-panel {
  height: 38px;
  background: rgba(11, 16, 28, 0.92);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 10000;
  position: relative;
}

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

/* Botón de Inicio Enfini */
.btn-start {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(41, 121, 255, 0.2));
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  transition: all var(--transition-fast);
}

.btn-start:hover {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.35), rgba(41, 121, 255, 0.35));
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

.btn-start svg {
  width: 16px;
  height: 16px;
  fill: var(--accent-cyan);
}

/* Tareas Activas en la barra */
#taskbar-windows {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
}

.taskbar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  height: 28px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.taskbar-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.taskbar-item.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--accent-cyan);
  color: #fff;
}

/* Indicadores de Estado */
.panel-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: rgba(14, 20, 34, 0.6);
  color: var(--text-secondary);
}

.panel-badge-freelance {
  cursor: pointer;
  background: rgba(0, 230, 118, 0.1);
  border-color: rgba(0, 230, 118, 0.3);
  color: var(--accent-green);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.panel-badge-freelance:hover {
  background: rgba(0, 230, 118, 0.2);
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.3);
}

.clock-widget {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-primary);
  padding: 0 6px;
}

.btn-panel-action {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.btn-panel-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Menú de Inicio Desplegable */
#start-menu {
  position: absolute;
  top: 42px;
  left: 12px;
  width: 320px;
  max-height: calc(100vh - 54px);
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(14, 20, 35, 0.96);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-window);
  z-index: 10001;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform-origin: top left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 229, 255, 0.3) rgba(10, 15, 25, 0.6);
}

#start-menu::-webkit-scrollbar {
  width: 5px;
}
#start-menu::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.3);
  border-radius: 3px;
}

#start-menu.hidden {
  opacity: 0;
  transform: scale(0.95) translateY(-8px);
  pointer-events: none;
}

.start-header {
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 6px;
}

.start-header h3 {
  font-size: 0.95rem;
  color: #fff;
}

.start-header p {
  font-size: 0.75rem;
  color: var(--accent-cyan);
}

.start-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.88rem;
  transition: all var(--transition-fast);
}

.start-item:hover {
  background: rgba(0, 229, 255, 0.12);
  color: #fff;
  transform: translateX(4px);
}

.start-item svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Submenú Desplegable de Demos */
.start-submenu-toggle {
  background: rgba(0, 229, 255, 0.05);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.start-submenu-toggle:hover {
  background: rgba(0, 229, 255, 0.15);
  border-color: rgba(0, 229, 255, 0.4);
}

.submenu-arrow {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  transition: transform 0.2s ease;
  display: inline-block;
}

.start-submenu-toggle.expanded .submenu-arrow {
  transform: rotate(90deg);
}

.start-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 4px 10px;
  border-left: 2px solid rgba(0, 229, 255, 0.35);
  margin-left: 12px;
  transition: all 0.2s ease;
}

.start-submenu.hidden {
  display: none;
}

.start-sub-item {
  font-size: 0.82rem;
  padding: 6px 10px;
}

.start-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* Área de Escritorio / Iconos */
#desktop-canvas {
  flex: 1;
  position: relative;
  overflow: hidden;
  padding: 24px;
}

#desktop-icons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  grid-auto-rows: 105px;
  gap: 16px;
  width: 100%;
  max-width: 600px;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  border: 1px solid transparent;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  background: rgba(255, 255, 255, 0.02);
  position: relative;
  z-index: 2;
}

.desktop-icon:hover {
  background: rgba(0, 229, 255, 0.09);
  border-color: rgba(0, 229, 255, 0.4);
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 229, 255, 0.25);
}

.desktop-icon:active {
  transform: scale(0.96);
}

.icon-img-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  background: rgba(18, 26, 46, 0.85);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  transition: all var(--transition-fast);
}

.desktop-icon:hover .icon-img-box {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.45);
  transform: scale(1.05);
}

.icon-img-box svg {
  width: 24px;
  height: 24px;
  fill: var(--accent-cyan);
}

.desktop-icon span {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  line-height: 1.2;
}

/* Espacio Reservado para Anuncios / Patrocinio */
#ad-widget-container {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 300px;
  background: rgba(13, 19, 33, 0.88);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px dashed rgba(64, 90, 140, 0.6);
  border-radius: var(--radius-md);
  padding: 10px;
  z-index: 50;
  transition: all var(--transition-normal);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

#ad-widget-container.minimized {
  width: auto;
  padding: 6px 12px;
  background: rgba(13, 19, 33, 0.6);
  border-style: solid;
}

#ad-widget-container.minimized .ad-body {
  display: none;
}

.ad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ad-badge-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.btn-toggle-ad {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0 4px;
  cursor: pointer;
}

.btn-toggle-ad:hover {
  color: var(--text-primary);
}

.ad-body {
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px;
  text-align: center;
}

.ad-placeholder-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.ad-subtext {
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.7;
}
