/* PokerForReal — Styles */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-felt:  #2d5a27;
  --green-dark:  #1a3a16;
  --gold:        #c9a84c;
  --gold-light:  #e8c86a;
  --red:         #c0392b;
  --white:       #f5f5f0;
  --gray-light:  #e0ddd5;
  --gray:        #888;
  --card-bg:     #fff;
  --radius:      10px;
  --shadow:      0 4px 20px rgba(0,0,0,.4);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--green-dark);
  color: var(--white);
  min-height: 100vh;
}

/* ---- Auth ---- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: rgba(0,0,0,.6);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  text-align: center;
  color: var(--gold);
  font-size: 1.8rem;
  letter-spacing: 2px;
  margin-bottom: .25rem;
}

.auth-card h2 {
  text-align: center;
  color: var(--gray-light);
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
}

/* ---- Forms ---- */
label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .85rem;
  color: var(--gray-light);
  margin-bottom: 1rem;
}

input, select {
  width: 100%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  color: var(--white);
  padding: .6rem .8rem;
  font-size: 1rem;
  transition: border-color .2s;
  box-sizing: border-box;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--gold);
}

select option { background: #1a3a16; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ---- Buttons ---- */
.btn-primary, button[type=submit] {
  background: var(--gold);
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  padding: .75rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-top: .5rem;
  transition: background .2s;
  text-align: center;
  display: inline-block;
  text-decoration: none;
}

.btn-primary:hover, button[type=submit]:hover {
  background: var(--gold-light);
}

.btn-link {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  font-size: .9rem;
  text-decoration: underline;
}

/* ---- Feedback ---- */
.error-msg {
  background: rgba(192,57,43,.25);
  border: 1px solid var(--red);
  border-radius: 6px;
  color: #ff9f9f;
  padding: .6rem .9rem;
  margin-bottom: 1rem;
  font-size: .9rem;
}

.hidden { display: none !important; }

.auth-switch {
  text-align: center;
  margin-top: 1.2rem;
  font-size: .9rem;
  color: var(--gray);
}

.auth-switch a { color: var(--gold); }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: .7rem 1rem;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 6px;
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  margin-bottom: .8rem;
}
.btn-google:hover { background: #f8f9fa; box-shadow: 0 1px 4px rgba(0,0,0,.2); }

.divider {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: .8rem 0;
  color: var(--gray);
  font-size: .8rem;
}
.divider::before,
.divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.15); }

/* ---- Lobby ---- */
.lobby-page {
  min-height: 100vh;
  background: #0f2410;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.8rem;
  background: #0a1a09;
  border-bottom: 2px solid var(--gold);
}

.top-bar .logo {
  color: var(--gold);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 2px;
  flex: 1;
}

.top-bar .user-info {
  color: var(--gray-light);
  font-size: .9rem;
}

.lobby-main {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  padding: 2.5rem 2rem;
  max-width: 860px;
  margin: 0 auto;
  align-items: flex-start;
}

.lobby-main .card {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
}

@media (max-width: 640px) {
  .lobby-main {
    flex-direction: column;
    padding: 1rem;
  }
}

.card {
  background: #1a3515;
  border: 1px solid rgba(201,168,76,.4);
  border-radius: var(--radius);
  padding: 1.8rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
}

.card h2 {
  color: var(--gold);
  margin-bottom: 1.4rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding-bottom: .6rem;
  border-bottom: 1px solid rgba(201,168,76,.25);
}

/* ---- Invite link ---- */
.invite-link-box {
  display: flex;
  gap: .5rem;
  margin: .8rem 0;
}

.invite-link-box input {
  flex: 1;
  font-size: .85rem;
}

.invite-link-box button {
  width: auto;
  margin: 0;
  padding: .6rem 1rem;
  font-size: .85rem;
}

/* ---- Salle d'attente ---- */
.table-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.waiting-card {
  background: rgba(0,0,0,.65);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 520px;
  margin: 3rem auto;
  text-align: center;
}
.waiting-card h1 { color: var(--gold); font-size: 1.6rem; letter-spacing: 2px; }
.waiting-card h2 { color: var(--white); margin: .4rem 0 .2rem; }
.game-meta { color: var(--gray); font-size: .85rem; margin-bottom: 1.2rem; }
.waiting-players { display: flex; flex-direction: column; gap: .5rem; margin: 1rem 0; }
.waiting-player {
  display: flex; align-items: center; gap: .8rem;
  background: rgba(255,255,255,.06); border-radius: 6px; padding: .5rem .9rem;
}
.seat-num { color: var(--gold); font-weight: 700; min-width: 2rem; }
.player-name { flex: 1; }
.player-chips { color: var(--gray); font-size: .85rem; }
.waiting-msg { color: var(--gray); font-style: italic; margin-top: 1rem; }

