/* Additional luxury styling and animations for Boiler Room */

:root {
  --cyan: #00E5FF;
  --bright-cyan: #7DF9FF;
  --navy: #0A0C14;
  --deep: #0B0F1A;
  --mint: #00FF9F;
  --amber: #FF9F1C;
}

/* Subtle wood / opulent texture on panels */
.luxury-panel {
  position: relative;
}

.luxury-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 25% 20%, rgba(255,255,255,0.025) 0%, transparent 50%),
    radial-gradient(circle at 75% 80%, rgba(0, 229, 255, 0.03) 0%, transparent 60%),
    linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 20px 20px, 20px 20px;
  pointer-events: none;
  border-radius: inherit;
  z-index: 1;
}

/* Desk specific styling */
.desk-card {
  position: relative;
}

.desk-card .status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3F2E1F;
}

.desk-card.active .status-dot {
  background: #00FF9F;
  box-shadow: 0 0 6px #00FF9F;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* Stock focus indicator */
.stock-focus-badge {
  font-size: 9px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #C9A227;
  color: #0A0806;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Stronger focus instrument distinction (Task 38) */
.stock-card.focus {
  border-color: #C9A227 !important;
  box-shadow: 0 0 0 1px #C9A227, 0 0 0 4px rgba(201, 162, 39, 0.15), 0 12px 20px -4px rgb(0 0 0 / 0.45);
  position: relative;
}
.stock-card.focus::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: 0 0 18px rgba(201, 162, 39, 0.35);
  pointer-events: none;
  animation: focusGlow 2.2s ease-in-out infinite;
}
@keyframes focusGlow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Animated instrument logos pulse on high hype (Task 13) */
.instrument-logo.hype-pulse {
  animation: instrumentHypePulse 1.2s ease-in-out infinite;
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.5);
}
@keyframes instrumentHypePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Focus shift sweep effect (Task 135) */
#view-floor.focus-shift {
  animation: focusSweep 0.6s cubic-bezier(0.23,1,0.32,1);
}
@keyframes focusSweep {
  0% { box-shadow: inset 0 0 0 0 rgba(201,162,39,0.0); }
  30% { box-shadow: inset 0 0 80px rgba(201,162,39,0.18); }
  100% { box-shadow: inset 0 0 0 0 rgba(201,162,39,0.0); }
}

/* Upgrade cards */
.upgrade-card {
  transition: transform 0.15s cubic-bezier(0.23, 1, 0.32, 1), 
              border-color 0.15s ease;
}

.upgrade-card:hover {
  transform: translateY(-1px);
}

.upgrade-card .level-pill {
  background: #3F2E1F;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  color: #C9A227;
}

/* Candidate cards in modal */
.candidate-card {
  transition: all 0.1s ease;
  border: 1px solid #3F2E1F;
}

.candidate-card:active {
  transform: scale(0.985);
  border-color: #C9A227;
}

/* Broker row in team */
.broker-row {
  transition: all 0.1s ease;
}

.broker-row:active {
  background-color: #1F1812;
}

/* Animated phone icon inside desks */
.phone-icon {
  transition: transform 0.2s ease;
}

.desk-card.active .phone-icon {
  animation: phoneRing 0.9s ease-in-out infinite;
}

@keyframes phoneRing {
  0%, 100% { transform: rotate(-12deg); }
  50% { transform: rotate(12deg); }
}

/* Money particles container */
#desks-grid {
  position: relative;
}

/* Heat danger states */
#heat-fill.danger {
  background: linear-gradient(to right, #FF9F1C, #FFB84D);
  box-shadow: 0 0 8px rgba(255, 159, 28, 0.5);
}

/* Enhanced warning + critical scrutiny meter visuals (Task 18) */
#heat-fill.warning {
  background: linear-gradient(to right, #FF9F1C, #FF6B35);
  box-shadow: 0 0 10px rgba(255, 159, 28, 0.65);
  animation: heatPulse 1.1s ease-in-out infinite;
}
#heat-fill.critical {
  background: linear-gradient(to right, #FF3B3B, #FF6B35);
  box-shadow: 0 0 14px rgba(255, 59, 59, 0.8);
  animation: heatPulse 0.6s ease-in-out infinite, heatFlash 1.6s steps(1) infinite;
}
#heat-value.critical {
  color: #FF6B6B;
  animation: heatValueFlash 0.9s steps(2) infinite;
}

@keyframes heatPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}
@keyframes heatFlash {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35) saturate(1.2); }
}
@keyframes heatValueFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Power-up / level flash for traders (Task 48) */
.desk-card.power-flash {
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.6), 0 0 22px rgba(125, 249, 255, 0.35) !important;
  animation: powerFlashAnim 420ms ease-out;
}
@keyframes powerFlashAnim {
  0% { transform: scale(1.06); }
  40% { transform: scale(1.01); }
  100% { transform: scale(1); }
}

