/* ========================================
   Variables et Reset
   ======================================== */
:root {
    --casino-green: #0a5f38;
    --casino-green-dark: #064029;
    --gold: #ffd700;
    --gold-dark: #ccac00;
    --red: #dc3545;
    --white: #ffffff;
    --dark: #1a1a1a;
    --gray: #6c757d;
    --light-gray: #f8f9fa;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-heavy: rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    color: var(--white);
    overflow-x: hidden;
}

/* ========================================
   Container Principal
   ======================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================
   Header
   ======================================== */
header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    color: var(--gold);
    text-shadow: 3px 3px 6px var(--shadow-heavy);
    margin-bottom: 10px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 3px 3px 6px var(--shadow-heavy), 0 0 10px var(--gold);
    }

    to {
        text-shadow: 3px 3px 6px var(--shadow-heavy), 0 0 20px var(--gold), 0 0 30px var(--gold);
    }
}

.deck-info {
    background: rgba(0, 0, 0, 0.3);
    display: inline-block;
    padding: 10px 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.deck-info strong {
    color: var(--gold);
}

/* ========================================
   Zone du Croupier
   ======================================== */
.dealer-area {
    background: linear-gradient(135deg, var(--casino-green-dark), var(--casino-green));
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px var(--shadow-heavy);
    border: 3px solid var(--gold);
}

.dealer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dealer-info h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: var(--gold);
}

.hand-value {
    font-size: 1.5rem;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 15px;
    border-radius: 10px;
    min-width: 60px;
    text-align: center;
}

.cards-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 140px;
    align-items: center;
    justify-content: center;
}

/* ========================================
   Cartes
   ======================================== */
.card {
    width: 90px;
    height: 130px;
    background: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px var(--shadow);
    position: relative;
    transition: transform 0.3s ease;
    animation: dealCard 0.5s ease-out;
}

@keyframes dealCard {
    from {
        transform: translateY(-100px) rotateY(90deg);
        opacity: 0;
    }

    to {
        transform: translateY(0) rotateY(0deg);
        opacity: 1;
    }
}

.card:hover {
    transform: translateY(-5px);
}

.card.hidden {
    background: linear-gradient(135deg, var(--red) 0%, var(--dark) 100%);
    color: var(--gold);
}

.card.hidden::before {
    content: '🎴';
    font-size: 3rem;
}

.card-rank {
    font-size: 2rem;
    font-weight: bold;
    color: var(--dark);
}

.card-suit {
    font-size: 2.5rem;
    margin-top: 5px;
}

.card.red .card-rank {
    color: var(--red);
}

.card-corner {
    position: absolute;
    font-size: 0.9rem;
    font-weight: bold;
}

.card-corner.top-left {
    top: 5px;
    left: 8px;
}

.card-corner.bottom-right {
    bottom: 5px;
    right: 8px;
    transform: rotate(180deg);
}

/* ========================================
   Zone des Joueurs
   ======================================== */
.players-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.player-box {
    background: linear-gradient(135deg, rgba(10, 95, 56, 0.8), rgba(6, 64, 41, 0.8));
    border-radius: 15px;
    padding: 20px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 5px 15px var(--shadow);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.player-box.active {
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    transform: scale(1.02);
}

.player-box.bust {
    opacity: 0.6;
    border-color: var(--red);
}

.player-box.winner {
    border-color: var(--gold);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.player-name {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--gold);
}

.player-balance {
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 12px;
    border-radius: 8px;
    font-weight: 500;
}

.player-balance.low {
    color: var(--red);
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.player-status {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.player-hands {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hand {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 10px;
}

.hand.active-hand {
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid var(--gold);
}

.hand-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.refill-btn {
    width: 100%;
    margin-top: 10px;
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.refill-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.5);
}

/* ========================================
   Panneau de Contrôle
   ======================================== */
.control-panel {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95), rgba(52, 58, 64, 0.95));
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px var(--shadow-heavy);
    backdrop-filter: blur(10px);
    border: 2px solid var(--gold);
}

.control-panel h3 {
    color: var(--gold);
    margin-bottom: 20px;
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Configuration du jeu */
.game-setup {
    text-align: center;
}

.player-selection {
    margin-bottom: 20px;
}

.player-selection label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
}

.player-selection select {
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid var(--gold);
    background: var(--dark);
    color: var(--white);
    font-size: 1rem;
    cursor: pointer;
    min-width: 150px;
}

/* Phase de paris */
.current-player-bet {
    text-align: center;
    margin-bottom: 20px;
    background: rgba(255, 215, 0, 0.1);
    padding: 15px;
    border-radius: 10px;
}

.current-player-bet p {
    margin: 5px 0;
}

.chips-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.chip {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 4px solid;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px var(--shadow);
    position: relative;
}

.chip:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 8px 16px var(--shadow-heavy);
}

