/* ============================================
   TV RETRO VHS EFFECT - Realistic Power On/Off
   ============================================ */

#tv-retro-container {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  transition: all 0.3s ease;
}

#tv-retro-container.active {
  display: block;
}

/* TV Power On Animation */
@keyframes tv-power-on {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  20% {
    opacity: 0.3;
    background: #000;
  }
  40% {
    opacity: 0.5;
    background: #111;
    box-shadow: inset 0 0 30px rgba(0, 255, 0, 0.1);
  }
  60% {
    opacity: 0.7;
    background: #1a1a1a;
    box-shadow: inset 0 0 50px rgba(0, 255, 0, 0.2);
  }
  80% {
    opacity: 0.9;
    background: #222;
    box-shadow: inset 0 0 60px rgba(0, 255, 0, 0.15);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    background: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 100%);
    box-shadow: inset 0 0 80px rgba(0, 255, 0, 0.1);
  }
}

/* TV Power Off Animation */
@keyframes tv-power-off {
  0% {
    opacity: 1;
    transform: scale(1);
    background: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 100%);
    box-shadow: inset 0 0 80px rgba(0, 255, 0, 0.1);
  }
  20% {
    opacity: 0.8;
    background: #222;
    box-shadow: inset 0 0 60px rgba(0, 255, 0, 0.15);
    filter: brightness(1.2);
  }
  40% {
    opacity: 0.6;
    background: #1a1a1a;
    box-shadow: inset 0 0 50px rgba(0, 255, 0, 0.2);
    filter: brightness(1.5);
  }
  60% {
    opacity: 0.4;
    background: #111;
    box-shadow: inset 0 0 30px rgba(0, 255, 0, 0.3);
    filter: brightness(2);
  }
  80% {
    opacity: 0.2;
    background: #0a0a0a;
    filter: brightness(3);
  }
  100% {
    opacity: 0;
    transform: scale(0.95);
    background: #000;
    filter: brightness(0);
  }
}

/* CRT Glow Effect */
@keyframes crt-glow-on {
  0% {
    box-shadow: 
      0 0 0 rgba(0, 255, 0, 0),
      inset 0 0 0 rgba(0, 255, 0, 0);
  }
  50% {
    box-shadow: 
      0 0 30px rgba(0, 255, 0, 0.4),
      inset 0 0 40px rgba(0, 255, 0, 0.3);
  }
  100% {
    box-shadow: 
      0 0 10px rgba(0, 255, 0, 0.1),
      inset 0 0 20px rgba(0, 255, 0, 0.1);
  }
}

@keyframes crt-glow-off {
  0% {
    box-shadow: 
      0 0 10px rgba(0, 255, 0, 0.1),
      inset 0 0 20px rgba(0, 255, 0, 0.1);
  }
  50% {
    box-shadow: 
      0 0 30px rgba(0, 255, 0, 0.3),
      inset 0 0 40px rgba(0, 255, 0, 0.2);
  }
  100% {
    box-shadow: 
      0 0 0 rgba(0, 255, 0, 0),
      inset 0 0 0 rgba(0, 255, 0, 0);
  }
}

/* Screen brightness animation */
@keyframes screen-brightness-on {
  0% { filter: brightness(0); }
  100% { filter: brightness(1); }
}

@keyframes screen-brightness-off {
  0% { filter: brightness(1); }
  100% { filter: brightness(0); }
}

/* Power on/off states */
#tv-retro-container.powered-on .tv-screen {
  animation: tv-power-on 0.8s ease-out forwards, crt-glow-on 1s ease-out 0.3s forwards;
}

#tv-retro-container.powered-on .tv-screen .tv-content {
  animation: screen-brightness-on 0.6s ease-out 0.4s forwards;
}

#tv-retro-container.powered-off .tv-screen {
  animation: tv-power-off 0.6s ease-in forwards, crt-glow-off 0.5s ease-in forwards;
}

#tv-retro-container.powered-off .tv-screen .tv-content {
  animation: screen-brightness-off 0.4s ease-in forwards;
}

/* Initial state - screen off */
#tv-retro-container .tv-screen {
  background: #000;
  opacity: 0;
}

/* Tape Selector in Menu */
.tv-tape-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.tv-tape-selector label {
  color: #0f0;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.tv-tape-selector select {
  background: linear-gradient(180deg, #1a1a2e 0%, #0d0d1a 100%);
  color: #0f0;
  border: 1px solid #333;
  padding: 6px 10px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  cursor: pointer;
  min-width: 140px;
}

.tv-tape-selector select:hover {
  border-color: #0f0;
}

.tv-tape-selector select:focus {
  outline: none;
  border-color: #0f0;
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
}

/* Console Selector */
.tv-console-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.console-btn {
  width: 36px;
  height: 36px;
  background: linear-gradient(145deg, #222, #111);
  border: 1px solid #444;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.console-btn:hover {
  border-color: #0f0;
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.console-btn:active {
  transform: scale(0.95);
}

/* TV Screen Tape Animation (inside TV) */
.tv-tape-anim {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  z-index: 50;
}

.tv-tape-anim.active {
  display: flex;
  animation: tape-insert 0.3s ease;
}

.tv-tape-anim .tape-icon {
  font-size: 40px;
  animation: tape-spin 1s infinite linear;
}

.tv-tape-anim .tape-text {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #0f0;
  text-shadow: 0 0 10px #0f0;
}

@keyframes tape-insert {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes tape-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Tape Animation */
.tape-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.tape-insert-anim {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.tape-insert-anim .tape-icon {
  font-size: 50px;
}

.tape-insert-anim .tape-text {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #0f0;
  text-shadow: 0 0 10px #0f0;
  letter-spacing: 2px;
}

.tv-retro {
  width: 320px;
  height: 240px;
  background: #111;
  border-radius: 20px;
  border: 4px solid #333;
  box-shadow: 
    0 0 20px rgba(0,0,0,0.5),
    inset 0 0 50px rgba(0,0,0,0.8);
  position: relative;
  overflow: hidden;
}

.tv-screen {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 100%);
  position: relative;
}

.tv-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f0;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  text-shadow: 0 0 5px #0f0;
  padding: 10px;
  text-align: center;
  animation: tv-flicker 0.1s infinite;
}

@keyframes tv-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.97; }
}

/* VHS Static noise overlay */
.vhs-static {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255,255,255,0.03) 2px,
    rgba(255,255,255,0.03) 4px
  );
  pointer-events: none;
  animation: vhs-scan 0.5s steps(3) infinite;
}

