/* frontend/css/game.css */
/* Minimal styles for the game to work */

/* ===== GENERAL ===== */
.game-section, .test-game-section {
  max-width: 800px;
  margin: 0 auto 40px auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
}

.game-section-title, .test-game-title {
  text-align: center;
  margin-bottom: 20px;
}

.game-start, .test-game-start {
  text-align: center;
  margin: 20px 0;
}

/* ===== SHOW/HIDE ===== */
.screen-hidden { display: none !important; }
.screen-visible { display: block !important; }
.btn-hidden { display: none !important; }
.btn-visible { display: inline-block !important; }

/* ===== BUTTONS ===== */
.btn-game-start, .btn-test-start,
.btn-game-send, .btn-test-send,
.btn-game-secret, .btn-test-secret,
.btn-game-restart, .btn-test-restart {
  padding: 10px 20px;
  font-size: 16px;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin: 5px;
}

.btn-game-start, .btn-test-start,
.btn-game-send, .btn-test-send { background: #007bff; }

.btn-game-secret, .btn-test-secret { background: #FF8C00; }

.btn-game-restart, .btn-test-restart { background: #28a745; }

.btn-disabled {
  opacity: 0.5 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
}

/* ===== INFO ===== */
.game-info {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 4px;
  margin-bottom: 15px;
}

.info-label { font-weight: bold; }
.info-value { color: #007bff; font-weight: bold; }

/* ===== CHAT ===== */
.game-chat, .test-chat {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  height: 300px;
  overflow-y: auto;
  background: #fafafa;
  margin-bottom: 15px;
}

/* ===== MESSAGES ===== */
.message {
  padding: 10px;
  border-left: 3px solid #007bff;
  background: #fff;
  margin-bottom: 10px;
  border-radius: 4px;
}

.message.secret { border-left-color: #FF8C00; background: #fff8f0; }
.message.auto-message { border-left-color: #ffc107; background: #fffef0; }
.message.role-message { border-left-color: #28a745; background: #f0fff4; }
.message.round-end-message { border-left-color: #dc3545; background: #fff5f5; }
.message.winner-message { border-left-color: #28a745; background: #f0fff4; }
.message.winner-message.winner-a { border-left-color: #007bff; }
.message.winner-message.winner-b { border-left-color: #FF8C00; }
.message.alive-message { border-left-color: #17a2b8; background: #f0faff; }
.message.eliminated-message { border-left-color: #dc3545; background: #fff5f5; }
.message.final-message { border-left-color: #6c757d; background: #f8f9fa; }

.author { font-weight: bold; margin-bottom: 5px; }
.text { margin-bottom: 5px; }
.time { font-size: 12px; color: #6c757d; text-align: right; }

/* ===== PLAYER COLORS ===== */
.color-red { color: #E63946; }
.color-blue { color: #457B9D; }
.color-teal { color: #2A9D8F; }
.color-purple { color: #9D4EDD; }
.color-yellow { color: #E9C46A; }
.color-pink { color: #F72585; }
.color-cyan { color: #00B4D8; }
.color-brown { color: #8B4513; }
.color-navy { color: #1D3557; }

/* ===== INPUT ===== */
.game-input-row, .test-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.game-message-input, .test-message-input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.game-message-input:disabled, .test-message-input:disabled {
  background: #e9ecef;
  cursor: not-allowed;
}

/* ===== VOTING ===== */
.game-vote-panel, .test-vote-panel {
  display: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 15px;
  background: #f9f9f9;
}

.game-vote-panel.vote-active, .test-vote-panel.vote-active {
  display: block !important;
}

.game-vote-title, .test-vote-title {
  margin-top: 0;
  text-align: center;
}

.game-vote-players, .test-vote-players {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.vote-player {
  padding: 15px 20px;
  border: 2px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  min-width: 120px;
  background: white;
}

.vote-player:hover { border-color: #007bff; background: #f0f8ff; }
.vote-player.voted-target { border-color: #28a745; background: #d4edda; }
.vote-player.voted-other { opacity: 0.5; cursor: not-allowed; }

/* ===== RESTART ===== */
.game-restart, .test-restart {
  text-align: center;
  margin-top: 20px;
}

/* ===== TIMERS ===== */
#testTimerDisplay {
  padding: 10px;
  text-align: center;
  font-weight: bold;
  border-radius: 4px;
  margin-bottom: 15px;
}

.timer-discussion { background: #d4edda; color: #155724; }
.timer-voting { background: #fff3cd; color: #856404; }

/* ===== QUEUE ===== */
#gameQueueScreen, #testQueueScreen {
  text-align: center;
  padding: 20px;
  background: #f5f5f5;
  border-radius: 4px;
}

/* ===== SURVIVORS ===== */
.team-alive { margin: 10px 0; font-weight: bold; }
.player-alive { padding: 5px 10px; font-weight: bold; }
.eliminated-player { padding: 5px 10px; color: #dc3545; }

/* ===== PLAYER STATS ===== */
.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 5px;
}

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

.stat-total { color: #007bff; }
.stat-wins { color: #28a745; }
.stat-losses { color: #dc3545; }
.stat-winrate { color: #FF8C00; }

/* ===== GAME HISTORY ===== */
.game-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 8px;
}

.game-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 10px;
  transition: all 0.2s;
  cursor: pointer;
}

.game-history-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.history-win { border-color: #28a745 !important; }
.history-loss { border-color: #dc3545 !important; }
.history-draw { border-color: #6c757d !important; }
.history-public { border-color: #007bff !important; color: #007bff !important; }

.history-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.history-result {
  font-weight: bold;
  min-width: 100px;
}

.history-result.history-win { color: #28a745; }
.history-result.history-loss { color: #dc3545; }
.history-result.history-draw { color: #6c757d; }
.history-result.history-public { color: #007bff; }

.history-info { color: #666; }
.history-date { font-size: 12px; }
.history-right { text-align: right; color: #666; }
.history-rounds { font-weight: bold; }
.history-topic { font-size: 12px; }
.history-empty { text-align: center; padding: 20px; color: #666; }
.history-error { text-align: center; padding: 20px; color: #dc3545; }

/* ===== MODAL (GAME VIEW) ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
}

.modal-visible {
  display: flex !important;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: white;
  border-radius: 8px;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #ddd;
}

.modal-title {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.modal-close:hover {
  color: #000;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #ddd;
  text-align: center;
}

.btn-modal-close {
  padding: 10px 30px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
}

.btn-modal-close:hover {
  background: #5a6268;
}

/* GAME DETAILS */
.game-details-info {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.game-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.game-detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: bold;
  color: #666;
}

.detail-value {
  color: #000;
}

.details-section-title {
  margin: 20px 0 10px 0;
  font-size: 16px;
  color: #333;
}

.game-details-messages {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 15px;
  background: #fafafa;
  max-height: 400px;
  overflow-y: auto;
}

.round-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #ddd;
}

.round-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.round-title {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: #007bff;
}

.round-eliminated {
  padding: 8px;
  background: #fff5f5;
  border-left: 3px solid #dc3545;
  margin-bottom: 10px;
  font-size: 14px;
}

.round-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-item {
  padding: 8px 12px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

.message-item.message-secret {
  background: #fff8f0;
  border-color: #FF8C00;
}

.message-item.message-auto {
  background: #fffef0;
  border-color: #ffc107;
}

.message-team {
  font-weight: bold;
  color: #007bff;
  margin-right: 8px;
}

.message-author {
  font-weight: bold;
  margin-right: 8px;
}

.message-text {
  color: #333;
}

.message-badge {
  font-size: 11px;
  padding: 2px 6px;
  background: #eee;
  border-radius: 3px;
  margin-left: 8px;
}

.no-messages {
  text-align: center;
  color: #666;
  padding: 20px;
}

.modal-open {
  overflow: hidden;
}

/* ===== TOKENS AND BALANCES ===== */
.token-balances {
  margin-left: 20px;
  font-size: 0.9rem;
  color: var(--dark-text, #2D2D2D);
}

.token-balances span {
  font-weight: 600;
}

.btn-add-token {
  margin-left: 10px;
  padding: 4px 12px;
  font-size: 0.85rem;
  background-color: var(--beige, #f5f5dc);
  color: var(--dark-text, #2D2D2D);
  border: 1px solid var(--dark-text, #2D2D2D);
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-add-token:hover {
  opacity: 0.85;
}

.btn-add-token:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* ===== END TOKEN STYLES ===== */

/* ===== TOKENS AND BALANCES ===== */
.token-section {
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background: #f5f5dc;
  border-radius: 8px;
  text-align: center;
}

.token-display {
  margin-bottom: 10px;
  font-size: 1rem;
  color: #2D2D2D;
}

.token-display span {
  font-weight: 600;
}

.btn-add-token {
  padding: 8px 20px;
  font-size: 0.95rem;
  background-color: #2D2D2D;
  color: #f5f5dc;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-add-token:hover {
  opacity: 0.85;
}

.btn-add-token:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* ===== END TOKEN STYLES ===== */


/* ===== TOKENS AND BALANCES ===== */
.token-section {
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background: #f5f5dc;
  border-radius: 8px;
  text-align: center;
}

.token-display {
  margin-bottom: 10px;
  font-size: 1rem;
  color: #2D2D2D;
}

.token-display span {
  font-weight: 600;
}

.token-separator {
  margin: 0 10px;
  color: #999;
}

.btn-add-token {
  padding: 8px 20px;
  font-size: 0.95rem;
  background-color: #2D2D2D;
  color: #f5f5dc;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-add-token:hover {
  opacity: 0.85;
}

.btn-add-token:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* ===== END TOKEN STYLES ===== */

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 20px 0 10px 0;
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  font-size: 14px;
  transition: all 0.2s;
}
.pagination a:hover {
  border-color: #007bff;
  color: #007bff;
  background: #f0f8ff;
}
.pagination .current {
  background: #007bff;
  border-color: #007bff;
  color: white;
  font-weight: bold;
  cursor: default;
}
.pagination .disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.pagination .dots {
  border: none;
  color: #666;
  cursor: default;
}
/* ===== END PAGINATION ===== */

/* ===== Daily Topic Block ===== */
.daily-topic-block {
  margin: 15px 0;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}
.daily-topic-hidden {
  display: none !important;
}
.daily-topic-visible {
  display: block !important;
}
.daily-topic-header {
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}
.daily-topic-text {
  font-size: 1.1rem;
  margin-bottom: 6px;
  color: #222;
}
.daily-topic-teams {
  display: flex;
  gap: 12px;
  font-size: 0.95rem;
  flex-wrap: wrap;
}
.team-side {
  display: flex;
  align-items: center;
  gap: 4px;
}
.team-a {
  color: #0d6efd;
}
.team-b {
  color: #dc3545;
}
.btn-disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}
/* ===== End Daily Topic Block ===== */

/* ===== Topics Archive Page Styles ===== */

/* Section container */
.archive-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.archive-title {
  font-size: 1.8rem;
  font-weight: 600;
  text-align: center;
  margin: 0 0 0.5rem 0;
  color: var(--dark-text, #2d2d2d);
}

.archive-description {
  text-align: center;
  color: var(--dark-text, #666);
  margin: 0 0 2rem 0;
  font-size: 1rem;
}

/* Table container with scroll for mobile */
.topics-table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Table styles */
.topics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.topics-table thead {
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
}

.topics-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--dark-text, #333);
  white-space: nowrap;
}

.topics-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e9ecef;
  color: var(--dark-text, #444);
}

.topics-table tbody tr:hover {
  background: #f8f9fa;
}

/* Topic row variations */
.topic-row.active-topic {
  background: #e8f5e9 !important;
}

.topic-row.active-topic:hover {
  background: #c8e6c9 !important;
}

/* Column specific styles */
.topic-date {
  font-weight: 500;
  color: var(--dark-text, #555);
  min-width: 120px;
}

.topic-name {
  min-width: 200px;
}

.topic-side {
  min-width: 150px;
}

.topic-side.team-a {
  color: #0d6efd;
  font-weight: 500;
}

.topic-side.team-b {
  color: #dc3545;
  font-weight: 500;
}

/* Game count badge */
.game-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 24px;
  padding: 0 8px;
  background: #e9ecef;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark-text, #333);
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-active {
  background: #d4edda;
  color: #155724;
}

.status-past {
  background: #e9ecef;
  color: #666;
}

/* No topics message */
.no-topics {
  text-align: center;
  padding: 2rem !important;
  color: var(--dark-text, #666);
  font-style: italic;
}

/* Footer */
.archive-footer {
  text-align: center;
  margin-top: 1rem;
  color: var(--dark-text, #666);
  font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .archive-title {
    font-size: 1.5rem;
  }
  
  .topics-table {
    font-size: 0.9rem;
  }
  
  .topics-table th,
  .topics-table td {
    padding: 10px 12px;
  }
  
  .topic-name,
  .topic-side {
    min-width: 120px;
  }
}

/* ===== End Topics Archive Page Styles ===== */


/* ===== CSP FIX: Cursor for game cards ===== */
.history-item {
  cursor: pointer;
}
/* ===== END FIX ===== */


/* ===== MODAL STYLES (CSP-safe, same as /main) ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-visible {
  display: flex !important;
}

.modal-content {
  background: white;
  border-radius: 8px;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #ddd;
}

.modal-title {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.modal-close:hover {
  color: #000;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #ddd;
  text-align: center;
}

.btn-modal-close {
  padding: 10px 30px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
}

.btn-modal-close:hover {
  background: #5a6268;
}

/* Game details */
.game-details-info {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.detail-row:last-child {
  border-bottom: none;
}

.details-section-title {
  margin: 20px 0 10px 0;
  font-size: 16px;
  color: #333;
}

.game-details-messages {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 15px;
  background: #fafafa;
  max-height: 400px;
  overflow-y: auto;
}

/* ===== ROUNDS AND MESSAGES (top-to-bottom order) ===== */
.round-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #ddd;
}

.round-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.round-title {
  margin: 0 0 10px 0;
  color: #007bff;
  font-size: 14px;
  font-weight: 600;
}

.round-eliminated {
  padding: 8px 12px;
  background: #fff5f5;
  border-left: 3px solid #dc3545;
  margin-bottom: 10px;
  font-size: 14px;
  color: #dc3545;
}

.round-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-item {
  padding: 10px 12px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.message-team {
  font-weight: bold;
  min-width: 28px;
}

.team-a-badge {
  color: #0d6efd;
}

.team-b-badge {
  color: #dc3545;
}

.message-author {
  font-weight: 600;
  color: #333;
}

.message-text {
  color: #333;
  flex: 1;
  min-width: 200px;
}

.message-time {
  font-size: 11px;
  color: #999;
  white-space: nowrap;
}

.message-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
}

.badge-secret {
  background: #fff8f0;
  color: #FF8C00;
  border: 1px solid #FF8C00;
}

.badge-auto {
  background: #fffef0;
  color: #b8860b;
  border: 1px solid #ffc107;
}

.no-messages {
  text-align: center;
  color: #666;
  padding: 20px;
}

.modal-open {
  overflow: hidden;
}
/* ===== END MODAL STYLES ===== */

/* ===== NEW: Share button styles (CSP-safe) ===== */
.share-section {
  margin: 15px 0;
  text-align: center;
}

.btn-share {
  background: #28a745 !important;
}

.btn-share:hover {
  opacity: 0.9;
}
/* ===== END NEW ===== */

/* ===== Added by audit fix F5: inline styles → CSS classes ===== */
.no-products-message {
  text-align: center;
  padding: 40px;
  color: var(--accent-yellow);
}
.game-details-mb-20 {
  margin-bottom: 20px;
}
.badge-eliminated {
  background: #ffebee;
  color: #c62828;
}
/* ===== End F5 ===== */

