/* The Landlord's Game - Styles */

/* ===== CSS Variables ===== */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --board-bg: #e8d5b7;
  --board-border: #8b7355;
  --gold: #c9a227;
  --gold-light: #d4af37;
  --red-danger: #8b0000;
  --green-success: #2e7d32;
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0a0;
  --text-dark: #2c2c2c;
  
  /* Property colors */
  --brown: #8b4513;
  --light-blue: #87ceeb;
  --pink: #ff69b4;
  --orange: #ffa500;
  --red: #dc143c;
  --yellow: #ffd700;
  --green: #228b22;
  --dark-blue: #00008b;
  
  /* Player colors */
  --player-red: #e74c3c;
  --player-blue: #3498db;
  --player-green: #2ecc71;
  --player-orange: #f39c12;
  --player-purple: #9b59b6;
  --player-teal: #1abc9c;
  
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --radius: 8px;
  --radius-lg: 12px;
}

/* ===== Reset & Base ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Crimson Text', Georgia, serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

h1, h2, h3, h4, h5 {
  font-family: 'Cinzel', serif;
  font-weight: 600;
}

/* ===== Buttons ===== */
.btn {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--text-dark);
  box-shadow: 0 2px 10px rgba(201, 162, 39, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(201, 162, 39, 0.5);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--gold);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gold);
  color: var(--text-dark);
}

.btn-warning {
  background: linear-gradient(135deg, var(--red-danger), #a00000);
  color: white;
}

.btn-warning:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(139, 0, 0, 0.5);
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.1rem;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--gold);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.2);
}

.form-group input::placeholder {
  color: var(--text-secondary);
}

.form-group .hint {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row input {
  flex: 1;
}

/* ===== Lobby Page ===== */
.lobby-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: 
    radial-gradient(ellipse at top, rgba(201, 162, 39, 0.1) 0%, transparent 50%),
    var(--bg-primary);
}

.lobby-header {
  text-align: center;
  margin-bottom: 48px;
}

.game-title {
  font-size: 3.5rem;
  color: var(--gold);
  text-shadow: 0 2px 20px rgba(201, 162, 39, 0.3);
  letter-spacing: 4px;
}

.game-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 8px;
}

.lobby-main {
  width: 100%;
  max-width: 500px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow);
  border: 1px solid var(--bg-tertiary);
}

.lobby-main h2 {
  color: var(--gold);
  margin-bottom: 24px;
  font-size: 1.5rem;
}

.divider {
  display: flex;
  align-items: center;
  margin: 32px 0;
  color: var(--text-secondary);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--bg-tertiary);
}

.divider span {
  padding: 0 16px;
  font-size: 0.9rem;
}

.invite-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 8px;
}

.recent-games-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--bg-tertiary);
}