/* ---- Table de jeu ---- */
#game-table { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

.announcement-bar {
  background: rgba(0,0,0,.7);
  border-bottom: 1px solid rgba(201,168,76,.3);
  padding: .5rem 1rem;
  text-align: center;
  font-size: .9rem;
  color: var(--gold-light);
  min-height: 2.2rem;
  transition: background .3s;
}
.announcement-bar.flash { background: rgba(201,168,76,.25); }

.felt-table {
  flex: 1;
  position: relative;
  background: radial-gradient(ellipse 80% 70% at 50% 50%, #2d7a27, #1a3a16);
  border: 8px solid #5c3a1e;
  border-radius: 50%;
  margin: 1rem 2rem;
  min-height: 320px;
  max-height: 420px;
}

.players-ring { position: absolute; inset: 0; }

.player-seat {
  position: absolute;
  transform: translate(-50%, -50%);
  text-align: center;
  min-width: 80px;
}
.player-seat.folded { opacity: .4; }
.player-seat.disconnected .seat-avatar { border-color: var(--gray); }

.seat-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,.5); border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700; color: var(--white);
  margin: 0 auto .2rem;
}
.seat-name { font-size: .75rem; color: var(--white); white-space: nowrap; }
.seat-chips { font-size: .7rem; color: var(--gold); }
.seat-bet {
  background: var(--gold); color: #1a1a1a;
  border-radius: 50%; width: 28px; height: 28px;
  font-size: .65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: .2rem auto 0;
}
.seat-tag {
  font-size: .6rem; background: var(--red); color: #fff;
  border-radius: 4px; padding: .1rem .3rem; margin-top: .2rem;
}
.seat-tag.gold { background: var(--gold); color: #1a1a1a; }

/* Centre de table */
.table-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: .5rem;
}

.community-cards {
  display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap;
}
.community-placeholder { color: rgba(255,255,255,.3); font-size: .8rem; }

.pot-display {
  color: var(--white); font-size: .9rem;
  background: rgba(0,0,0,.4); border-radius: 20px;
  padding: .3rem .8rem;
}

/* ---- Cartes ---- */
.card {
  width: 58px; height: 82px; border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-weight: 700; user-select: none;
}

.card.back {
  background: repeating-linear-gradient(
    45deg, #1a3faa 0px, #1a3faa 6px, #1554c0 6px, #1554c0 12px
  );
  border: 2px solid rgba(255,255,255,.3);
  cursor: pointer;
}

.card.face {
  background: #fff;
  color: #1a1a1a;
  border: 2px solid #ccc;
  flex-direction: column;
  padding: .3rem;
}
.card.face.red { color: #cc0000; }
.card.face .rank { font-size: 1.2rem; line-height: 1; }
.card.face .suit { font-size: 1.4rem; line-height: 1; }

/* ---- Zone héro ---- */
.hero-zone {
  padding: .8rem 1rem;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  background: rgba(0,0,0,.4); border-top: 1px solid rgba(255,255,255,.1);
}

.hero-info { display: flex; gap: 1rem; align-items: center; }
.hero-name { font-weight: 700; color: var(--gold); }
.hero-chips { color: var(--white); font-size: .9rem; }
.hero-bet { color: var(--gold-light); font-size: .85rem; }

.hero-cards { display: flex; gap: .6rem; cursor: pointer; }

/* ---- Timer ---- */
.timer-wrap { width: 200px; }
.timer-bar-bg { background: rgba(255,255,255,.15); border-radius: 4px; height: 6px; overflow: hidden; }
.timer-bar-fill { height: 100%; background: var(--gold); transition: width .4s linear; border-radius: 4px; }
.timer-label { font-size: .75rem; color: var(--gray-light); display: block; text-align: right; margin-top: .2rem; }

/* ---- Actions ---- */
.action-panel {
  display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; justify-content: center;
}

.act-fold  { background: var(--red);  color: #fff; border: none; border-radius: 6px; padding: .6rem 1.2rem; cursor: pointer; font-weight: 700; }
.act-check { background: #3a7a3a; color: #fff; border: none; border-radius: 6px; padding: .6rem 1.2rem; cursor: pointer; font-weight: 700; }
.act-call  { background: #2a6ab5; color: #fff; border: none; border-radius: 6px; padding: .6rem 1.2rem; cursor: pointer; font-weight: 700; }
.act-raise { background: var(--gold); color: #1a1a1a; border: none; border-radius: 6px; padding: .6rem 1rem; cursor: pointer; font-weight: 700; }

.raise-group { display: flex; align-items: center; gap: .4rem; }
.raise-group input[type=range] { width: 100px; accent-color: var(--gold); }
.raise-group span { color: var(--gold-light); min-width: 2.5rem; text-align: right; font-size: .9rem; }

/* ---- Rebuy ---- */
.btn-rebuy {
  background: linear-gradient(135deg, #4a90d9, #2a6ab5);
  color: #fff; border: none; border-radius: 6px;
  padding: .6rem 1.4rem; font-size: .9rem; font-weight: 700;
  cursor: pointer; transition: opacity .2s;
}
.btn-rebuy:hover { opacity: .85; }
.btn-rebuy:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Overlay fin de partie ---- */
.game-over-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center;
}
.game-over-card {
  background: #1a3a16; border: 2px solid var(--gold);
  border-radius: var(--radius); padding: 2rem 2.5rem;
  text-align: center; max-width: 480px; width: 90%;
}
.game-over-card h2 { color: var(--gold); font-size: 1.6rem; margin-bottom: .5rem; }
.game-over-winner { color: var(--white); font-size: 1.2rem; margin-bottom: 1.2rem; }

.ranking-table { width: 100%; border-collapse: collapse; color: var(--white); font-size: .9rem; }
.ranking-table th { color: var(--gold); border-bottom: 1px solid rgba(201,168,76,.4); padding: .4rem .6rem; }
.ranking-table td { padding: .4rem .6rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.ranking-table tr:first-child td { color: var(--gold); font-weight: 700; }

/* ---- Historique ---- */
.history-page { min-height: 100vh; }
.history-main { max-width: 700px; margin: 0 auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.loading-msg, .empty-msg { color: var(--gray); text-align: center; padding: 2rem; }

.hand-card {
  background: rgba(0,0,0,.45); border: 1px solid rgba(201,168,76,.25);
  border-radius: var(--radius); padding: 1rem 1.2rem;
}
.hand-header { display: flex; gap: 1rem; align-items: center; margin-bottom: .7rem; }
.hand-num  { color: var(--gold); font-weight: 700; }
.hand-pot  { color: var(--white); font-size: .9rem; }
.hand-dur  { color: var(--gray); font-size: .8rem; margin-left: auto; }
.hand-community { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .7rem; }
.no-community  { color: var(--gray); font-size: .8rem; font-style: italic; }
.hand-winners  { display: flex; flex-wrap: wrap; gap: .4rem; }
.winner-chip {
  background: rgba(201,168,76,.2); border: 1px solid rgba(201,168,76,.4);
  color: var(--gold-light); border-radius: 20px; padding: .2rem .7rem; font-size: .8rem;
}
.card-sm { width: 40px !important; height: 56px !important; font-size: .75rem !important; }



/* ---- Overlay showdown ---- */
.showdown-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.80);
  display: flex; align-items: center; justify-content: center;
}
.showdown-card {
  background: #1a3a16; border: 2px solid var(--gold);
  border-radius: var(--radius); padding: 1.5rem 2rem;
  text-align: center; max-width: 600px; width: 92%;
}
.showdown-card h3 { color: var(--gold); font-size: 1.3rem; margin-bottom: 1rem; letter-spacing: .05em; }
.showdown-hands { display: flex; flex-wrap: wrap; gap: 1.2rem; justify-content: center; }
.showdown-player {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  background: rgba(0,0,0,.35); border-radius: 8px; padding: .8rem 1rem;
  border: 1px solid rgba(255,255,255,.1);
}
.showdown-player.showdown-winner {
  border-color: var(--gold); background: rgba(201,168,76,.12);
}
.showdown-name { color: var(--white); font-weight: 700; font-size: .95rem; }
.showdown-cards { display: flex; gap: .4rem; }
.showdown-hand-name { color: var(--gold-light); font-size: .8rem; font-style: italic; }
.showdown-amount { color: #4caf50; font-weight: 700; font-size: .9rem; }
