/* public/style.css */

:root {
    --primary: #ff4757;
    --secondary: #f1c40f;
    --accent-1: #2ecc71;
    --accent-2: #3498db;
    --card-bg: rgba(255, 255, 255, 0.92);
    --text: #2f3542;
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(120deg, #ffe1e6 0%, #fff1d6 20%, #e2fcdb 40%, #d8f3ff 60%, #f0e6ff 80%, #ffe1e6 100%);
    background-size: 250% 250%;
    animation: rainbowAnimation 16s ease infinite;
    color: var(--text);
}

@keyframes rainbowAnimation {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

input,
button {
    font-size: 1rem;
    border-radius: 8px;
    border: none;
    outline: none;
}

button {
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

/* Lobby Styles */
#lobby-screen {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
    width: 320px;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

input {
    width: 90%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid #ddd;
    background: #fff;
}

#lobby-screen h2 {
    color: var(--primary);
    margin-top: 0;
}

#join-btn {
    width: 98%;
    padding: 12px;
    background-color: var(--primary);
    color: white;
}

#join-btn:hover {
    background-color: var(--accent-2);
}

#start-game-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--accent-1);
    color: white;
    margin-top: 15px;
    font-size: 1.1rem;
}

#start-game-btn:hover {
    background-color: #27ae60;
}

#status,
#error {
    margin-top: 15px;
    font-weight: bold;
}

#status {
    color: var(--accent-1);
}

#error {
    color: var(--primary);
}

.player-list {
    text-align: left;
    background: rgba(0, 0, 0, 0.03);
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.player-list ul {
    padding-left: 20px;
    margin: 5px 0 0 0;
}

/* Game Screen Layout */
#game-screen {
    display: none;
    width: 95vw;
    max-width: 1200px;
    height: 92vh;
    flex-direction: column;
    gap: 15px;
}

#central-board {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(8px);
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.game-pile {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px 25px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    width: 110px;
}

.game-pile h3 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    color: #64748b;
}

.pile-count {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

#discard-pile {
    background: #f1f5f9;
    cursor: pointer;
}

#discard-pile:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

/* Horizontal Stables */
#player-stables {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    padding-right: 5px;
}

.stable {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stable-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stable-header h4 {
    margin: 0;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-2), #2980b9);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.95rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.stable-contents {
    display: flex;
    flex-direction: row;
    gap: 15px;
    width: 100%;
}

.stable-section {
    flex: 1;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 8px 12px;
    border: 1px dashed rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    min-height: 90px;
}

.row-label {
    font-weight: 700;
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.card-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
}

.card-placeholder {
    width: 48px;
    height: 68px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #94a3b8;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Modal Styling (Hides Modal by Default) */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    width: 80%;
    max-width: 600px;
    position: relative;
}

#close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    color: #aaa;
    cursor: pointer;
    border: none;
    background: none;
}

#modal-card-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
    padding-left: 0;
    list-style: none;
}

.modal-card {
    width: 70px;
    height: 100px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 5px;
    font-size: 0.8rem;
    border-top: 5px solid var(--primary);
}

/* Card Image Styles inside Stables */
.card-item {
    width: 58px;
    height: 82px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    background: #fff;
}

.card-item:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.card-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Hand & Turn Control Styles --- */
.hand-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: 12px 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.turn-status-banner {
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #64748b;
    padding: 6px;
    border-radius: 8px;
    background: #f1f5f9;
}

.turn-status-banner.active-turn {
    background: #dcfce7;
    color: #15803d;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.hand-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.action-btn {
    padding: 8px 18px;
    background: var(--accent-2);
    color: white;
    border-radius: 8px;
    font-size: 0.9rem;
}

.action-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.action-btn.secondary {
    background: #64748b;
}

.cards-in-hand {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 8px 4px;
    min-height: 85px;
    align-items: center;
    justify-content: center;
}

.hand-card {
    width: 58px;
    height: 82px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: transform 0.2s ease;
    background: #fff;
    flex-shrink: 0;
}

.hand-card.playable:hover {
    transform: translateY(-8px) scale(1.08);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.hand-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}