/* Base Reset */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Arial', sans-serif; }
body { background-color: #121212; color: #fff; min-height: 100vh; overflow-x: hidden; }
.hidden { display: none !important; }

/* Container & Typography */
.container { max-width: 1200px; margin: 0 auto; padding: 15px; width: 100%; }
h2, h3 { text-transform: uppercase; letter-spacing: 1px; }

/* Auth Section */
#auth-section { max-width: 400px; margin: 10vh auto; background: #1e1e1e; padding: 30px; border-radius: 12px; text-align: center; border: 1px solid #333; }
input { width: 100%; padding: 15px; margin: 10px 0; border-radius: 8px; border: 1px solid #444; background: #2a2a2a; color: white; font-size: 16px; }
.link { display: block; margin-top: 15px; color: #3498db; cursor: pointer; }

/* Layout Grid */
.main-layout { display: flex; gap: 20px; flex-direction: row; align-items: flex-start; }

/* Game Area (The Green Table) */
.game-area { 
    flex: 3; 
    background: radial-gradient(circle, #0a6c38 0%, #054020 100%); 
    border: 10px solid #4a3018; 
    border-radius: 20px; 
    padding: 20px; 
    box-shadow: inset 0 0 50px rgba(0,0,0,0.5), 0 10px 30px rgba(0,0,0,0.5);
    min-height: 80vh;
}

/* Header & Stats */
.table-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid rgba(255,255,255,0.2); padding-bottom: 10px; margin-bottom: 10px; }
.stats-bar { display: flex; justify-content: space-around; background: rgba(0,0,0,0.3); padding: 8px; border-radius: 8px; font-size: 0.9em; margin-bottom: 20px; }

/* Cards Layout */
.dealer-section, .player-section { margin-bottom: 20px; text-align: center; }
.cards { display: flex; gap: 10px; justify-content: center; min-height: 120px; margin-top: 10px; flex-wrap: wrap; }

/* Playing Cards */
/* Base card style (Black by default) */
.card {
    width: 75px;
    height: 110px;
    background: white;
    color: #1a1a1a; /* Dark black/gray */
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: bold;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.3);
    border: 1px solid #ccc;
    transition: transform 0.2s;
}

/* Red class for Hearts and Diamonds */
.card.red {
    color: #e74c3c; /* A nice casino red */
}

/* Black class for Spades and Clubs */
.card.black {
    color: #2c3e50; /* Deep black/blue */
}

/* Styling for the hidden dealer card */
.hidden-card {
    background: repeating-linear-gradient(
        45deg,
        #2c3e50,
        #2c3e50 10px,
        #34495e 10px,
        #34495e 20px
    );
    color: white !important;
    border: 2px solid #ecf0f1;
}

/* Messages */
.message { height: 30px; font-size: 1.2rem; font-weight: bold; color: #f1c40f; text-align: center; margin: 15px 0; text-shadow: 1px 1px 5px rgba(0,0,0,0.8); }

/* Buttons & Controls */
.controls, .bet-actions { display: flex; justify-content: center; gap: 15px; margin-top: 15px; flex-wrap: wrap; }
button { cursor: pointer; border: none; border-radius: 8px; font-weight: bold; text-transform: uppercase; padding: 12px 20px; transition: 0.2s; font-size: 14px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-action { background: #2980b9; color: white; flex: 1; max-width: 150px; }
.btn-action.deal { background: #27ae60; }
.btn-action.stand { background: #c0392b; }
.btn-secondary { background: #555; color: white; padding: 10px 15px; }

/* Betting Area */
.betting-area { background: rgba(0,0,0,0.4); padding: 15px; border-radius: 12px; text-align: center; margin-top: 20px; }
.current-bet-display { font-size: 1.2rem; margin-bottom: 15px; color: #f1c40f; }
.chips-container { display: flex; justify-content: center; gap: 15px; margin-bottom: 15px; }
.chip { 
    width: 60px; height: 60px; border-radius: 50%; background: #ecf0f1; color: #2c3e50; 
    border: 5px dashed #e74c3c; font-size: 1.1rem; padding: 0; box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}
.chip:nth-child(2) { border-color: #3498db; }
.chip:nth-child(3) { border-color: #9b59b6; background: #333; color: white; }

/* Sidebar Leaderboard */
.sidebar { flex: 1; background: #1e1e1e; padding: 20px; border-radius: 12px; border: 1px solid #333; }
.sidebar h3 { border-bottom: 2px solid #333; padding-bottom: 10px; margin-bottom: 10px; text-align: center; }
#leaderboard-list li { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #333; font-size: 0.95rem; }
#leaderboard-list li span:last-child { color: #2ecc71; font-weight: bold; }

.cards {
    display: flex;
    flex-wrap: wrap; /* Allows cards to wrap to a new line on small screens */
    justify-content: center;
    gap: 10px;
}

input:focus {
    outline: 2px solid #27ae60;
    background-color: #333;
}

/* Ensure the auth section is centered and takes up space on mobile */
#auth-section {
    width: 90%;
    max-width: 400px;
    margin: 15vh auto;
    padding: 2rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}
/* =========================================
   MOBILE RESPONSIVENESS (Phones & Tablets) 
   ========================================= */
@media (max-width: 900px) {
    .main-layout { flex-direction: column; } /* Stack elements vertically */
    .game-area { width: 100%; border-width: 5px; padding: 10px; min-height: auto; }
    .sidebar { width: 100%; margin-top: 20px; }
    .card { width: 60px; height: 85px; font-size: 1.3rem; } /* Smaller cards */
    .chip { width: 50px; height: 50px; font-size: 1rem; }
    .btn-action { max-width: 100%; } /* Full width buttons */
}

.user-msg-container {
    margin-top: 20px;
    padding: 15px;
    background: rgba(52, 152, 219, 0.1); /* Subtle blue tint */
    border-left: 4px solid #3498db;     /* Professional accent line */
    border-radius: 4px;
    text-align: left;
}

#pNamePara {
    display: block;
    color: #ecf0f1;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    word-wrap: break-word; /* Prevents text overflow on narrow screens */
}

/* Mobile Tweak: On small screens, give it more breathing room */
@media (max-width: 900px) {
    .user-msg-container {
        margin-bottom: 20px; /* Space before the logout button */
    }
    #pNamePara {
        font-size: 1rem; /* Slightly larger text for mobile readability */
    }
}

/* The Footer Bar */
.footer-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: #1a1a1a;
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    z-index: 9999; /* Ensures it stays above the game table */
    font-size: 0.8rem;
    color: #888;
}

.footer-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-online {
    color: #2ecc71;
    font-weight: bold;
}

.footer-links a {
    color: #888;
    text-decoration: none;
    margin-left: 15px;
}

.footer-links a:hover {
    color: #fff;
}

/* IMPORTANT: Prevent content from being hidden behind the footer */
#auth-section, .main-layout {
    margin-bottom: 60px; /* Gives space so footer doesn't cover buttons */
}

/* Mobile Tweak */
@media (max-width: 600px) {
    .footer-links {
        display: none; /* Hide links on very small phones to save space */
    }
}

/* styles.css */
.meter-container {
    width: 100%;
    margin-top: 5px;
    margin-bottom: 10px;
    text-align: left;
}

#strength-bar {
    height: 5px;
    width: 0%;
    border-radius: 2px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

#strength-text {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
    display: block;
}

/* Colors for the bar */
.weak { background-color: #e74c3c; width: 33%; }
.medium { background-color: #f1c40f; width: 66%; }
.strong { background-color: #2ecc71; width: 100%; }

/* The animation keyframes */
@keyframes dealCard {
    0% {
        opacity: 0;
        transform: translateY(-150px) translateX(-150px) rotate(15deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) translateX(0) rotate(0deg);
    }
}

/* Apply this class to new cards */
.card-animate {
    animation: dealCard 0.4s ease-out forwards;
}

/* Base card styling (ensure overflow is handled in the container) */
.cards-container {
    display: flex;
    gap: 10px;
    min-height: 120px;
    padding: 10px;
    overflow-x: auto;
}