/* Gamepad Controller Styles */

/* Controller button hints - hidden by default */
.controller-hint {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  color: #666;
  margin-left: 10px;
}

/* Show controller hints only when controller is connected */
body.gamepad-connected .controller-hint {
  display: inline-flex;
}

/* Controller button badge */
.controller-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 4px;
  font-weight: bold;
  font-size: 0.85em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* PlayStation style buttons */
.controller-btn.ps {
  background: linear-gradient(135deg, #003791 0%, #0070d1 100%);
}

.controller-btn.ps.cross { background: #3b82f6; }
.controller-btn.ps.circle { background: #ef4444; }
.controller-btn.ps.square { background: #ec4899; }
.controller-btn.ps.triangle { background: #10b981; }

/* Xbox style buttons */
.controller-btn.xbox.a { background: #10b981; color: white; }
.controller-btn.xbox.b { background: #ef4444; color: white; }
.controller-btn.xbox.x { background: #3b82f6; color: white; }
.controller-btn.xbox.y { background: #eab308; color: #000; }

/* Gamepad focus indicator */
.gamepad-focused {
  outline: 3px solid #667eea !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2) !important;
}

button.gamepad-focused,
.answer-choice.gamepad-focused {
  transform: scale(1.05);
  transition: transform 0.2s ease;
}

/* Connection notification */
.gamepad-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10000;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.gamepad-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.gamepad-icon {
  font-size: 1.5em;
  animation: pulse 1s ease-in-out infinite;
}

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

/* Controller help modal */
.controller-help {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  z-index: 10001;
  max-width: 500px;
  width: 90%;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}

.controller-help.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: all;
}

.controller-help h3 {
  margin: 0 0 20px 0;
  font-size: 1.8em;
  color: #333;
  text-align: center;
}

.controller-buttons {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.controller-buttons > div {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
}

.btn-label {
  min-width: 100px;
  font-weight: bold;
  color: #667eea;
  background: white;
  padding: 6px 12px;
  border-radius: 4px;
  text-align: center;
}

.controller-help button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1em;
  cursor: pointer;
  transition: transform 0.2s;
}

.controller-help button:hover {
  transform: translateY(-2px);
}

/* Gamepad indicator in header */
.gamepad-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 6px;
  color: #667eea;
  font-size: 0.9em;
}

body.gamepad-connected .gamepad-indicator {
  display: inline-flex;
}

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

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

/* Answer choice button hints */
.answer-choice {
  position: relative;
}

.answer-choice .controller-hint {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .controller-help {
    width: 95%;
    padding: 20px;
  }

  .controller-hint {
    font-size: 0.8em;
  }

  .controller-btn {
    min-width: 20px;
    height: 20px;
    font-size: 0.75em;
  }
}

/* Dark theme support */
body.dark-theme .controller-help {
  background: #1e1e1e;
  color: #e0e0e0;
}

body.dark-theme .controller-help h3 {
  color: #fff;
}

body.dark-theme .controller-buttons > div {
  background: #2a2a2a;
}

body.dark-theme .btn-label {
  background: #333;
  color: #667eea;
}