/* Legendary treatment for Closer & Shark (Task 12) */
.desk-card.legendary {
  border-color: #C9A227;
  box-shadow: 0 0 0 1px #C9A227, 0 0 12px rgba(201, 162, 39, 0.3);
}
.desk-card.legendary .broker-avatar {
  border-color: #C9A227;
  box-shadow: 0 0 8px #C9A227;
}
.broker-row.legendary {
  border-color: #C9A227;
}
.legendary-badge {
  font-size: 8px;
  padding: 0 4px;
  background: linear-gradient(90deg, #C9A227, #E8D48B);
  color: #0A0806;
  border-radius: 2px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Flow incoming particles (Task 23) */
.flow-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #00E5FF;
  border-radius: 50%;
  pointer-events: none;
  z-index: 40;
  box-shadow: 0 0 4px #7DF9FF;
  opacity: 0.85;
}

/* Speed buttons */
.speed-btn {
  color: #8B6F1A;
  font-weight: 600;
  letter-spacing: 1px;
}

.speed-btn.active {
  background: #00E5FF;
  color: #0B0F1A;
  border-color: #7DF9FF;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Premium embossed metallic for RETAIL BLAST button (Task 49) */
#blitz-button {
  box-shadow: 
    0 4px 0 #3F2E1F,
    0 6px 10px -2px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.1),
    inset 0 -2px 4px rgba(0,0,0,0.6);
  transition: transform 0.08s cubic-bezier(0.23,1,0.32,1), box-shadow 0.08s ease;
}

#blitz-button:active {
  transform: translateY(2px) scale(0.985);
  box-shadow: 
    0 2px 0 #3F2E1F,
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 -1px 3px rgba(0,0,0,0.5);
}

/* Nav styling overrides */
.nav-item {
  color: #8B6F1A;
}

.nav-item.active svg {
  stroke: #00E5FF;
}

/* Event outcome colors */
.event-positive { color: #00FF9F; }
.event-negative { color: #FF9F1C; }
.event-neutral { color: #00E5FF; }

/* Ticker items */
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-feature-settings: "tnum";
}

.ticker-change {
  font-size: 9px;
  padding: 0 3px;
  border-radius: 2px;
}

.ticker-up { color: #00FF9F; }
.ticker-down { color: #FF9F1C; }

/* Subtle vignette on body for immersion */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at center,
    transparent 55%,
    rgba(0, 0, 0, 0.35) 92%
  );
  z-index: 0;
}

/* Telegram safe area padding if needed */
@supports (padding: max(0px)) {
  .max-w-2xl {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* Make modals nicer on desktop */
@media (min-width: 640px) {
  #hire-modal > div,
  #event-modal > div {
    margin-top: 0;
    margin-bottom: 0;
  }
}

/* Additional iPhone WebView polish */
html, body {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

#desks-grid {
  min-height: 120px;
  border: 6px solid #12151F;
  border-radius: 4px;
  box-shadow: inset 0 2px 0 #2A3348, 0 0 0 1px #0B0F1A;
  padding: 4px;
  background: #0a0c14;
}

#desks-grid.wave .desk-card {
  animation: deskWave 0.6s ease;
}

@keyframes deskWave {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Little brass shine on primary pump button - enhanced premium embossed metallic (Task 49) */
#pump-button {
  box-shadow: 
    0 8px 0 #007A8A,
    0 10px 15px -3px rgba(0,0,0,0.4),
    inset 0 2px 0 rgba(255,255,255,0.7),
    inset 0 -3px 6px rgba(0,0,0,0.35),
    inset 0 1px 1px rgba(255,255,255,0.9);
  position: relative;
  overflow: hidden;
}

#pump-button::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 40%; height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.45),
    transparent
  );
  transition: left 0.6s;
}

#pump-button:hover::before {
  left: 250%;
}

#pump-button:active {
  transform: translateY(3px) scale(0.98);
  box-shadow: 
    0 4px 0 #007A8A,
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -2px 4px rgba(0,0,0,0.4);
}

/* Fancy desk number labels */
.desk-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 600;
  color: #8B6F1A;
}

/* Terminal data numbers (consistent with index.html) */
.data-num {
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace !important;
  font-feature-settings: "tnum" 1, "zero" 1;
  letter-spacing: -0.02em;
}

/* iPhone / iOS specific improvements */
@supports (padding: max(0px)) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .max-w-2xl {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* Better mobile experience */
@media (max-width: 390px) {
  .desk-card {
    padding: 0.5rem;
  }
  
  .desk-card .text-sm {
    font-size: 0.75rem;
  }
  
  .broker-avatar {
    width: 42px;
    height: 42px;
  }
  
  .luxury-btn {
    height: 3.25rem;
  }
  
  #pump-button .display-font {
    font-size: 1.25rem;
  }
}

