/* Layout styles for UNO */

/* === CONTAINER === */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-4);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === HEADER === */
header {
  text-align: center;
  padding: var(--space-3) 0;
}

header h1 {
  font-size: var(--text-3xl);
  font-weight: 700;
  background: linear-gradient(90deg, var(--uno-red), var(--uno-yellow) 40%, var(--uno-green) 60%, var(--uno-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-1);
  display: inline-block;
}

header h1 .help-icon {
  -webkit-text-fill-color: var(--text-muted);
  font-size: var(--text-lg);
  cursor: pointer;
  margin-left: var(--space-2);
}

header h1 .help-icon:hover {
  -webkit-text-fill-color: var(--text-primary);
}

header p {
  color: var(--text-secondary);
  font-size: var(--text-base);
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--border-default);
  border-radius: 50%;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  vertical-align: middle;
  margin-left: var(--space-2);
  transition: all var(--transition-base);
}

.help-icon:hover {
  background: var(--accent-primary);
  color: white;
}

/* === GAME LAYOUT === */
.game-layout {
  display: flex;
  gap: var(--space-4);
  flex: 1;
  min-height: 0;
}

/* === SIDEBARS === */
.sidebar {
  width: 200px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex-shrink: 0;
}

.sidebar h3 {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-2);
}

.sidebar-spacer {
  flex: 1;
}

/* === MAIN AREA === */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

/* === STATUS BAR === */
.status-bar {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  text-align: center;
  font-weight: 500;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

/* === TABLE AREA === */
.table-area {
  flex: 1;
  background: var(--bg-table-pattern);
  border-radius: var(--radius-xl);
  border: 4px solid #1a5c4a;
  position: relative;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* KraftedLogic logo - bottom right corner */
.table-logo {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 120px;
  height: auto;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  object-fit: contain;
  filter: brightness(1.3) drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
}

/* === CENTER AREA === */
.center-area {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  position: relative;
}

.draw-pile {
  position: relative;
  cursor: pointer;
  transition: transform var(--transition-base);
}

.draw-pile:hover:not(.disabled) {
  transform: scale(1.05);
}

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

.draw-pile.disabled:hover {
  transform: none;
}

.draw-pile .card-back {
  width: var(--card-width);
  height: var(--card-height);
  background: linear-gradient(145deg, #2a3a4a 0%, #1c2a33 50%, #233746 100%);
  border-radius: var(--card-border-radius);
  border: 3px solid #3a4a5a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

.draw-pile .card-back::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: calc(var(--card-border-radius) - 4px);
}

.card-back-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
  filter: brightness(1.3) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  opacity: 0.9;
}

.card-back-text {
  font-size: var(--text-lg);
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.pile-count {
  position: absolute;
  bottom: -8px;
  right: -8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
}

.discard-pile {
  width: var(--card-width);
  height: var(--card-height);
  display: flex;
  align-items: center;
  justify-content: center;
}

.discard-pile .uno-card {
  animation: cardPlay 0.3s ease-out;
}

.direction-indicator {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-3xl);
  color: rgba(255, 255, 255, 0.6);
}

.direction-indicator.counter-clockwise .direction-arrow {
  transform: scaleX(-1);
}

.current-color {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.color-indicator {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: var(--shadow-md);
}

.color-indicator.red { background: var(--uno-red); }
.color-indicator.yellow { background: var(--uno-yellow); }
.color-indicator.green { background: var(--uno-green); }
.color-indicator.blue { background: var(--uno-blue); }

/* === PLAYER POSITIONS === */
.player-positions {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.player-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  pointer-events: auto;
}

.player-seat.bottom {
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
}

.player-seat.top {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
}

.player-seat.left {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.player-seat.right {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.player-info {
  background: var(--bg-card);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  text-align: center;
  min-width: 100px;
  border: 2px solid transparent;
  transition: all var(--transition-base);
}

.player-info.current-turn {
  border-color: var(--accent-warning);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.player-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.player-card-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.opponent-cards {
  display: flex;
  gap: -15px;
}

.card-back-mini {
  width: 35px;
  height: 50px;
  background: linear-gradient(145deg, #2a3a4a 0%, #1c2a33 50%, #233746 100%);
  border-radius: 6px;
  border: 2px solid #3a4a5a;
  margin-left: -15px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back-mini::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

.card-back-mini::after {
  content: 'K';
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.25);
  font-family: system-ui, sans-serif;
}

.card-back-mini:first-child {
  margin-left: 0;
}

/* === HAND AREA === */
.hand-area {
  padding: var(--space-3) 0;
}

.hand {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-lg);
  min-height: 120px;
}

/* === UNO BUTTON === */
.uno-button-container {
  position: fixed;
  bottom: 200px;
  right: 30px;
  z-index: var(--z-overlay);
}

.uno-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--uno-red), var(--uno-red-dark));
  color: white;
  font-size: var(--text-xl);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
  animation: unoPulse 1s ease-in-out infinite;
}

.uno-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(229, 57, 53, 0.6);
}

/* === CONTROLS === */
#controls {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}

/* === GAME INFO === */
.game-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.info-card {
  background: var(--bg-card);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

.info-card .label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

.info-card .value {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

/* === SCORES DISPLAY === */
.scores-display {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  overflow: hidden;
}

.scores-display h4 {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
}

.score-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-default);
}

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

.score-row .name {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.score-row .score {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

/* === GAME LOG === */
.game-log {
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  padding: var(--space-2);
}

/* Right sidebar - fixed height with scrollable game log */
.right-sidebar {
  display: flex;
  flex-direction: column;
  height: 500px;
  max-height: calc(100vh - 250px);
  flex-shrink: 0;
}

.right-sidebar h3 {
  flex-shrink: 0;
}

.right-sidebar .game-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.log-entry {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--border-default);
}

.log-entry:last-child {
  border-bottom: none;
}

.log-num {
  color: var(--text-muted);
  font-size: var(--text-xs);
  min-width: 24px;
  display: inline-block;
}

/* === FOOTER === */
.page-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  margin-top: auto;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.version-indicator {
  opacity: 0.7;
}
