/* Exact Minecraft-Style VoiceChat Interface */

@font-face {
  font-family: 'Minecraft';
  src: url('textures/Minecraft.ttf') format('truetype');
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: url('textures/Dirt_background_JE1.jpg') repeat;
  image-rendering: pixelated;
  font-family: 'Minecraft', 'Courier New', monospace;
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-x: hidden;
}

/* Prevent scrollbar from shifting layout */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: -1;
}

/* Minecraft GUI Frame */
.minecraft-frame {
  width: 520px;
  max-width: 95vw;
  background: #c6c6c6;
  border: 6px solid #999;
  box-shadow: 6px 6px 0 #373737, inset 2px 2px 0 #ffffff80;
}

/* Title Bar */
.title-bar {
  text-align: center;
  padding: 12px;
  color: #000;
  border-bottom: 3px solid #8f8f8f;
  font-size: 16px;
  font-weight: normal;
  user-select: none;
  background: linear-gradient(to bottom, #e6e6e6, #c6c6c6);
  text-shadow: 1px 1px 0 #ffffff80;
}

/* Content Area */
.content-area {
  padding: 16px;
}

/* Panel (where players are listed) */
.player-panel {
  border: 3px solid #8f8f8f;
  background: #2b2b2b;
  color: #fff;
  max-height: 420px;
  overflow-y: auto;
  box-shadow: inset 2px 2px 0 #000000, inset -1px -1px 0 #4a4a4a;
}

/* Custom Scrollbar */
.player-panel::-webkit-scrollbar {
  width: 12px;
}

.player-panel::-webkit-scrollbar-track {
  background: #2b2b2b;
}

.player-panel::-webkit-scrollbar-thumb {
  background-color: #8f8f8f;
  border: 2px solid #2b2b2b;
}

/* Player Row */
.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #2b2b2b;
  border-bottom: 2px solid #3a3a3a;
}

.player-row:last-child {
  border-bottom: none;
}

.player-row:hover {
  background: #333333;
}

.player-row.selected {
  background: #2a2a2a;
  border-left: 4px solid #ffffff;
  padding-left: 8px;
}

/* Player Avatar Container */
.player-avatar-container {
  position: relative;
  flex-shrink: 0;
}

.player-avatar {
  width: 42px;
  height: 42px;
  border: 3px solid #8f8f8f;
  flex-shrink: 0;
  image-rendering: pixelated;
  box-shadow: 2px 2px 0 #373737;
}

/* Mute Indicator */
.mute-indicator {
  position: absolute;
  top: -5px;
  right: -8px;
  width: 20px;
  height: 20px;
  border: 2px solid #8f8f8f;
  background: #c6c6c6;
  box-shadow: 2px 2px 0 #373737;
  image-rendering: pixelated;
}

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

/* Deafen Indicator */
.deafen-indicator {
  position: absolute;
  bottom: -5px;
  right: -8px;
  width: 20px;
  height: 20px;
  border: 2px solid #8f8f8f;
  background: #c6c6c6;
  box-shadow: 2px 2px 0 #373737;
  image-rendering: pixelated;
}

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

.player-row.selected .player-avatar {
  border-color: #ffffff;
  box-shadow: 2px 2px 0 #373737, 0 0 8px rgba(255, 255, 255, 0.3);
}

.player-row.speaking .player-avatar {
  border-color: #4caf50;
  box-shadow: 2px 2px 0 #373737, 0 0 12px rgba(76, 175, 80, 0.8);
}

