/* Components - Buttons, Cards, Inputs, Badges */

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  font-weight: bold;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-secondary {
  background: #764ba2;
  color: white;
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-action {
  width: 100%;
  margin-bottom: 10px;
  background: #51cf66;
  color: white;
  font-size: 14px;
  padding: 10px;
}

.btn-half {
  width: 49%;
  margin-bottom: 4px;
}

/* Turn Action Button States */
#turnActionBtn {
  position: relative;
  overflow: hidden;
  contain: paint;
  z-index: 0;
}

#turnActionBtn.turn-action-roll:not(:disabled) {
  color: #222;
}

#turnActionBtn.turn-action-roll:not(:disabled)::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: #ffeb3b;
  box-shadow: 0 0 10px #fff94d, 0 0 20px #ffd700, 0 0 30px #ffea00;
  animation: pulseYellow 2s infinite alternate;
  z-index: -1;
}

#turnActionBtn.turn-action-roll:not(:disabled)::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 45%;
  height: 100%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(-150%);
  animation: shineMove 2s linear infinite;
  will-change: transform;
  z-index: 1;
}

#turnActionBtn.turn-action-roll:not(:disabled):hover {
  transform: scale(1.08);
}

#turnActionBtn.turn-action-end:not(:disabled) {
  background: #ff4d4f;
  color: #fff;
  box-shadow: 0 0 15px rgba(255, 77, 79, 0.4);
}

#turnActionBtn.turn-action-end:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 77, 79, 0.35);
}

@keyframes pulseYellow {
  0% {
    background-color: #ffeb3b;
    box-shadow: 0 0 10px #fff94d, 0 0 20px #ffd700;
  }
  100% {
    background-color: #fff44f;
    box-shadow: 0 0 20px #fff176, 0 0 40px #ffee58;
  }
}

@keyframes shineMove {
  0% {
    transform: translateX(-150%);
  }
  100% {
    transform: translateX(200%);
  }
}

/* Input Fields */
input[type="text"],
input[type="number"] {
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s, background-color 0.3s;
}

input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: #667eea;
}

input[type="text"][readonly] {
  background-color: #f5f5f5;
  border-color: #ccc;
  cursor: not-allowed;
  color: #555;
}

input[type="text"][readonly]:focus {
  border-color: #ccc;
}

select {
  width: 100%;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}

select:focus {
  outline: none;
  border-color: #667eea;
}

/* Cards */
.menu-card {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  flex: 1;
}

.menu-card h2 {
  color: #667eea;
  font-size: 32px;
  margin-bottom: 20px;
  text-align: center;
  border-bottom: 3px solid #667eea;
  padding-bottom: 10px;
}

/* Player Color Indicators */
.player-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #333;
}

.color-indicator {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid #333;
  margin: 10px 0;
}

/* Badges */
.scoreboard-badge {
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  border: 1px solid #ddd;
  background: white;
  cursor: help;
}

.scoreboard-badge.longest-road {
  background: #e3f2ff;
  border-color: #74c0fc;
}

.scoreboard-badge.largest-army {
  background: #ffe3e3;
  border-color: #ffa8a8;
}

/* History Color Dots */
.history-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #333;
  flex-shrink: 0;
}

.history-color-small {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #333;
  flex-shrink: 0;
  display: inline-block;
  margin-right: 4px;
}

.toast-container {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  right: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  position: relative;
  min-width: 260px;
  max-width: 360px;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  background: rgba(33, 33, 33, 0.92);
  border-left: 4px solid rgba(255, 255, 255, 0.4);
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-hiding {
  opacity: 0 !important;
  transform: translateY(-10px) !important;
}

.toast-message {
  font-weight: 500;
}

.toast-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.toast-close:hover {
  opacity: 1;
}

.toast-actions {
  display: flex;
  gap: 0.5rem;
}

.toast-action {
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
}

.toast-action:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.toast-action:active {
  transform: translateY(0);
}

.toast-action-confirm {
  background: rgba(76, 175, 80, 0.25);
}

.toast-action-cancel {
  background: rgba(244, 67, 54, 0.25);
}

.toast-success {
  background: rgba(46, 125, 50, 0.9);
  border-left-color: #81c784;
}

.toast-error {
  background: rgba(198, 40, 40, 0.9);
  border-left-color: #ef9a9a;
}

.toast-warning {
  background: rgba(255, 160, 0, 0.9);
  border-left-color: #ffe082;
  color: #2d2411;
}

.toast-info {
  background: rgba(25, 118, 210, 0.9);
  border-left-color: #90caf9;
}

/* Game Settings */
.game-settings {
  margin: 20px 0;
  padding: 15px;
  background: rgba(102, 126, 234, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.settings-header {
  font-size: 16px;
  margin: 0 0 15px 0;
  color: #667eea;
  font-weight: 600;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.setting-row:last-child {
  margin-bottom: 0;
}

.setting-row label {
  font-size: 14px;
  color: #333;
  font-weight: 500;
  flex: 1;
}

.settings-select {
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #ddd;
  background: white;
  color: #333;
  font-size: 14px;
  cursor: pointer;
  width: 180px;
  text-align: left;
}

.settings-select:hover {
  border-color: #667eea;
}

.settings-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.settings-select option {
  background: white;
  color: #333;
}

.settings-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #667eea;
}

/* Lobby Settings Display */
.lobby-settings {
  margin: 15px 0;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lobby-settings h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #333;
}

.lobby-setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.lobby-setting:last-child {
  border-bottom: none;
}

.setting-label {
  font-size: 14px;
  color: #666;
}

.setting-value {
  font-size: 14px;
  color: #333;
  font-weight: 600;
}

/* Turn Timer */
.turn-timer {
  text-align: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  margin-bottom: 15px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: border-color 0.3s, background 0.3s;
  backdrop-filter: blur(5px);
}

.turn-timer.warning {
  border-color: #ff6b6b;
  background: rgba(255, 107, 107, 0.2);
}

.timer-label {
  font-size: 12px;
  color: #000000;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  font-weight: 600;
}

.timer-value {
  font-size: 28px;
  font-weight: bold;
  color: #ffffff;
  font-family: 'Courier New', monospace;
  transition: color 0.3s;
}

.turn-timer.warning .timer-label {
  color: #8b0000;
}

.turn-timer.warning .timer-value {
  color: #ff6b6b;
}

/* Authentication Components */
.auth-btn {
  width: 100%;
  margin-bottom: 10px;
  padding: 14px 24px;
  font-size: 16px;
}

.auth-description {
  text-align: center;
  margin-bottom: 20px;
  color: #666;
  font-size: 15px;
}

.auth-hint {
  text-align: center;
  margin: -5px 0 15px 0;
  font-size: 13px;
  color: #999;
}

.user-info-section {
  margin-bottom: 15px;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  color: white;
}

.user-info-section p {
  margin: 0;
}

.user-info-section button {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.user-info-section button:hover {
  background: rgba(255, 255, 255, 0.3);
}
