/* Chat styles for Roulette (based on blackjack chat) */

/* Mobile chat toggle and overlay */
.roulette-chat-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--black);
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}

/* Hide chat toggle on desktop since chat is always visible */
@media (min-width: 769px) {
  .roulette-chat-toggle {
    display: none;
  }
}

.roulette-chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.roulette-chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4444;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  animation: badgePulse 2s infinite;
}

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

.roulette-chat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  display: none;
  transition: opacity 0.3s ease;
}

.roulette-chat-overlay.open {
  display: block;
}

/* Desktop left sidebar; stacked on mobile */
@media (min-width: 769px) {
  #chat-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 32vw;
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.95);
    border-right: 2px solid #333;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 1000;
    overflow: hidden;
  }
  
  #game-container {
    margin-left: 300px;
  }
}

/* HD Screen chat adjustments (769px - 1400px) */
@media (min-width: 769px) and (max-width: 1400px) {
  #chat-panel {
    width: 18vw;
    max-width: 250px;
    min-width: 200px;
  }
  
  #game-container {
    margin-left: 18vw;
    max-margin-left: 250px;
  }
  
  /* Reduce chat content padding for HD screens */
  .chat-header {
    padding: 10px 15px;
  }
  
  .leaderboard-section {
    padding: 10px 15px;
    margin-bottom: 15px;
  }
  
  .previous-results {
    padding: 10px 15px;
    margin-bottom: 15px;
  }
  
  .leaderboard-section h3,
  .previous-results h3 {
    font-size: 1rem;
    margin-bottom: 8px;
  }
  
  .leaderboard-list,
  .previous-list {
    font-size: 0.9rem;
  }
}

/* Narrow HD screens (769px - 1200px) - Extra compact chat */
@media (min-width: 769px) and (max-width: 1200px) {
  #chat-panel {
    width: 16vw;
    max-width: 220px;
    min-width: 180px;
  }
  
  #game-container {
    margin-left: 16vw;
    max-margin-left: 220px;
  }
  
  .chat-header {
    padding: 8px 12px;
  }
  
  .leaderboard-section {
    padding: 8px 12px;
    margin-bottom: 12px;
  }
  
  .previous-results {
    padding: 8px 12px;
    margin-bottom: 12px;
  }
  
  .leaderboard-section h3,
  .previous-results h3 {
    font-size: 0.9rem;
    margin-bottom: 6px;
  }
  
  .leaderboard-list,
  .previous-list {
    font-size: 0.8rem;
  }
  
  .leaderboard-list li,
  .previous-list li {
    padding: 4px 6px;
    margin-bottom: 2px;
  }
}

@media (min-width: 1200px) {
  #chat-panel {
    width: 340px;
  }
  
  #game-container {
    margin-left: 340px;
  }
}

@media (max-width: 768px) {
  #chat-panel {
    position: static;
    width: 100%;
    height: auto;
    z-index: auto;
  }
  
  #game-container {
    margin-left: 0;
  }
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid #333;
  background: rgba(0,0,0,0.8);
}

.chat-header h3 {
  color: var(--gold);
  font-size: 1.2rem;
  margin: 0;
}

.chat-close-btn {
  background: none;
  border: none;
  color: var(--gold);
  padding: 8px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-close-btn:hover:not(:disabled) {
  background: rgba(255, 215, 0, 0.2);
  color: #ffd700;
  transform: scale(1.1);
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  list-style: none;
  margin: 0;
}

#chat-messages li {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}

#chat-messages li.system {
  background: rgba(33, 150, 243, 0.2);
  color: #81d4fa;
  border-left: 3px solid #2196F3;
}

#chat-messages li.player {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

#chat-messages li.game {
  background: rgba(255, 215, 0, 0.2);
  color: var(--gold);
  border-left: 3px solid var(--gold);
  font-weight: bold;
}

#chat-messages li.admin {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
  border-left: 3px solid #ff6b6b;
  font-weight: bold;
}

#chat-form {
  display: flex;
  padding: 15px;
  border-top: 1px solid #333;
  background: rgba(0,0,0,0.8);
  gap: 10px;
}

#chat-input {
  flex: 1;
  padding: 10px;
  border: 1px solid #555;
  border-radius: 5px;
  background: #333;
  color: #fff;
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

#chat-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

#chat-form button {
  padding: 6px 12px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  min-width: 60px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  user-select: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  background: var(--gold);
  color: var(--black);
  margin-left: 10px;
}

#chat-form button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
  background: #ffd700;
}

#chat-form button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#chat-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

/* Mobile chat styles */
@media (max-width: 768px) {
  #chat-panel {
    width: 100%;
    right: -100%;
  }
  
  .roulette-chat-toggle {
    bottom: 80px;
    left: 20px;
  }
  
  .chat-header {
    padding: 12px;
  }
  
  .chat-header h3 {
    font-size: 1.1rem;
  }
  
  #chat-messages {
    padding: 12px;
  }
  
  #chat-messages li {
    font-size: 0.85rem;
    padding: 6px 10px;
  }
  
  #chat-form {
    padding: 12px;
    gap: 8px;
  }
  
  #chat-input {
    font-size: 0.85rem;
    padding: 8px;
  }
  
  #chat-form button {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .roulette-chat-toggle {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    bottom: 70px;
    left: 15px;
  }
  
  .roulette-chat-badge {
    width: 18px;
    height: 18px;
    font-size: 0.6rem;
  }
  
  .chat-header {
    padding: 10px;
  }
  
  .chat-header h3 {
    font-size: 1rem;
  }
  
  #chat-messages {
    padding: 10px;
  }
  
  #chat-messages li {
    font-size: 0.8rem;
    padding: 5px 8px;
  }
  
  #chat-form {
    padding: 10px;
    gap: 6px;
  }
  
  #chat-input {
    font-size: 0.8rem;
    padding: 6px;
  }
  
  #chat-form button {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
}

/* Scrollbar styling for chat */
#chat-messages::-webkit-scrollbar {
  width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
  background: #333;
  border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
  background: #b8941f;
}

/* Chat animations */
.chat-message-enter {
  opacity: 0;
  transform: translateY(10px);
  animation: chatMessageEnter 0.3s ease forwards;
}

@keyframes chatMessageEnter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chat typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  color: #999;
  font-style: italic;
  font-size: 0.8rem;
}

.typing-dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 5px;
}

.typing-dots span {
  width: 4px;
  height: 4px;
  background: #999;
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