.recent-games-section h3 {
  color: var(--gold);
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.recent-games-list {
  list-style: none;
}

.recent-games-list li {
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.recent-games-list li:hover {
  background: var(--gold);
}

.recent-games-list li:hover span {
  color: var(--text-dark);
}

.lobby-footer {
  margin-top: 40px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ===== Game Page ===== */
.game-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--gold);
}

.game-code {
  font-family: 'Roboto Mono', monospace;
}

.game-code .btn-copy {
  background: transparent;
  border: 1px solid var(--text-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 8px;
  transition: all 0.2s;
}

.game-code .btn-copy:hover {
  background: var(--gold);
  border-color: var(--gold);
}

.turn-indicator {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: var(--gold);
}

.game-main {
  flex: 1;
  display: grid;
  grid-template-columns: 200px 1fr 280px;
  gap: 20px;
  padding: 20px;
  max-height: calc(100vh - 60px);
}

/* Players Sidebar */
.players-sidebar {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  overflow-y: auto;
}

.players-sidebar h3 {
  color: var(--gold);
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.players-list {
  list-style: none;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: all 0.2s;
}

.player-item.current {
  background: var(--bg-tertiary);
  border: 2px solid var(--gold);
}

.player-item.bankrupt {
  opacity: 0.5;
  text-decoration: line-through;
}

.player-token {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid white;
}

.player-info {
  flex: 1;
}

.player-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.player-money {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.85rem;
  color: var(--green-success);
}

.player-jail {
  font-size: 0.75rem;
  color: var(--red-danger);
}

.players-join-section {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  text-align: center;
}

/* Board */
.board-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.board {
  width: 680px;
  height: 680px;
  background: var(--board-bg);
  border: 8px solid var(--board-border);
  border-radius: 4px;
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  grid-template-rows: repeat(11, 1fr);
  gap: 0;
  position: relative;
  box-shadow: var(--shadow);
}

.board-space {
  border: 1px solid rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2px;
  font-size: 0.55rem;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.board-space:hover {
  background: rgba(201, 162, 39, 0.2);
}

.board-space.corner {
  background: var(--board-bg);
}

.board-space.property {
  justify-content: flex-start;
  padding-top: 4px;
}

.property-color-bar {
  width: 100%;
  height: 8px;
  border-radius: 2px;
}

.property-name {
  font-size: 0.5rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-top: 2px;
  line-height: 1.1;
  max-width: 100%;
  word-wrap: break-word;
}

.property-price {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.5rem;
  color: var(--text-dark);
  margin-top: auto;
}

/* Color groups */
.color-brown { background: var(--brown); }
.color-light-blue { background: var(--light-blue); }
.color-pink { background: var(--pink); }
.color-orange { background: var(--orange); }
.color-red { background: var(--red); }
.color-yellow { background: var(--yellow); }
.color-green { background: var(--green); }
.color-dark-blue { background: var(--dark-blue); }
.color-railroad { background: linear-gradient(45deg, #333, #666); }
.color-utility { background: linear-gradient(45deg, #4a90d9, #2d5a87); }

/* Board corners */
.space-go { background: #e74c3c; color: white; }
.space-jail { background: #8e44ad; color: white; }
.space-free-parking { background: #f39c12; color: white; }
.space-go-to-jail { background: #c0392b; color: white; }

/* Card spaces */
.space-chance, .space-community {
  background: #ecf0f1;
}

/* Player tokens on board */
.player-token-board {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid white;
  position: absolute;
  bottom: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 10;
}

.player-token-board:nth-child(2) { left: 2px; }
.player-token-board:nth-child(3) { left: 14px; }
.player-token-board:nth-child(4) { left: 26px; }
.player-token-board:nth-child(5) { left: 38px; }
.player-token-board:nth-child(6) { left: 50px; }

/* Board center */
.board-center {
  grid-column: 2 / 11;
  grid-row: 2 / 11;
  background: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.board-title {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 8px;
}

.board-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Actions Sidebar */
.actions-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.actions-sidebar section {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
}

.actions-sidebar h3 {
  color: var(--gold);
  font-size: 1rem;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--bg-tertiary);
  padding-bottom: 8px;
}

/* Dice */
.dice-container {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.die {
  width: 56px;
  height: 56px;
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Roboto Mono', monospace;
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--text-dark);
  box-shadow: 
    inset 0 2px 4px rgba(255,255,255,0.5),
    0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.1s;
}

.die.rolling {
  animation: diceRoll 0.5s ease-out;
}

@keyframes diceRoll {
  0% { transform: rotateX(0) rotateY(0); }
  25% { transform: rotateX(90deg) rotateY(45deg); }
  50% { transform: rotateX(180deg) rotateY(90deg); }
  75% { transform: rotateX(270deg) rotateY(135deg); }
  100% { transform: rotateX(360deg) rotateY(180deg); }
}

.dice-section .btn {
  width: 100%;
  margin-bottom: 8px;
}

/* Property section */
.property-section {
  background: var(--bg-secondary);
}

#property-info h4 {
  color: var(--gold);
  margin-bottom: 8px;
}

#property-info .property-price {
  font-size: 1.1rem;
  font-family: 'Roboto Mono', monospace;
  color: var(--green-success);
  margin: 8px 0;
}

#property-info .rent-table {
  font-size: 0.85rem;
  margin-top: 12px;
}

#property-info .rent-table table {
  width: 100%;
  border-collapse: collapse;
}

#property-info .rent-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--bg-tertiary);
}

#property-actions {
  margin-top: 16px;
}

#property-actions .btn {
  width: 100%;
  margin-bottom: 8px;
}

/* Compact lists */
.compact-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}

.compact-list li {
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  margin-bottom: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.compact-list li:hover {
  background: var(--gold);
  color: var(--text-dark);
}

.compact-list li .house-count {
  font-size: 0.8rem;
  color: var(--green-success);
}

.compact-list li .mortgaged {
  color: var(--red-danger);
}

/* ===== Modals ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.modal-large {
  max-width: 700px;
}

.modal-small {
  max-width: 400px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--gold);
}

.modal h3 {
  color: var(--gold);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions .btn {
  flex: 1;
}

/* Trade modal */
.trade-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 20px 0;
}

.trade-column {
  background: var(--bg-tertiary);
  padding: 16px;
  border-radius: var(--radius);
}

.trade-column h4 {
  color: var(--gold);
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.trade-properties {
  max-height: 150px;
  overflow-y: auto;
}

.trade-property {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.trade-property:hover {
  background: var(--bg-primary);
}

.trade-property.selected {
  background: var(--gold);
  color: var(--text-dark);
}

/* Card reveal */
.card-reveal {
  text-align: center;
}

.card-reveal h3 {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.card-reveal p {
  font-size: 1.2rem;
  line-height: 1.8;
  margin-bottom: 24px;
}

/* Property modal */
.property-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.property-modal-color {
  width: 60px;
  height: 60px;
  border-radius: var(--radius);
}

.property-modal-stats {
  flex: 1;
  margin-left: 16px;
}

.property-modal-stats h4 {
  color: var(--gold);
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.property-modal-stats .owner-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-tertiary);
  border-radius: 20px;
  font-size: 0.85rem;
  margin-top: 4px;
}

.property-modal-stats .owner-badge.you {
  background: var(--gold);
  color: var(--text-dark);
}

.rent-table-modal {
  width: 100%;
  margin: 20px 0;
  border-collapse: collapse;
}

.rent-table-modal th,
.rent-table-modal td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid var(--bg-tertiary);
}

.rent-table-modal th {
  color: var(--gold);
}

.building-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
}

.building-controls .house-count-display {
  font-size: 1.5rem;
  color: var(--gold);
}

.building-controls .btn {
  padding: 8px 16px;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .game-main {
    grid-template-columns: 180px 1fr 240px;
  }
  
  .board {
    width: 580px;
    height: 580px;
  }
}

@media (max-width: 900px) {
  .game-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  
  .players-sidebar {
    order: 1;
  }
  
  .board-wrapper {
    order: 2;
  }
  
  .actions-sidebar {
    order: 3;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  
  .board {
    width: 100%;
    max-width: 500px;
    height: auto;
    aspect-ratio: 1;
  }
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-content {
  animation: slideUp 0.3s ease-out;
}

.player-item {
  animation: fadeIn 0.3s ease-out;
}

/* ===== Utility Classes ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-gold { color: var(--gold); }
.text-green { color: var(--green-success); }
.text-red { color: var(--red-danger); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }