/**
 * fortyfives.css — Merrimack Valley Auction 45 Cardroom Stylesheet
 */

:root {
  --felt-green: #0d5930;
  --felt-deep: #06381c;
  --table-border: #451a03;
  --table-gold: #facc15;
  --gold-glow: rgba(250, 204, 21, 0.45);
  --wood-rim: #2d1306;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --team-blue: #2563eb;
  --team-red: #dc2626;
  --font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #051a0e;
  font-family: var(--font-family);
  color: #ffffff;
}

/* ====================================================================
   APP SHELL & TOP NAVIGATION
   ==================================================================== */
.forty-fives-app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 40%, var(--felt-green) 0%, var(--felt-deep) 75%, #031c0e 100%);
  position: relative;
  overflow: hidden;
}

.topbar-header {
  height: 52px;
  background: rgba(13, 22, 16, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 2px solid rgba(250, 204, 21, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--table-gold);
  letter-spacing: 0.5px;
}

.btn-nav {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 9999px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--table-gold);
}

.room-badge {
  background: rgba(250, 204, 21, 0.15);
  border: 1.5px solid var(--table-gold);
  color: var(--table-gold);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  cursor: pointer;
}

/* ====================================================================
   MAIN CARD TABLE
   ==================================================================== */
.table-viewport {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 16px 14px;
  overflow: hidden;
}

/* Oval Table Felt Border */
.felt-arena {
  position: absolute;
  inset: 12px;
  border: 12px solid var(--wood-rim);
  border-radius: 60px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.85), 0 10px 30px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* ====================================================================
   SEAT LAYOUT (2 TO 6 PLAYERS)
   ==================================================================== */
.seats-ring {
  position: absolute;
  inset: 20px;
  pointer-events: none;
}

.player-seat {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.25s ease;
  z-index: 20;
}

/* Responsive seat positions for up to 6 players */
.seat-pos-bottom { bottom: 10px; left: 50%; transform: translateX(-50%); }
.seat-pos-top { top: 10px; left: 50%; transform: translateX(-50%); }
.seat-pos-left { left: 16px; top: 48%; transform: translateY(-50%); }
.seat-pos-right { right: 16px; top: 48%; transform: translateY(-50%); }
.seat-pos-top-left { top: 22px; left: 18%; }
.seat-pos-top-right { top: 22px; right: 18%; }
.seat-pos-bottom-left { bottom: 12px; left: 18%; }
.seat-pos-bottom-right { bottom: 12px; right: 18%; }

/* Seat Badge Box */
.seat-badge {
  background: rgba(15, 23, 42, 0.92);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  min-width: 130px;
  position: relative;
  transition: all 0.2s ease;
}

.seat-badge.active-turn {
  border-color: var(--table-gold);
  box-shadow: 0 0 20px var(--gold-glow), 0 4px 15px rgba(0, 0, 0, 0.8);
  transform: scale(1.04);
}

.seat-badge.dealer::after {
  content: 'D';
  position: absolute;
  top: -8px;
  right: -8px;
  background: #facc15;
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 900;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  border: 1.5px solid #ffffff;
}

.seat-avatar {
  font-size: 1.6rem;
  line-height: 1;
}

.seat-details {
  display: flex;
  flex-direction: column;
}

.seat-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.seat-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f8fafc;
  max-width: 85px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-pill {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

.team-pill.team-0 { background: #1d4ed8; color: #dbeafe; }
.team-pill.team-1 { background: #b91c1c; color: #fee2e2; }
.team-pill.team-2 { background: #047857; color: #d1fae5; }

.seat-score-row {
  font-size: 0.75rem;
  color: #94a3b8;
  display: flex;
  gap: 6px;
}

.seat-score {
  color: #38bdf8;
  font-weight: 700;
}

.seat-action-bubble {
  position: absolute;
  top: -26px;
  background: #facc15;
  color: #0f172a;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ====================================================================
   CENTER TABLE ARENA (TRICKS, TRUMP & KITTY)
   ==================================================================== */
.center-arena {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 10;
  pointer-events: auto;
}

.trump-contract-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10, 20, 14, 0.85);
  border: 1.5px solid var(--table-gold);
  border-radius: 9999px;
  padding: 5px 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.trump-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
}

.contract-indicator {
  font-size: 0.82rem;
  color: var(--table-gold);
  font-weight: 700;
}

/* Trick Playing Surface */
.trick-pile {
  position: relative;
  width: 220px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trick-card-slot {
  position: absolute;
  width: 78px;
  height: 110px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Angle trick cards towards center */
.trick-slot-0 { transform: translateY(18px); }
.trick-slot-1 { transform: translateX(25px) rotate(20deg); }
.trick-slot-2 { transform: translateY(-18px) rotate(-10deg); }
.trick-slot-3 { transform: translateX(-25px) rotate(-25deg); }
.trick-slot-4 { transform: translate(18px, -18px) rotate(15deg); }
.trick-slot-5 { transform: translate(-18px, 18px) rotate(-15deg); }

/* Kitty Display */
.kitty-pile-display {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.kitty-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ====================================================================
   PLAYER HAND DOCK (BOTTOM AREA)
   ==================================================================== */
.player-hand-dock {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 50;
  margin-top: auto;
}

.hand-cards-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  min-height: 125px;
  padding: 6px 12px;
}

.card-item {
  width: 78px;
  height: 112px;
  cursor: pointer;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}

.card-item:hover:not(.not-playable) {
  transform: translateY(-16px) scale(1.05);
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.65));
}

.card-item.selected {
  transform: translateY(-22px) scale(1.08);
  filter: drop-shadow(0 0 16px var(--gold-glow));
}

.card-item.not-playable {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

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

/* Control Action Bar below cards */
.hand-control-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.btn-action-main {
  background: linear-gradient(135deg, #facc15 0%, #d97706 100%);
  border: 1.5px solid #fef08a;
  color: #0f172a;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 800;
  padding: 8px 20px;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45);
  transition: all 0.15s ease;
}

.btn-action-main:hover {
  transform: scale(1.04);
}

/* ====================================================================
   MODALS: BIDDING, KITTY DISCARD, RULES CHEAT SHEET & ROOM
   ==================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 12, 6, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  display: flex;
  opacity: 1;
}

.modal-card {
  background: linear-gradient(145deg, #132b1d 0%, #091a10 100%);
  border: 2px solid var(--table-gold);
  border-radius: 24px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 30px var(--gold-glow);
  color: #ffffff;
  text-align: center;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--table-gold);
  margin-bottom: 6px;
}

.modal-subtitle {
  font-size: 0.92rem;
  color: #cbd5e1;
  margin-bottom: 18px;
  line-height: 1.4;
}

/* Bidding Buttons Grid */
.bidding-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.btn-bid-option {
  padding: 14px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-bid-option:hover:not(:disabled) {
  border-color: var(--table-gold);
  background: rgba(250, 204, 21, 0.2);
  transform: translateY(-2px);
}

.btn-bid-option:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-bid-pass {
  grid-column: span 3;
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
}

/* Suit Selection Buttons */
.suit-select-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.btn-suit-choice {
  padding: 10px 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 1.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-suit-choice.selected {
  border-color: var(--table-gold);
  background: rgba(250, 204, 21, 0.25);
  box-shadow: 0 0 12px var(--gold-glow);
}

.suit-red { color: #ef4444; }
.suit-black { color: #f8fafc; }

/* Cheat Sheet Table */
.cheat-sheet-content {
  text-align: left;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #e2e8f0;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 6px;
}

.cheat-sheet-content h4 {
  color: var(--table-gold);
  margin: 12px 0 4px;
  font-size: 0.95rem;
}

.cheat-pill {
  display: inline-block;
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: 700;
  margin: 2px;
  color: #facc15;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .felt-arena {
    inset: 6px;
    border-width: 8px;
    border-radius: 36px;
  }

  .card-item {
    width: 62px;
    height: 90px;
  }

  .trick-card-slot {
    width: 62px;
    height: 90px;
  }

  .seat-badge {
    min-width: 100px;
    padding: 4px 8px;
  }

  .seat-avatar {
    font-size: 1.3rem;
  }
}
