/* ============================================
   HOLDEM GAME - SPECIFIC STYLES
   Common styles are in ../css/common.css
   ============================================ */

/* Holdem-specific CSS Variables */
:root {
  --table-felt: #1a472a;
  --table-border: #8b5a2b;
}

body.theme-light {
  --table-felt: #1a472a;
  --table-border: #8b5a2b;
}

/* ============================================
   GAME HEADER (Holdem-specific)
   ============================================ */

.game-header {
  max-width: 700px;
}

/* ============================================
   PLAYER CARD (Holdem-specific with chips)
   Royal Velvet Style - 검은 배경 + 금색 테두리
   ============================================ */

.player-card {
  min-width: 180px;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(135deg, rgba(20, 10, 30, 0.95) 0%, rgba(10, 5, 15, 0.98) 100%);
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.player-card .player-row-1 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-card .player-row-2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player-card .player-avatar {
  font-size: 24px;
}

.player-card .name {
  color: #fff;
}

.player-card .fo {
  font-size: 13px;
  color: #ffd700;
  font-weight: bold;
}

/* Pot Display - Royal Velvet Style */
.pot-display {
  background: linear-gradient(135deg, rgba(20, 10, 30, 0.95) 0%, rgba(10, 5, 15, 0.98) 100%);
  padding: 12px 25px;
  border-radius: 20px;
  border: 2px solid rgba(255, 215, 0, 0.5);
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.pot-display .pot-label {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pot-display .pot-amount {
  display: block;
  font-size: 24px;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

/* ============================================
   POKER TABLE
   ============================================ */

.table-container {
  position: relative;
  width: 100%;
  max-width: 700px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Royal Velvet Style - Purple/Gold Premium Table (0.95 scale) */
.poker-table {
  position: relative;
  background: radial-gradient(ellipse 100% 80% at 50% 30%, #4a1259 0%, #2d0a36 40%, #1a0520 70%, #0d0210 100%);
  border-radius: 133px;
  padding: 33px 52px;
  min-height: 314px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  box-shadow:
    inset 0 0 60px rgba(138, 43, 226, 0.25),
    inset 0 0 100px rgba(0, 0, 0, 0.5),
    0 8px 20px rgba(0, 0, 0, 0.6);
}

/* Gold border - 3D effect */
.poker-table::before {
  content: '';
  position: absolute;
  top: -12px; left: -12px; right: -12px; bottom: -12px;
  background: linear-gradient(180deg,
    #ffd700 0%,
    #daa520 8%,
    #b8860b 20%,
    #8b6914 50%,
    #6b4f0f 80%,
    #4a370a 100%);
  border-radius: 145px;
  z-index: -1;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.4),
    inset 0 -2px 4px rgba(0, 0, 0, 0.5),
    0 4px 0 #3d2d08,
    0 6px 0 #2a1f05,
    0 8px 15px rgba(0, 0, 0, 0.6),
    0 15px 40px rgba(0, 0, 0, 0.5);
}

/* Inner gold line */
.poker-table::after {
  content: '';
  position: absolute;
  top: 8px; left: 8px; right: 8px; bottom: 8px;
  border: 2px solid rgba(255, 215, 0, 0.15);
  border-radius: 125px;
  pointer-events: none;
  box-shadow: inset 0 0 30px rgba(255, 215, 0, 0.05);
}

/* Opponent Cards (Top) */
.opponent-cards {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Community Cards (Center) */
.community-cards {
  display: flex;
  gap: 8px;
  justify-content: center;
  min-height: 100px;
  align-items: center;
}

/* My Cards (Bottom) */
.my-cards {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ============================================
   PLAYING CARDS - SVG Image Based
   ============================================ */

.card {
  width: 100px;
  height: 145px;  /* CC0 카드 비율 334:486 ≈ 100:145 */
  border-radius: 8px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 4px 8px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  background: transparent;
  flex-shrink: 0;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.3),
    0 16px 32px rgba(0, 0, 0, 0.2);
}

.card img {
  width: 100%;
  height: 100%;
  display: block;
}

.card-back {
  /* CC0 카드 뒷면 이미지 사용 */
  background: transparent;
}

.card-back img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

/* Current Bets Display - Royal Velvet Style */
.current-bet {
  position: absolute;
  background: linear-gradient(135deg, rgba(20, 10, 30, 0.95) 0%, rgba(10, 5, 15, 0.98) 100%);
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid rgba(255, 215, 0, 0.5);
  font-size: 14px;
  font-weight: bold;
  color: #ffd700;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

.opponent-bet {
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
}

.my-bet {
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
}

/* Waiting Overlay (Holdem-specific border-radius) */
.waiting-overlay {
  border-radius: 150px;
}

.waiting-overlay h3 {
  font-size: 20px;
}

/* ============================================
   ACTION BUTTONS
   ============================================ */

.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-fold {
  background: #6b7280;
  color: white;
}

.btn-fold:hover {
  background: #4b5563;
}

.btn-check {
  background: #3b82f6;
  color: white;
}

.btn-check:hover {
  background: #2563eb;
}

.btn-call {
  background: var(--success);
  color: white;
}

.btn-call:hover {
  background: #22c55e;
}

.btn-raise {
  background: var(--warning);
  color: #1a1a2e;
}

.btn-raise:hover {
  background: #f59e0b;
}

.btn-allin {
  background: linear-gradient(135deg, var(--accent) 0%, #dc2626 100%);
  color: white;
}

.btn-allin:hover {
  background: linear-gradient(135deg, #dc2626 0%, var(--accent) 100%);
}

/* ============================================
   RAISE SLIDER
   ============================================ */

.raise-slider-container {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 10px;
  width: 100%;
  max-width: 400px;
}

.raise-slider-container input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-secondary);
  outline: none;
  -webkit-appearance: none;
}

.raise-slider-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.raise-amount-display {
  text-align: center;
  margin: 15px 0;
  font-size: 18px;
}

.raise-amount-display #raise-amount-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--warning);
}

.raise-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 15px;
}

.raise-confirm-buttons {
  display: flex;
  gap: 10px;
}

/* ============================================
   HAND HISTORY
   ============================================ */

.hand-history {
  flex: 1;
  padding: 10px;
  min-height: 0;
}

.hand-history-header {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.hand-history-list {
  font-size: 12px;
  color: var(--text-secondary);
  overflow-y: auto;
  max-height: 150px;
}

.hand-history-item {
  padding: 5px 0;
  border-bottom: 1px solid var(--bg-card);
}

/* ============================================
   HAND RANKINGS MINI (Sidebar)
   ============================================ */

.hand-rankings-mini {
  font-size: 12px;
  color: var(--text-secondary);
}

.hand-rankings-mini .rank-item {
  padding: 4px 0;
  border-bottom: 1px solid var(--bg-secondary);
}

.hand-rankings-mini .rank-item:last-child {
  border-bottom: none;
}

/* ============================================
   HAND RESULT MODAL
   ============================================ */

.hand-result-content {
  text-align: center;
}

.showdown-cards {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
}

.winner-hand {
  font-size: 20px;
  color: var(--success);
  margin-bottom: 10px;
}

.pot-won {
  font-size: 18px;
  color: var(--warning);
}


/* ============================================
   GAME OVER (Holdem-specific - final chips)
   ============================================ */

.game-over-content .final-fo {
  font-size: 18px;
  color: var(--warning);
  margin-bottom: 10px;
}

/* ============================================
   RESPONSIVE - Holdem-specific
   ============================================ */

@media (max-width: 900px) {
  .poker-table {
    padding: 27px 36px;
    min-height: 252px;
    border-radius: 105px;
  }

  .poker-table::before {
    border-radius: 117px;
  }

  .poker-table::after {
    border-radius: 95px;
  }

  .card {
    width: 79px;
    height: 115px;
    border-radius: 6px;
  }
  .card-back img {
    border-radius: 6px;
  }
}

@media (max-width: 600px) {
  .game-header {
    max-width: 100%;
    gap: 6px;
  }

  .player-card {
    padding: 6px 10px;
    min-width: 0;
    flex: 1;
  }

  .player-card .name {
    font-size: 12px;
  }

  .player-card .timer {
    font-size: 14px;
  }

  .pot-display {
    padding: 8px 15px;
  }

  .pot-display .pot-amount {
    font-size: 18px;
  }

  /* Mobile Poker Table (0.95 scale) */
  .poker-table {
    padding: 17px 21px;
    min-height: 190px;
    border-radius: 86px;
  }

  .poker-table::before {
    border-radius: 98px;
  }

  .poker-table::after {
    border-radius: 78px;
  }

  .card {
    width: 65px;
    height: 94px;
    border-radius: 5px;
  }
  .card-back img {
    border-radius: 5px;
  }

  .community-cards {
    min-height: 70px;
    gap: 5px;
  }

  .opponent-cards,
  .my-cards {
    gap: 5px;
  }

  .current-bet {
    font-size: 12px;
    padding: 3px 8px;
  }

  .opponent-bet {
    top: 50px;
  }

  .my-bet {
    bottom: 50px;
  }

  /* Action buttons */
  .action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    width: 100%;
    max-width: 360px;
  }

  .action-buttons .btn {
    padding: 10px 8px;
    font-size: 12px;
  }

  .btn-allin {
    grid-column: span 3;
  }

  /* Raise slider */
  .raise-slider-container {
    padding: 15px;
  }

  .raise-buttons {
    flex-wrap: wrap;
  }
}

@media (max-width: 380px) {
  .poker-table {
    padding: 13px 17px;
    min-height: 162px;
    border-radius: 67px;
  }

  .poker-table::before {
    border-radius: 79px;
  }

  .poker-table::after {
    border-radius: 59px;
  }

  .card {
    width: 55px;
    height: 80px;
    border-radius: 4px;
  }
  .card-back img {
    border-radius: 4px;
  }

  .action-buttons .btn {
    padding: 8px 5px;
    font-size: 11px;
  }

  .player-card {
    padding: 4px 8px;
  }

  .player-card .name {
    font-size: 11px;
  }
}

/* ============================================
   SPECTATOR MODE STYLES
   ============================================ */

/* Room List - Live Game Styling */
.room-item.room-live {
  border: 2px solid #e74c3c;
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(192, 57, 43, 0.05));
  cursor: default;
}

.room-item.room-live:hover {
  transform: none;
  border-color: #c0392b;
}

.room-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-badge {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  animation: live-pulse 1.5s infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ============================================
   CHAT TABS & PARTICIPANT LIST
   ============================================ */

.chat-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}

.chat-tab {
  flex: 1;
  padding: 10px 15px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.chat-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.chat-tab.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  font-weight: 500;
}

.participant-count {
  background: var(--accent);
  color: white;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#chat-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#chat-content .chat-messages {
  flex: 1;
}

/* Participants List */
.participants-list {
  padding: 10px;
  overflow-y: auto;
  height: 100%;
}

.participant-section {
  margin-bottom: 15px;
}

.participant-section-header {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-color);
}

.participant-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.participant-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 13px;
}

.participant-item.player {
  border-left: 3px solid var(--accent);
}


.participant-item.host {
  border-left: 3px solid #f1c40f;
}

.participant-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.participant-info {
  flex: 1;
}

.participant-name {
  font-weight: 500;
  color: var(--text-primary);
}

.participant-role {
  font-size: 11px;
  color: var(--text-secondary);
}

.participant-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.participant-badge.host {
  background: #f1c40f;
  color: #000;
}

.participant-badge.black {
  background: #2c3e50;
  color: #fff;
}

.participant-badge.white {
  background: #ecf0f1;
  color: #2c3e50;
}

.empty-participants {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
  font-size: 13px;
}

/* ============================================
   820px 이하: 모바일 레이아웃 (테이블 100% 너비)
   ============================================ */
@media (max-width: 820px) {
  .table-container {
    width: 100%;
    max-width: 100%;
    padding: 0 6px;
    box-sizing: border-box;
  }

  .poker-table {
    width: 100%;
    min-height: 181px;
    padding: 17px 27px;
    border-radius: 86px;
  }

  .poker-table::before {
    border-radius: 98px;
  }

  .poker-table::after {
    border-radius: 78px;
  }

  .card {
    width: clamp(55px, 16vw, 79px);
    height: clamp(80px, 23vw, 115px);
    border-radius: clamp(4px, 1vw, 6px);
  }
  .card-back img {
    border-radius: clamp(4px, 1vw, 6px);
  }

  .action-buttons {
    width: 100%;
    max-width: 100%;
    padding: 0 6px;
  }
}

/* ============================================
   RECONNECT OVERLAY
   ============================================ */

#reconnect-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

#reconnect-overlay.active {
  display: flex;
}

.reconnect-content {
  text-align: center;
  color: white;
  padding: 30px;
  background: rgba(50, 50, 50, 0.9);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.reconnect-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #6c5ce7;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.reconnect-text {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
}

.reconnect-attempt {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 15px;
}

.reconnect-refresh {
  display: none;
  padding: 12px 24px;
  font-size: 16px;
  background: #6c5ce7;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.reconnect-refresh:hover {
  background: #5b4cdb;
}

/* ============================================
   TUTORIAL MODAL
   ============================================ */

.modal-tutorial {
  max-width: 800px;
  width: 95%;
}

.tutorial-wrapper {
  display: flex;
  gap: 25px;
  margin: 20px 0;
}

.tutorial-visual {
  flex: 0 0 auto;
}

#tutorial-canvas {
  background: linear-gradient(135deg, #1a472a 0%, #0d2818 100%);
  border-radius: 12px;
  border: 3px solid #8b5a2b;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.3);
}

.tutorial-caption {
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
}

.tutorial-text {
  flex: 1;
  min-width: 0;
}

.tutorial-text h3 {
  margin: 0 0 15px 0;
  color: var(--warning);
  font-size: 20px;
}

.tutorial-text p {
  margin: 0;
  line-height: 1.7;
  color: var(--text-primary);
  font-size: 15px;
}

.tutorial-card-preview {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 15px;
  min-height: 80px;
  flex-wrap: wrap;
}

.tutorial-card-preview .preview-card {
  width: 55px;
  height: 80px;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.tutorial-card-preview .preview-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tutorial-card-preview .card-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.tutorial-card-preview .card-group-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.tutorial-card-preview .card-row {
  display: flex;
  gap: 6px;
}

.tutorial-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid var(--bg-secondary);
}

.tutorial-dots {
  display: flex;
  gap: 8px;
}

.tutorial-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.2s;
}

.tutorial-dot:hover {
  background: rgba(255, 255, 255, 0.5);
}

.tutorial-dot.active {
  background: var(--warning);
  transform: scale(1.2);
}

.tutorial-dot.completed {
  background: var(--success);
}

/* Responsive Tutorial */
@media (max-width: 700px) {
  .tutorial-wrapper {
    flex-direction: column;
  }

  .tutorial-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  #tutorial-canvas {
    width: 100%;
    max-width: 360px;
    height: auto;
    aspect-ratio: 380 / 260;
  }

  .tutorial-text h3 {
    font-size: 18px;
    text-align: center;
  }

  .tutorial-text p {
    font-size: 14px;
  }
}
