/**
 * Peripheral Fullscreen Styles
 *
 * CSS for fullscreen overlays when peripherals (Calculator, CC40)
 * are clicked to enter fullscreen mode.
 *
 * Z-Index Hierarchy:
 * - 100: Fullscreen peripheral overlay
 * - 101: Close button
 * - 200: TUI menu backdrop (must be above fullscreen)
 */

/* Fullscreen overlay */
.peripheral-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fullscreen content container */
.peripheral-fullscreen-content {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 40px;
}

/* Close button */
.peripheral-fullscreen-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 101;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: #00ff66;
  font-family: 'VT323', monospace;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.peripheral-fullscreen-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  color: #00ff88;
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(0, 255, 102, 0.3);
}

.peripheral-fullscreen-close:active {
  transform: scale(0.95);
}

/* Panel hover effect (when peripheral is in bay) */
.peripheral-slot:hover {
  transform: translateY(-5px) scale(1.05);
  filter: drop-shadow(0 12px 24px rgba(0, 255, 100, 0.3));
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.peripheral-slot {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

/* Calculator-specific scaling */
.calculator-peripheral-panel {
  transform: scale(0.6);
  transform-origin: top left;
  transition: transform 0.3s ease;
}

.peripheral-fullscreen-overlay .calculator-peripheral-panel {
  transform: scale(2.5);
  transform-origin: center center;
}

/* CC40-specific scaling */
.cc40-peripheral-panel {
  transform: scale(0.6);
  transform-origin: top left;
  transition: transform 0.3s ease;
}

.peripheral-fullscreen-overlay .cc40-peripheral-panel {
  transform: scale(1.5);
  transform-origin: center center;
}

/* Printer-specific scaling */
.printer-peripheral-panel {
  transform: scale(0.5);
  transform-origin: top left;
  transition: transform 0.3s ease;
}

.peripheral-fullscreen-overlay .printer-peripheral-panel {
  transform: scale(1);
  transform-origin: center center;
}

/* Ensure peripheral components are clickable */
.calculator-peripheral-panel,
.cc40-peripheral-panel,
.printer-peripheral-panel {
  position: relative;
  pointer-events: all;
}

/* Ensure fullscreen overlay is above most UI elements but below TUI menu */
.peripheral-fullscreen-overlay {
  z-index: 100;
}

/* TUI menu should be above fullscreen peripherals */
.tui-menu-backdrop {
  z-index: 200 !important;
}

.tui-menu-container {
  z-index: 201 !important;
}

/* Animation for entering fullscreen */
@keyframes scaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.peripheral-fullscreen-content > * {
  animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth transitions for mode changes */
.calculator-peripheral-panel,
.cc40-peripheral-panel,
.printer-peripheral-panel {
  will-change: transform;
}

/* Ensure peripheral bay has proper stacking context */
#peripheral-bay {
  position: relative;
  z-index: 1;
}

/* Panel container styling */
.calculator-peripheral-panel,
.cc40-peripheral-panel,
.printer-peripheral-panel {
  background: transparent;
  border-radius: 12px;
  padding: 10px;
  box-sizing: border-box;
}

/* Hover glow effect for clickable peripherals */
.calculator-peripheral-panel:hover,
.cc40-peripheral-panel:hover,
.printer-peripheral-panel:hover {
  box-shadow: 0 0 30px rgba(0, 255, 100, 0.2);
  filter: brightness(1.1);
}

/* Remove hover effect when in fullscreen */
.peripheral-fullscreen-overlay .calculator-peripheral-panel:hover,
.peripheral-fullscreen-overlay .cc40-peripheral-panel:hover,
.peripheral-fullscreen-overlay .printer-peripheral-panel:hover {
  box-shadow: none;
  filter: none;
}

/* Keyboard focus indicator */
.peripheral-fullscreen-overlay:focus-within {
  outline: none;
}

/* Loading/error states */
.peripheral-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: #00ff66;
  font-family: 'VT323', monospace;
  font-size: 24px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.peripheral-error {
  color: #ff3366;
  font-family: 'VT323', monospace;
  font-size: 18px;
  text-align: center;
  padding: 20px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .peripheral-fullscreen-overlay .calculator-peripheral-panel {
    transform: scale(2);
  }

  .peripheral-fullscreen-overlay .cc40-peripheral-panel {
    transform: scale(1.2);
  }

  .peripheral-fullscreen-overlay .printer-peripheral-panel {
    transform: scale(0.9);
  }
}

@media (max-width: 768px) {
  .peripheral-fullscreen-overlay .calculator-peripheral-panel {
    transform: scale(1.5);
  }

  .peripheral-fullscreen-overlay .cc40-peripheral-panel {
    transform: scale(1);
  }

  .peripheral-fullscreen-overlay .printer-peripheral-panel {
    transform: scale(0.7);
  }

  .peripheral-fullscreen-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 30px;
  }
}