.chip:active {
    transform: scale(0.95);
}

.chip-5 {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border-color: #a93226;
    color: white;
}

.chip-25 {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-color: #21618c;
    color: white;
}

.chip-100 {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border-color: #1e8449;
    color: white;
}

.chip-500 {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    border-color: #6c3483;
    color: white;
}

/* Boutons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px var(--shadow-heavy);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--dark);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--gray), #5a6268);
    color: var(--white);
}

.btn-action {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: var(--white);
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 120px;
}

.btn-icon {
    font-size: 1.5rem;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.current-player-info {
    text-align: center;
    margin-bottom: 20px;
    background: rgba(255, 215, 0, 0.1);
    padding: 15px;
    border-radius: 10px;
}

.current-player-info p {
    margin: 5px 0;
}

/* Résultats */
.results-phase {
    text-align: center;
}

#results-summary {
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.result-item {
    background: rgba(255, 215, 0, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid;
}

.result-item.win {
    border-left-color: #28a745;
}

.result-item.lose {
    border-left-color: var(--red);
}

.result-item.push {
    border-left-color: var(--gray);
}

.result-item.blackjack {
    border-left-color: var(--gold);
    background: rgba(255, 215, 0, 0.2);
}

/* Message Overlay */
.message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.message-content {
    background: linear-gradient(135deg, var(--dark), #2c3e50);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    border: 3px solid var(--gold);
    box-shadow: 0 10px 40px var(--shadow-heavy);
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#message-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 15px;
}

#message-text {
    font-size: 1.2rem;
    color: var(--white);
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .players-area {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-action {
        width: 100%;
    }

    .card {
        width: 70px;
        height: 100px;
    }

    .card-rank {
        font-size: 1.5rem;
    }

    .card-suit {
        font-size: 2rem;
    }
}

/* ========================================
   Modal d'Authentification
   ======================================== */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.auth-content {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    padding: 40px;
    border-radius: 20px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    border: 3px solid var(--gold);
}

.auth-content h2 {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    font-weight: 500;
}

.auth-tab.active {
    background: var(--gold);
    color: var(--dark);
}

.auth-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.2);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-form input {
    padding: 12px;
    border-radius: 8px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 1rem;
}

.auth-form input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.auth-divider {
    text-align: center;
    margin: 20px 0;
    color: var(--gray);
    position: relative;
    font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--gray);
}

.auth-divider::before {
    left: 0;
}

.auth-divider::after {
    right: 0;
}

.guest-info {
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 10px;
    line-height: 1.4;
}

.auth-error {
    color: var(--red);
    text-align: center;
    min-height: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Info utilisateur dans le header */
.user-info-container {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.user-name {
    font-weight: bold;
    color: var(--gold);
    font-size: 1.1rem;
}

.user-balance {
    font-weight: bold;
    color: #4caf50;
    font-size: 1.2rem;
}

.guest-badge {
    background: rgba(255, 215, 0, 0.2);
    color: var(--gold);
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.85rem;
    border: 1px solid var(--gold);
}

header {
    position: relative;
}