/* TDTM Web App - Retro Payphone Design */

:root {
  --bg-dark: #1a1a1a;
  --bg-booth: #2a2a2a;
  --chrome: linear-gradient(145deg, #d4d4d4, #a0a0a0);
  --chrome-pressed: linear-gradient(145deg, #909090, #b0b0b0);
  --chrome-border: #707070;
  --led-green: #33ff33;
  --led-glow: rgba(51, 255, 51, 0.4);
  --accent-red: #cc0000;
  --text-chrome: #333;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg-dark);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

/* Phone Container - looks like a payphone panel */
.phone-container {
  max-width: 380px;
  width: 100%;
  padding: 20px;
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
  border-radius: 20px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 3px solid #444;
}

/* Header */
.phone-header {
  text-align: center;
  margin-bottom: 15px;
}

.phone-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: bold;
  color: #c0c0c0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 4px;
}

.phone-header .subtitle {
  font-size: 10px;
  color: #888;
  letter-spacing: 2px;
  margin-top: 4px;
}

/* Display - LED style */
.phone-display {
  background: #111;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  border: 2px solid #333;
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.8),
    0 1px 0 rgba(255, 255, 255, 0.05);
  min-height: 100px;
}

#display {
  font-family: 'Courier New', monospace;
  color: var(--led-green);
  text-shadow: 0 0 10px var(--led-glow);
  font-size: 16px;
  line-height: 1.5;
}

#display .status {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 8px;
}

#display .hint {
  font-size: 12px;
  color: #22aa22;
  opacity: 0.8;
}

#display .extension {
  font-size: 28px;
  letter-spacing: 4px;
}

/* Hidden audio player */
#audio-player {
  display: none;
}

/* Recording Indicator */
.recording-indicator {
  text-align: center;
  padding: 10px;
  color: var(--accent-red);
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.recording-indicator.hidden {
  display: none;
}

.recording-indicator .pulse {
  width: 12px;
  height: 12px;
  background: var(--accent-red);
  border-radius: 50%;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.9); }
}

/* Keypad */
.keypad {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px;
  background: linear-gradient(180deg, #404040 0%, #353535 100%);
  border-radius: 12px;
  border: 2px solid #555;
}

.keypad-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Chrome Buttons */
.keypad-btn {
  width: 75px;
  height: 75px;
  border-radius: 50%;
  border: 3px solid var(--chrome-border);
  background: var(--chrome);
  color: var(--text-chrome);
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.1s ease;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.4),
    inset 0 -2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
}

.keypad-btn::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 20%;
  width: 60%;
  height: 30%;
  background: linear-gradient(180deg, rgba(255,255,255,0.5) 0%, transparent 100%);
  border-radius: 50%;
}

.keypad-btn:active {
  background: var(--chrome-pressed);
  transform: translateY(2px);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 -2px 4px rgba(255, 255, 255, 0.2);
}

.keypad-btn.special {
  background: linear-gradient(145deg, #e0e0e0, #b8b8b8);
}

.keypad-btn .sub {
  display: block;
  font-size: 8px;
  font-weight: normal;
  letter-spacing: 1px;
  margin-top: -2px;
  color: #555;
}

/* Phone Controls */
.phone-controls {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  justify-content: center;
}

.control-btn {
  flex: 1;
  max-width: 150px;
  padding: 15px 20px;
  border-radius: 25px;
  border: 3px solid;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.15s ease;
}

.control-btn.pickup {
  background: linear-gradient(145deg, #4a9c4a, #2d7a2d);
  border-color: #1d5a1d;
  color: white;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.control-btn.pickup:active {
  transform: translateY(2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-btn.hangup {
  background: linear-gradient(145deg, #cc4444, #992222);
  border-color: #771111;
  color: white;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.control-btn.hangup:active {
  transform: translateY(2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Coiled cord decoration */
.cord {
  width: 40px;
  height: 60px;
  margin: 20px auto 0;
  background: repeating-linear-gradient(
    0deg,
    #222 0px,
    #222 3px,
    #444 3px,
    #444 6px
  );
  border-radius: 20px;
  opacity: 0.5;
}

/* States */
.state-idle #display {
  color: #666;
  text-shadow: none;
}

.state-playing .now-playing {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.state-playing .audio-viz {
  display: flex;
  gap: 4px;
  margin-top: 10px;
}

.state-playing .audio-viz span {
  width: 4px;
  background: var(--led-green);
  animation: viz 0.5s ease-in-out infinite alternate;
}

.state-playing .audio-viz span:nth-child(1) { height: 10px; animation-delay: 0s; }
.state-playing .audio-viz span:nth-child(2) { height: 20px; animation-delay: 0.1s; }
.state-playing .audio-viz span:nth-child(3) { height: 15px; animation-delay: 0.2s; }
.state-playing .audio-viz span:nth-child(4) { height: 25px; animation-delay: 0.3s; }
.state-playing .audio-viz span:nth-child(5) { height: 12px; animation-delay: 0.4s; }

@keyframes viz {
  from { height: 5px; }
  to { height: 25px; }
}

/* Loading state */
.htmx-request #display::after {
  content: '...';
  animation: dots 1s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Responsive */
@media (max-width: 400px) {
  .phone-container {
    padding: 15px;
    border-radius: 0;
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .keypad-btn {
    width: 65px;
    height: 65px;
    font-size: 24px;
  }

  .keypad-row {
    gap: 10px;
  }
}

/* PWA standalone mode adjustments */
@media (display-mode: standalone) {
  .phone-container {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}