/* Improve touch targets and prevent zoom issues */
button, .nav-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Spring-like button presses (Task 131) - bouncy without lib */
.luxury-btn, button, .nav-btn, .candidate-card button, .broker-row button {
  transition: transform 0.06s cubic-bezier(0.34, 1.56, 0.64, 1), 
              box-shadow 0.1s ease;
}
.luxury-btn:active, button:active, .nav-btn:active {
  transform: scale(0.92) !important;
}
.luxury-btn:not(:active), button:not(:active), .nav-btn:not(:active) {
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Banner image styling */
.app-banner {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.5);
  margin-bottom: 0.75rem;
  max-height: 140px;
}

.app-banner img {
  width: 100%;
  height: auto;
  display: block;
}

/* Optional CRT / scanline effect (Task 11) - subtle terminal nostalgia, perf friendly */
body.crt-active {
  position: relative;
}
body.crt-active::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99999;
  background: 
    linear-gradient(rgba(255,255,255,0.02) 50%, transparent 50%),
    linear-gradient(90deg, rgba(0,0,0,0.02) 50%, transparent 50%);
  background-size: 100% 3px, 4px 100%;
  opacity: 0.65;
  mix-blend-mode: screen;
  animation: crtScan 4.2s linear infinite;
}
body.crt-active::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99998;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 10, 20, 0.12) 92%
  );
  box-shadow: inset 0 0 80px rgba(0,0,0,0.45);
}

@keyframes crtScan {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 0 -100px, 0 0; }
}

/* Slight flicker on very high scrutiny when CRT on (optional extra) */
body.crt-active.scrutiny-critical {
  animation: crtFlicker 1.8s infinite steps(1);
}
@keyframes crtFlicker {
  0%, 100% { filter: none; }
  92% { filter: brightness(1.02) contrast(1.03); }
}
  object-fit: cover;
  max-height: 140px;
}

@media (max-width: 400px) {
  .app-banner {
    max-height: 100px;
    margin-bottom: 0.5rem;
  }
  .app-banner img {
    max-height: 100px;
  }
}

/* Matrix / data stream rain for high Scrutiny (Task 14) */
#matrix-rain {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.12;
  mix-blend-mode: screen;
}

/* Blueprint / schematic view (Task 65) */
.blueprint .desk-card {
  background: transparent;
  border: 1px dashed #00E5FF;
  color: #7DF9FF;
  box-shadow: none;
}
.blueprint .desk-card .broker-avatar {
  border-style: dashed;
  background: transparent;
}
.blueprint .status-dot {
  background: #00E5FF !important;
}

/* Paper tape log (Task 56) */
#paper-tape {
  font-feature-settings: "tnum";
}
@keyframes tape {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Surveillance camera overlay (Task 52) */
#surveillance-overlay {
  background: repeating-linear-gradient(
    45deg,
    rgba(180, 30, 30, 0.03) 0px,
    rgba(180, 30, 30, 0.03) 2px,
    transparent 3px,
    transparent 6px
  );
  box-shadow: inset 0 0 60px rgba(120, 20, 20, 0.2);
}

/* Confidential stamp / redacted for high scrutiny (Task 59) */
body.scrutiny-critical .luxury-panel {
  position: relative;
}
body.scrutiny-critical .luxury-panel::after {
  content: 'CONFIDENTIAL';
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #9F1E1E;
  opacity: 0.4;
  pointer-events: none;
  transform: rotate(12deg);
  border: 1px solid #9F1E1E;
  padding: 0 3px;
  line-height: 1;
}

/* Depth of field blur when modals open (Task 54) */
body.modal-open #desks-grid,
body.modal-open .luxury-panel {
  filter: blur(1.5px) brightness(0.85);
  transition: filter 0.2s ease;
}

/* Glitch text effect for major events (Task 50) */
.glitch {
  animation: glitch-anim 0.4s steps(2, end) infinite;
  position: relative;
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: #0A0C14;
}
.glitch::before {
  left: 2px;
  text-shadow: -1px 0 #FF9F1C;
  animation: glitch-anim 0.3s infinite linear alternate-reverse;
}
.glitch::after {
  left: -2px;
  text-shadow: 1px 0 #00E5FF;
  animation: glitch-anim 0.5s infinite linear alternate-reverse;
}
@keyframes glitch-anim {
  0% { clip: rect(0, 9999px, 20px, 0); }
  20% { clip: rect(10px, 9999px, 30px, 0); }
  40% { clip: rect(5px, 9999px, 15px, 0); }
  100% { clip: rect(0, 9999px, 9999px, 0); }
}