/**
 * Component Styles
 */

/* === Lobby Screen === */
.lobby-header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.game-code-display {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--color-surface);
  border-radius: var(--radius-md);
}

.game-code-display .label {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  display: block;
  margin-bottom: var(--spacing-xs);
}

.game-code {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  letter-spacing: 0.5rem;
  color: var(--color-primary);
}

.btn-copy-invite {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--spacing-xs) var(--spacing-sm);
  margin-left: var(--spacing-sm);
  opacity: 0.7;
  transition: all 0.2s;
}

.btn-copy-invite:hover {
  opacity: 1;
  transform: scale(1.1);
}

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

.player-count {
  text-align: center;
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  color: var(--color-text-secondary);
}

.player-list {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  max-height: 300px;
  overflow-y: auto;
}

.player-item {
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.player-item:last-child {
  margin-bottom: 0;
}

.player-item .icon {
  font-size: var(--font-size-xl);
}

.player-item .name {
  flex: 1;
  font-weight: 500;
}

.player-item.dead {
  opacity: 0.5;
}

.player-item.dead .icon::after {
  content: " ☠️";
}

.lobby-actions {
  margin-top: var(--spacing-lg);
}

/* === Game Screen === */
.game-container {
  max-width: 500px;
  margin: 0 auto;
}

.role-section {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.role-card {
  flex: 1;
  background: var(--color-surface);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.role-label {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-xs);
}

.role-name {
  display: block;
  font-size: var(--font-size-xl);
  font-weight: 700;
  text-transform: uppercase;
}

.role-name.crew {
  color: var(--color-secondary);
}

.role-name.impostor {
  color: var(--color-secondary); /* Same as crew for camouflage */
}

.btn-death-cross {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--color-error);
  background: rgba(255, 71, 87, 0.2);
  font-size: var(--font-size-2xl);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-death-cross:hover {
  background: rgba(255, 71, 87, 0.3);
  transform: scale(1.05);
}

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

.btn-death-cross.activated {
  background: var(--color-error);
  border-color: var(--color-error);
}

/* === Progress Bar === */
.progress-section {
  margin-bottom: var(--spacing-md);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--spacing-xs);
  font-weight: 600;
}

.progress-bar {
  height: 30px;
  background: var(--color-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success), #00cc66);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* === Task List === */
.task-section {
  margin-bottom: var(--spacing-lg);
}

.task-section h3 {
  margin-bottom: var(--spacing-sm);
}

.task-list {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm);
  max-height: 300px;
  overflow-y: auto;
}

.task-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.task-item:last-child {
  margin-bottom: 0;
}

.task-item:hover:not(.completed):not(.disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.task-item.completed {
  opacity: 0.6;
}

.task-item.disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.task-checkbox {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-text-secondary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.task-item.completed .task-checkbox {
  background: var(--color-success);
  border-color: var(--color-success);
}

.task-item.completed .task-checkbox::after {
  content: "✓";
  color: var(--color-background);
  font-weight: 700;
}

.task-description {
  flex: 1;
}

/* === Emergency Button === */
.emergency-section {
  margin-top: var(--spacing-lg);
}

.btn-emergency {
  width: 100%;
  padding: var(--spacing-lg);
  font-size: var(--font-size-xl);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-error), #c0392b);
  color: var(--color-text);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.2s ease;
  animation: pulse-emergency 2s infinite;
}

.btn-emergency:hover:not(:disabled) {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(255, 71, 87, 0.5);
}

.btn-emergency:active {
  transform: scale(0.98);
}

.btn-emergency:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
}

@keyframes pulse-emergency {
  0%, 100% {
    box-shadow: 0 8px 16px rgba(255, 71, 87, 0.4);
  }
  50% {
    box-shadow: 0 8px 24px rgba(255, 71, 87, 0.6);
  }
}

/* === Continue Button (After Meeting) === */
.btn-continue {
  width: 100%;
  padding: var(--spacing-lg);
  font-size: var(--font-size-xl);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-success), #00cc66);
  color: var(--color-background);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.2s ease;
  animation: pulse-continue 2s infinite;
}

.btn-continue:hover:not(:disabled) {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 255, 136, 0.5);
}

.btn-continue:active {
  transform: scale(0.98);
}

.btn-continue:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
}