@keyframes vhs-scan {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

/* VHS tracking lines */
.vhs-tracking {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    repeating-linear-gradient(
      90deg,
      transparent,
      rgba(255,255,255,0.02) 10px,
      transparent 20px
    );
  animation: vhs-tracking 2s linear infinite;
}

@keyframes vhs-tracking {
  0% { transform: translateX(0); }
  100% { transform: translateX(20px); }
}

/* TV Screen effects */
.tv-glitch {
  animation: tv-glitch 0.3s steps(2) infinite;
}

@keyframes tv-glitch {
  0% { transform: translateX(0); filter: hue-rotate(0deg); }
  25% { transform: translateX(-2px); filter: hue-rotate(10deg); }
  50% { transform: translateX(2px); filter: hue-rotate(-10deg); }
  75% { transform: translateX(-1px); filter: hue-rotate(5deg); }
  100% { transform: translateX(0); filter: hue-rotate(0deg); }
}

/* Old TV curvature effect */
.tv-curve::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    transparent 0%,
    rgba(0,0,0,0.3) 80%,
    rgba(0,0,0,0.6) 100%
  );
  pointer-events: none;
}

/* TV Controls */
.tv-controls {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}

.tv-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #444;
  background: #222;
  color: #666;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.tv-btn:hover {
  border-color: #0f0;
  color: #0f0;
}

/* Volume Indicator */
.tv-volume-indicator {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-family: 'Courier New', monospace;
  color: #0f0;
  font-size: 10px;
  background: rgba(0,0,0,0.7);
  padding: 2px 6px;
  border-radius: 3px;
}

/* TV Remote Control - SEPARADO da TV */
#tv-remote {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 150px;
  background: linear-gradient(145deg, #1a1a1a, #0d0d0d);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 
    0 0 25px rgba(0,0,0,0.9),
    inset 0 1px 0 rgba(255,255,255,0.1);
  border: 2px solid #333;
  z-index: 10000;
  cursor: default;
}

.remote-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  margin-bottom: 8px;
  background: linear-gradient(145deg, #252525, #151515);
  border-radius: 8px;
  cursor: move;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  color: #0f0;
  user-select: none;
}

.remote-header:hover {
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
}

.remote-close {
  cursor: pointer;
  color: #888;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
}

.remote-close:hover {
  background: #ff4444;
  color: white;
}

.remote-display {
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 10px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #0f0;
  display: flex;
  justify-content: space-between;
}

.remote-power {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  background: linear-gradient(145deg, #333, #111);
  border-radius: 50%;
  border: 2px solid #444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.remote-power:hover {
  border-color: #0f0;
  color: #0f0;
  box-shadow: 0 0 10px rgba(0,255,0,0.3);
}

.remote-ch, .remote-vol {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.remote-ch button, .remote-vol button {
  width: 28px;
  height: 22px;
  background: linear-gradient(145deg, #222, #111);
  border: 1px solid #333;
  border-radius: 4px;
  color: #888;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.remote-ch button:hover, .remote-vol button:hover {
  background: #333;
  color: #0f0;
}

.remote-ch span, .remote-vol span {
  font-family: 'Courier New', monospace;
  font-size: 9px;
  color: #666;
}

.remote-nums {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 10px;
}

.remote-nums button {
  width: 32px;
  height: 26px;
  background: linear-gradient(145deg, #222, #111);
  border: 1px solid #333;
  border-radius: 4px;
  color: #888;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  transition: all 0.15s;
}

.remote-nums button:hover {
  background: #333;
  color: #0f0;
  border-color: #0f0;
}

/* Channel display */
.tv-channel {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #000;
  padding: 2px 8px;
  font-family: 'Courier New', monospace;
  color: #0f0;
  font-size: 10px;
  border: 1px solid #333;
}

/* Date/Time display */
.tv-datetime {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: 'Courier New', monospace;
  color: #0f0;
  font-size: 10px;
}

/* TV antennas */
.tv-antennas {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 30px;
}

.antenna {
  width: 2px;
  height: 20px;
  background: #444;
  transform: rotate(-30deg);
}

.antenna:last-child {
  transform: rotate(30deg);
}

/* CRT Turn on effect */
.crt-on {
  animation: crt-power-on 0.5s ease-out;
}

@keyframes crt-power-on {
  0% { 
    filter: brightness(3) contrast(2);
    transform: scale(1.1);
  }
  100% { 
    filter: brightness(1) contrast(1);
    transform: scale(1);
  }
}

/* Blue screen */
.tv-blue {
  background: #001133 !important;
}

.tv-no-signal {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-no-signal::after {
  content: 'SEM SINAL';
  color: #666;
  font-family: 'Courier New', monospace;
  animation: no-signal-blink 1s infinite;
}

@keyframes no-signal-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}