/**
 * Desktop Peripherals Styles
 * 
 * Styles for the "desk" area where external peripherals like printers,
 * calculators, and computers sit. These are separate from the internal
 * drive bay (floppy, HDD) which is built into the CRT case.
 */

/* ============================================
   DESKTOP ENVIRONMENT - Overall container
   ============================================ */
.desktop-environment {
  position: relative;
  width: 100%;
  height: 100%;

  /* Center the CRT monitor */
  display: flex;
  align-items: center;
  justify-content: center;

  /* Dark ambient background - the "room" */
  background: linear-gradient(
    180deg,
    #0a0a0f 0%,
    #0d0d14 30%,
    #12121a 60%,
    #0a0a0f 100%
  );
  
  /* Subtle vignette for depth */
  box-shadow: inset 0 0 200px 100px rgba(0, 0, 0, 0.5);
}

/* Scan line overlay for retro feel */
.desktop-environment::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.15) 3px,
    rgba(0, 0, 0, 0.15) 4px
  );
  pointer-events: none;
  animation: backdrop-scan 30s linear infinite;
  z-index: 1;
}

/* Ambient light glow from terminal */
.desktop-environment::after {
  content: '';
  position: fixed;
  top: 20%;
  left: 50%;
  width: 80%;
  height: 60%;
  transform: translateX(-50%);
  background: radial-gradient(
    ellipse at center top,
    rgba(0, 255, 100, 0.03) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 1;
}

@keyframes backdrop-scan {
  0% { background-position: 0 0; }
  100% { background-position: 0 400px; }
}

/* ============================================
   DESKTOP PERIPHERALS - Area beside/behind CRT
   ============================================ */
.desktop-peripherals {
  position: fixed;
  z-index: 5; /* Between background (0) and CRT (10) */
  pointer-events: none; /* Allow clicking through to CRT */
  
  /* Full viewport coverage for positioning peripherals anywhere */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

#desktop-peripheral-bay {
  position: relative;
  width: 100%;
  height: 100%;
  
  /* Peripherals inside will be positioned absolutely */
}

/* ============================================
   DESKTOP PERIPHERAL ITEM - Individual device
   ============================================ */
.desktop-peripheral-item {
  position: absolute;
  pointer-events: auto;
  cursor: grab;
  
  /* Slight depth effect - further from screen */
  filter: 
    brightness(0.85)
    saturate(0.9);
  
  /* Smooth transitions for drag and focus */
  transition: 
    filter 0.3s ease,
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.desktop-peripheral-item:hover {
  filter: 
    brightness(0.95)
    saturate(0.95);
  z-index: 6;
}

.desktop-peripheral-item.dragging {
  cursor: grabbing;
  filter: brightness(1) saturate(1);
  z-index: 100;
  transition: none;
}

/* Focused/active peripheral - comes forward */
.desktop-peripheral-item.focused {
  filter: brightness(1) saturate(1);
  z-index: 50;
  transform: scale(1.02);
}

/* Drop shadow for grounding on desk */
.desktop-peripheral-item::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 10%;
  right: 10%;
  height: 20px;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.4) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: -1;
}

/* ============================================
   PERIPHERAL CATEGORY: PRINTER
   Positioned to the side, partially visible
   ============================================ */
.desktop-peripheral-item[data-type="printer"] {
  /* Default position: right side, partially off-screen */
  right: -100px;
  top: 30%;
  transform: scale(0.7);
  transform-origin: right center;
}

.desktop-peripheral-item[data-type="printer"]:hover {
  right: -50px;
  transform: scale(0.75);
}

.desktop-peripheral-item[data-type="printer"].focused {
  right: 20px;
  transform: scale(0.85);
}

/* ============================================
   PERIPHERAL CATEGORY: CALCULATOR / CC40
   Desktop items that sit in front
   ============================================ */
.desktop-peripheral-item[data-type="calculator"],
.desktop-peripheral-item[data-type="computer"] {
  /* Default: bottom area of screen */
  bottom: 10%;
  transform: scale(0.8);
  transform-origin: center bottom;
}

.desktop-peripheral-item[data-type="calculator"] {
  left: 5%;
}

.desktop-peripheral-item[data-type="computer"] {
  left: 20%;
}

.desktop-peripheral-item[data-type="calculator"]:hover,
.desktop-peripheral-item[data-type="computer"]:hover {
  transform: scale(0.85);
}

.desktop-peripheral-item[data-type="calculator"].focused,
.desktop-peripheral-item[data-type="computer"].focused {
  transform: scale(1);
  bottom: 15%;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 1200px) {
  .desktop-peripheral-item[data-type="printer"] {
    right: -150px;
    transform: scale(0.6);
  }
  
  .desktop-peripheral-item[data-type="printer"]:hover {
    right: -100px;
  }
}

@media (max-width: 900px) {
  .desktop-peripheral-item[data-type="printer"] {
    display: none; /* Hide printer on small screens */
  }
  
  .desktop-peripheral-item[data-type="calculator"],
  .desktop-peripheral-item[data-type="computer"] {
    transform: scale(0.6);
  }
}

@media (max-width: 600px) {
  .desktop-peripherals {
    display: none; /* Hide all desktop peripherals on mobile */
  }
}