@keyframes pulse-continue {
  0%, 100% {
    box-shadow: 0 8px 16px rgba(0, 255, 136, 0.4);
  }
  50% {
    box-shadow: 0 8px 24px rgba(0, 255, 136, 0.6);
  }
}

/* === Win Screen === */
.win-container {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.win-animation {
  margin-bottom: var(--spacing-lg);
}

.win-title {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--spacing-md);
  animation: fadeInScale 0.5s ease;
}

.win-title.crew-win {
  color: var(--color-secondary);
}

.win-title.impostor-win {
  color: var(--color-primary);
}

.win-reason {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-xl);
}

/* === Leave Game Button === */
.leave-game-section {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-leave-game {
  width: 100%;
  padding: var(--spacing-md);
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-leave-game:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-leave-game:active {
  transform: scale(0.98);
}

/* === Emergency Meeting Overlay === */
.emergency-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: emergencyFadeIn 0.3s ease-out;
}

.emergency-overlay.hidden {
  display: none;
}

.emergency-content {
  text-align: center;
  animation: emergencyPulse 2s ease-in-out infinite;
}

.emergency-icon {
  font-size: 120px;
  margin-bottom: var(--spacing-lg);
  animation: emergencySpin 2s linear infinite;
}

.emergency-title {
  font-size: 3rem;
  font-weight: 900;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: var(--spacing-md);
  text-shadow:
    0 0 20px var(--color-primary),
    0 0 40px var(--color-primary),
    0 0 60px var(--color-primary);
  animation: emergencyFlash 1s ease-in-out infinite;
}

.emergency-caller {
  font-size: var(--font-size-xl);
  color: var(--color-text);
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
}

.emergency-instruction {
  font-size: var(--font-size-lg);
  color: var(--color-warning);
  font-weight: 600;
  animation: emergencyBounce 1s ease-in-out infinite;
}

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

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

@keyframes emergencySpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes emergencyFlash {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

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

/* === Responsive === */
@media (max-width: 375px) {
  :root {
    --font-size-3xl: 2.5rem;
    --font-size-2xl: 1.75rem;
  }

  .game-code {
    font-size: var(--font-size-2xl);
  }
}

/* === Task Selection Screen === */
.task-selection-section {
  margin-bottom: var(--spacing-xl);
}

.task-selection-section h3 {
  margin-bottom: var(--spacing-md);
  color: var(--color-text);
  font-size: var(--font-size-lg);
}

.template-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  background: var(--color-surface);
  margin-bottom: var(--spacing-md);
}

.template-item {
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  background: white;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.2s;
}

.template-item:hover {
  background: #f5f5f5;
}

.template-item label {
  display: flex;
  align-items: center;
  flex: 1;
  cursor: pointer;
  margin: 0;
}

.template-item input[type="checkbox"] {
  margin-right: var(--spacing-md);
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.template-item.custom {
  border-left: 3px solid var(--color-primary);
}

.template-item span {
  color: #1a1a1a;
  font-size: var(--font-size-base);
}

.no-tasks-hint {
  color: #666;
  font-style: italic;
  padding: var(--spacing-md);
  text-align: center;
}

.btn-delete-task {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #dc3545;
  opacity: 0.6;
  transition: opacity 0.2s;
  padding: var(--spacing-xs);
}

.btn-delete-task:hover {
  opacity: 1;
  color: #c82333;
}

.btn-small {
  font-size: var(--font-size-sm);
  padding: var(--spacing-sm) var(--spacing-md);
}

.task-count-summary {
  text-align: center;
  padding: var(--spacing-lg);
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-md);
  margin: var(--spacing-lg) 0;
  font-weight: 600;
  font-size: var(--font-size-lg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.task-recommendation {
  margin-top: var(--spacing-sm);
  font-size: var(--font-size-md);
  font-weight: 400;
  opacity: 0.9;
}

.action-buttons {
  display: flex;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
}

.action-buttons button {
  flex: 1;
}

.no-tasks {
  text-align: center;
  color: var(--color-text-secondary);
  padding: var(--spacing-xl);
  font-style: italic;
}

/* === Modal === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  background: white;
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 90%;
  z-index: 1001;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: var(--spacing-lg);
  color: var(--color-text);
}

.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
  font-weight: 600;
}

.form-input {
  width: 100%;
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-hint {
  display: block;
  margin-top: var(--spacing-xs);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.modal-actions {
  display: flex;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
}

.modal-actions button {
  flex: 1;
}