/* Player Name */
.player-name {
  font-size: 14px;
  flex-grow: 1;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-row.speaking .player-name {
  color: #4caf50;
}

/* Voice Indicator */
.voice-indicator {
  width: 80px;
  min-width: 80px;
  height: 14px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.voice-level-bar {
  width: 100%;
  height: 100%;
  background: #373737;
  border: 2px solid #8f8f8f;
  overflow: hidden;
  box-shadow: inset 1px 1px 2px #000;
}

.voice-level-fill {
  height: 100%;
  width: 0%;
  background: #607d8b;
  transition: width 0.05s ease-out, background 0.2s ease;
}

.player-row.speaking .voice-level-fill {
  background: #4caf50;
}

/* Player Controls */
.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Volume Slider - Minecraft Style */
.volume-slider {
  width: 100px;
  height: 18px;
  -webkit-appearance: none;
  appearance: none;
  background: #373737;
  border: 2px solid #8f8f8f;
  outline: none;
  box-shadow: inset 1px 1px 2px #000;
}

.volume-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 14px;
  background: #373737;
  border: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 14px;
  background: linear-gradient(to bottom, #e6e6e6, #c6c6c6);
  border: 2px solid #8f8f8f;
  cursor: pointer;
  box-shadow: inset 0 1px 0 #ffffff80, inset 0 -1px 0 #8f8f8f;
}

/* Firefox */
.volume-slider::-moz-range-track {
  width: 100%;
  height: 14px;
  background: #373737;
  border: none;
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 14px;
  background: linear-gradient(to bottom, #e6e6e6, #c6c6c6);
  border: 2px solid #8f8f8f;
  cursor: pointer;
  border-radius: 0;
}

/* Volume Label */
.volume-label {
  font-size: 10px;
  color: #aaa;
  min-width: 30px;
  text-align: right;
  font-family: 'Minecraft', 'Courier New', monospace;
}

/* Icons */
.icon {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.icon:hover {
  filter: brightness(1.3) drop-shadow(0 0 3px rgba(255, 255, 255, 0.4));
}

.icon:active {
  filter: brightness(0.9);
}

.mic-icon {
  filter: brightness(1.2);
  opacity: 0.8;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.toolbar-left {
  display: flex;
  gap: 8px;
}

/* Toolbar Button */
.toolbar-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 3px solid #8f8f8f;
  background: linear-gradient(to bottom, #e6e6e6, #c6c6c6);
  box-shadow: inset 0 2px 0 #ffffff80, inset 0 -2px 0 #8f8f8f, 2px 2px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toolbar-btn:hover {
  background: linear-gradient(to bottom, #f0f0f0, #dfdfdf);
  transform: translateY(-1px);
  box-shadow: inset 0 2px 0 #ffffff80, inset 0 -2px 0 #8f8f8f, 2px 3px 6px rgba(0, 0, 0, 0.4);
}

.toolbar-btn:active {
  background: linear-gradient(to bottom, #c6c6c6, #bdbdbd);
  box-shadow: inset 0 2px 0 #8f8f8f, inset 0 -2px 0 #ffffff80, 1px 1px 2px rgba(0, 0, 0, 0.3);
  transform: translateY(1px);
}

.toolbar-btn.active {
  background: linear-gradient(to bottom, #c6c6c6, #bdbdbd);
  box-shadow: inset 0 2px 0 #8f8f8f, inset 0 -2px 0 #ffffff80, 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Permission/Loading Screens */
.screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.permission-frame {
  background: #c6c6c6;
  border: 4px solid #999;
  box-shadow: 4px 4px 0 #373737, inset 2px 2px 0 #ffffff80;
  padding: 20px;
}

.mc-button {
  background: linear-gradient(to bottom, #e6e6e6, #c6c6c6);
  border: 3px solid #8f8f8f;
  box-shadow: inset 0 2px 0 #ffffff80, inset 0 -2px 0 #8f8f8f, 2px 2px 4px rgba(0, 0, 0, 0.3);
  color: #000;
  padding: 16px 24px;
  font-family: 'Minecraft', 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: 1px 1px 0 #ffffff80;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 12px;
}

.permission-icon {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.loading-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

 .loading-content .permission-icon {
  width: 32px;
  height: 32px;
 }

.loading-text {
  font-family: 'Minecraft', 'Courier New', monospace;
  font-size: 14px;
  color: #000;
  text-shadow: 1px 1px 0 #ffffff80;
  white-space: nowrap;
}

.mc-button:hover {
  background: linear-gradient(to bottom, #f0f0f0, #dfdfdf);
  transform: translateY(-1px);
  box-shadow: inset 0 2px 0 #ffffff80, inset 0 -2px 0 #8f8f8f, 2px 3px 6px rgba(0, 0, 0, 0.4);
}

.mc-button:active {
  background: linear-gradient(to bottom, #c6c6c6, #bdbdbd);
  box-shadow: inset 0 2px 0 #8f8f8f, inset 0 -2px 0 #ffffff80, 1px 1px 2px rgba(0, 0, 0, 0.3);
  transform: translateY(1px);
}

/* Hidden */
.hidden {
  display: none !important;
}

/* Microphone Dropdown Menu */
.mic-dropdown {
  position: absolute;
  bottom: 54px;
  left: 0;
  background: #c6c6c6;
  border: 3px solid #8f8f8f;
  box-shadow: inset 0 2px 0 #ffffff80, inset 0 -2px 0 #8f8f8f, 4px 4px 8px rgba(0, 0, 0, 0.4);
  z-index: 1001;
  min-width: 200px;
  display: none;
}

.mic-dropdown.show {
  display: block;
}

.mic-dropdown-item {
  padding: 8px 12px;
  color: #000;
  cursor: pointer;
  font-family: 'Minecraft', 'Courier New', monospace;
  font-size: 12px;
  border-bottom: 1px solid #8f8f8f;
  background: #c6c6c6;
  transition: background-color 0.2s ease;
}

.mic-dropdown-item:last-child {
  border-bottom: none;
}

.mic-dropdown-item:hover {
  background: #dfdfdf;
}

.mic-dropdown-item.selected {
  background: #bdbdbd;
  box-shadow: inset 0 1px 0 #8f8f8f, inset 0 -1px 0 #ffffff80;
}

.mic-dropdown-separator {
  height: 2px;
  background: #8f8f8f;
  margin: 4px 0;
  border-top: 1px solid #ffffff80;
  border-bottom: 1px solid #373737;
}

.noise-supp-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.noise-supp-toggle:hover {
  background: #dfdfdf !important;
}

.noise-supp-toggle:active {
  background: #bdbdbd !important;
  box-shadow: inset 0 1px 0 #8f8f8f, inset 0 -1px 0 #ffffff80;
}

.ns-status {
  font-weight: bold;
  color: #666;
  padding: 2px 6px;
  border: 1px solid #8f8f8f;
  background: #f0f0f0;
  min-width: 28px;
  text-align: center;
  box-shadow: inset 0 1px 0 #ffffff80, inset 0 -1px 0 #8f8f8f;
}

.ns-status.active {
  color: #ffffff;
  background: #00aa00;
  border-color: #008800;
  text-shadow: 1px 1px 0 #006600;
  box-shadow: inset 0 1px 0 #00cc00, inset 0 -1px 0 #008800, 0 0 4px rgba(0, 170, 0, 0.5);
}

/* Settings Button Wrapper */
.settings-btn-wrapper {
  position: relative;
}

.settings-btn.active {
  background: #607d8b;
}

/* Settings Dropdown */
.settings-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  background: #c6c6c6;
  border: 3px solid #999;
  box-shadow: 4px 4px 0 #373737, inset 2px 2px 0 #ffffff80;
  min-width: 240px;
  max-width: 300px;
  z-index: 1000;
}

.settings-section {
  padding: 8px 0;
  border-bottom: 2px solid #999;
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-header {
  padding: 4px 12px 8px;
  font-weight: bold;
  color: #333;
  font-size: 12px;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 #ffffff80;
}

.settings-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.1s;
  gap: 8px;
}

.settings-item:hover {
  background: #d4d4d4;
}

.settings-item.selected {
  background: #4a90d9;
  color: white;
}

.settings-item.selected:hover {
  background: #5a9de9;
}

.settings-item .item-icon {
  font-size: 10px;
  width: 12px;
  text-align: center;
}

.settings-item .item-label {
  flex: 1;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-item.toggle-item {
  justify-content: space-between;
}

.toggle-switch {
  padding: 2px 8px;
  border: 1px solid #8f8f8f;
  background: #f0f0f0;
  font-size: 11px;
  font-weight: bold;
  min-width: 32px;
  text-align: center;
}

.toggle-switch.on {
  background: #00aa00;
  color: white;
  border-color: #008800;
}

/* ============================================================================
   MOBILE BACKGROUND BANNER
   Shows on mobile when voice chat connects to confirm background mode is active
   ============================================================================ */

.mobile-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

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

.mobile-banner-content {
  background: #c6c6c6;
  border: 4px solid #999;
  box-shadow: 6px 6px 0 #373737, inset 2px 2px 0 #ffffff80;
  padding: 24px;
  max-width: 320px;
  width: 100%;
  text-align: center;
}

.mobile-banner-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(to bottom, #4caf50, #388e3c);
  border: 3px solid #2e7d32;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.3);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 0 0 0 rgba(76, 175, 80, 0.4); }
  50% { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 0 0 12px rgba(76, 175, 80, 0); }
}

.mobile-banner-icon svg {
  width: 32px;
  height: 32px;
  color: white;
}

.mobile-banner-text {
  margin-bottom: 20px;
}

.mobile-banner-text strong {
  display: block;
  font-family: 'Minecraft', 'Courier New', monospace;
  font-size: 16px;
  color: #000;
  text-shadow: 1px 1px 0 #ffffff80;
  margin-bottom: 8px;
}

.mobile-banner-text span {
  display: block;
  font-family: 'Minecraft', 'Courier New', monospace;
  font-size: 12px;
  color: #444;
  line-height: 1.5;
}

.mobile-banner-close {
  background: linear-gradient(to bottom, #4caf50, #388e3c);
  border: 3px solid #2e7d32;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 0 #1b5e20, 2px 2px 4px rgba(0, 0, 0, 0.3);
  color: #fff;
  padding: 12px 32px;
  font-family: 'Minecraft', 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: 1px 1px 0 #1b5e20;
}

.mobile-banner-close:hover {
  background: linear-gradient(to bottom, #66bb6a, #43a047);
  transform: translateY(-1px);
}

.mobile-banner-close:active {
  background: linear-gradient(to bottom, #388e3c, #2e7d32);
  transform: translateY(1px);
  box-shadow: inset 0 2px 0 #1b5e20, inset 0 -2px 0 rgba(255, 255, 255, 0.3), 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* PiP Button */
.pip-toggle-btn .pip-icon {
  width: 20px;
  height: 20px;
}

.pip-toggle-btn.active {
  background: linear-gradient(to bottom, #4caf50, #388e3c);
  border-color: #2e7d32;
}

/* ============================================================================
   BACKGROUND MODE INDICATOR (Mobile only)
   Small persistent indicator showing background mode is active
   ============================================================================ */

.background-indicator {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #4caf50;
  border-radius: 20px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9998;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.background-indicator-dot {
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.background-indicator span {
  font-family: 'Minecraft', 'Courier New', monospace;
  font-size: 10px;
  color: #4caf50;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================================
   MOBILE WARNING - Honest truth about iOS/mobile limitations
   ============================================================================ */

.mobile-warning-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.mobile-warning-box {
  background: #c6c6c6;
  border: 4px solid #999;
  box-shadow: 6px 6px 0 #373737, inset 2px 2px 0 #ffffff80;
  padding: 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
}

.mobile-warning-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: #f59e0b;
}

.mobile-warning-icon svg {
  width: 100%;
  height: 100%;
}

.mobile-warning-title {
  font-family: 'Minecraft', 'Courier New', monospace;
  font-size: 16px;
  font-weight: bold;
  color: #000;
  margin-bottom: 12px;
  text-shadow: 1px 1px 0 #ffffff80;
}

.mobile-warning-text {
  font-family: 'Minecraft', 'Courier New', monospace;
  font-size: 11px;
  color: #333;
  line-height: 1.6;
  margin-bottom: 20px;
  text-align: left;
}

.mobile-warning-text p {
  margin-bottom: 8px;
}

.mobile-warning-text strong {
  color: #000;
}

.mobile-warning-button {
  background: linear-gradient(to bottom, #4caf50, #388e3c);
  border: 3px solid #2e7d32;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 0 #1b5e20, 2px 2px 4px rgba(0, 0, 0, 0.3);
  color: #fff;
  padding: 12px 24px;
  font-family: 'Minecraft', 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  text-shadow: 1px 1px 0 #1b5e20;
  width: 100%;
}

.mobile-warning-button:hover {
  background: linear-gradient(to bottom, #66bb6a, #43a047);
}

.mobile-warning-button:active {
  background: linear-gradient(to bottom, #388e3c, #2e7d32);
  transform: translateY(1px);
}

/* Reconnecting indicator */
.reconnecting-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  border: 3px solid #f59e0b;
  border-radius: 8px;
  padding: 20px 30px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
}

.reconnecting-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #f59e0b;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.reconnecting-indicator span {
  font-family: 'Minecraft', 'Courier New', monospace;
  font-size: 14px;
  color: #f59e0b;
}
