/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Urbanist:ital,wght@0,100..900;1,100..900&display=swap');

/* --- Global & Basic Styles using the New Palette --- */
:root {
    --red: #D94C50;
    --grey: #2a2a2a; /* Slightly lighter for less harshness */
    --white: #F2F2F2;
    --green: #2ABD51;
    --light-grey: #343434; /* Was primary grey, now for containers */
    --off-white: #e9e9e9;
    --font-family: 'Urbanist', sans-serif;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--grey);
    font-family: var(--font-family);
    color: var(--white);
    display: flex;
    flex-direction: column;
}

/* --- Header & Footer Styles --- */
.site-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--light-grey);
    flex-shrink: 0;
    gap: 15px;
}

.header-logo {
    height: 40px;
    width: 40px;
}

.site-title h1 {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
}

.site-title span {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--off-white);
    display: block;
    margin-top: -2px;
}

.site-footer {
    padding: 10px;
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    background-color: var(--light-grey);
    flex-shrink: 0;
}

/* --- Screen & Container Base --- */
.screen {
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    box-sizing: border-box;
    padding: 20px;
    flex-grow: 1; /* Make screens take up remaining space */
}

.screen.active {
    display: flex;
}

/* Base container for Lobby, Decks, etc. */
.container {
    background-color: var(--light-grey);
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 500px;
}

/* --- NEW Auth Screen Layout --- */
#auth-screen {
    padding: 30px;
}

.auth-container {
    display: flex;
    width: 100%;
    max-width: 900px;
    height: 550px;
    background-color: var(--light-grey);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.auth-info-panel {
    width: 45%;
    background-color: var(--red);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--white);
}

.info-panel-logo {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
}

.auth-info-panel h2 {
    margin: 0 0 15px 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.auth-info-panel p {
    font-size: 1rem;
    line-height: 1.6;
}

.auth-form-panel {
    width: 55%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.form-container {
    width: 100%;
    max-width: 320px;
    text-align: center;
}

#auth-title {
    font-size: 2rem;
    margin-bottom: 25px;
}

#auth-toggle {
    display: inline-block;
    margin-top: 15px;
    color: var(--red);
    cursor: pointer;
    text-decoration: none;
}
#auth-toggle:hover {
    text-decoration: underline;
}

hr {
    border: none;
    border-top: 1px solid #444;
    margin: 20px 0;
}


/* --- General Form, Button & List Styles --- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
    width: 100%;
    padding: 15px;
    margin-top: 15px;
    border-radius: 8px;
    border: 1px solid #555;
    font-size: 16px;
    box-sizing: border-box;
    background-color: #2a2a2a;
    color: var(--white);
    font-family: var(--font-family);
}

button {
    width: 100%;
    padding: 15px;
    margin-top: 15px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    box-sizing: border-box;
    background-color: var(--red);
    color: var(--white);
    cursor: pointer;
    font-weight: bold;
    font-family: var(--font-family);
    transition: background-color 0.2s, transform 0.1s;
}
button:hover { background-color: #c44448; }
button:active { transform: scale(0.98); }
button:disabled { background-color: #555; color: #888; cursor: not-allowed; }
button.secondary { background-color: #6c757d; }
button.secondary:hover { background-color: #5a6268; }

.status-message {
    margin-top: 15px;
    color: var(--red);
    min-height: 1.2em;
}

.list-container {
    width: 100%;
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
}
.list-item {
    background-color: #555;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 10px;
}
.list-item:hover { background-color: #666; }

/* --- My Decks & Deck Editor --- */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.editor-header h1 {
    margin: 0;
}
.view-toggle-controls {
    display: flex;
    gap: 5px;
}
.view-toggle-btn {
    width: 32px;
    height: 32px;
    padding: 6px;
    margin: 0;
    background-color: #555;
    border: 2px solid transparent;
}
.view-toggle-btn.active {
    background-color: var(--red);
    border-color: var(--white);
}

.deck-item-controls {
    display: flex;
    gap: 10px;
}

.deck-item-controls button {
    width: auto;
    padding: 5px 10px;
    font-size: 14px;
    margin-top: 0;
}

#card-preview-area {
    width: 100%;
    min-height: 200px;
    max-height: 40vh;
    overflow-y: auto;
    background-color: #2a2a2a;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    gap: 10px;
}
#card-preview-area.gallery-view { flex-wrap: wrap; justify-content: center; }
#card-preview-area.list-view { flex-direction: column; }

.card-preview-item {
    position: relative;
    background-size: cover;
    background-position: center;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.gallery-view .card-preview-item { width: 80px; height: 112px; }
.list-view .card-preview-item { 
    width: 95%; 
    height: auto;
    min-height: 50px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: left center;
    padding: 8px 8px 8px 70px; /* Top, Right, Bottom, Left */
    display: flex;
    align-items: center;
    background-color: #444; 
}
.card-preview-item-name {
    color: var(--white);
    font-size: 0.9rem;
    word-break: break-all;
}

.delete-card-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--red);
    color: white;
    border: 2px solid var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 0;
    z-index: 10;
}
.list-view .delete-card-btn {
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
}

/* --- Game History List --- */
#game-history-section { margin-top: 20px; }
.history-list { max-height: 150px; overflow-y: auto; }

/* --- Game Screen Player Info --- */
.player-info-display {
    position: absolute;
    background-color: rgba(0,0,0,0.6);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
}
.player-info-display .card-count { font-weight: bold; margin-left: 8px; }

/* --- (Previously Existing) Game & Card Styles --- */
/* These styles are kept for the game page but might need tweaks */
#game-screen { background-color: #212121; justify-content: flex-start; padding: 0; }
.game-ui-bar { width: 100%; padding: 15px; display: flex; justify-content: space-between; align-items: center; box-sizing: border-box; flex-shrink: 0; }
#top-left-ui, #top-center-ui, #top-right-ui { display: flex; gap: 10px; align-items: center; }
#top-center-ui { position: absolute; left: 50%; transform: translateX(-50%); }
.game-ui-btn { background-color: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.2); color: var(--white); padding: 8px 12px; border-radius: 5px; cursor: pointer; font-size: 16px; }
#game-container { width: 100%; flex-grow: 1; position: relative; display: flex; justify-content: center; align-items: center; }
#board-wrapper { width: 95vw; height: 95vh; max-width: calc(95vh * 16 / 9); max-height: calc(95vw * 9 / 16); position: relative; }
#table { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--green); background-size: cover; background-position: center; box-sizing: border-box; }

.card {
    user-select: none;
    background-size: cover;
    background-position: center;
    touch-action: none;
    background-color: var(--white);
    color: var(--grey);
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    box-shadow: 0.2vmin 0.2vmin 0.5vmin rgba(0,0,0,0.4);
    transition: all 0.2s ease-out;
	border-radius: 6px;
	width: 6vw;
    height: 8.4vw; /* width * 1.4 for aspect ratio */
    max-width: 80px; /* Set a max size on large screens */
    max-height: 112px;
}
#table .card { position: absolute; }
.card.dragging { z-index: 1000 !important; transform: scale(1.05); box-shadow: 0.4vmin 0.4vmin 1vmin rgba(0,0,0,0.5); }
#deck-pile {
    width: 6vw; height: 8.4vw; max-width: 80px; max-height: 112px;
    border-radius: 6px;
    background-color: var(--red);
    /* Layer the logo on top of the gradient */
    background-image: url('../images/logo_white.png'), linear-gradient(135deg, rgba(255,255,255,0.1) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.1) 75%, transparent 75%, transparent);
    background-size: 50%, 40px 40px;
    background-repeat: no-repeat, repeat;
    background-position: center, center;
    position: absolute;
    top: 20px; left: 20px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.2);
}
#player-hand { width: 100%; height: 140px; display: flex; align-items: center; position: relative; background-color: rgba(0,0,0,0.2); flex-shrink: 0; }
#hand-scroll-wrapper { position: relative; width: 100%; height: 100%; overflow: hidden; }
#hand-scroll-container { display: flex; align-items: center; gap: 10px; padding: 10px 50px; position: absolute; left: 0; transition: left 0.3s ease-in-out; height: 100%; box-sizing: border-box; }
#hand-scroll-container .card { position: relative; flex-shrink: 0; width: 80px; height: 112px; }
.scroll-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; background-color: rgba(0,0,0,0.5); border-radius: 50%; border: none; color: white; font-size: 24px; cursor: pointer; z-index: 2500; display: none; align-items: center; justify-content: center; }
#scroll-left-btn { left: 5px; }
#scroll-right-btn { right: 5px; }
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 5000; }
.modal-content { background-color: var(--light-grey); padding: 30px; border-radius: 10px; width: 90%; max-width: 500px; text-align: left; }

/* Media query for smaller screens to stack auth panel */
@media (max-width: 768px) {
    .auth-container {
        flex-direction: column;
        height: auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    .auth-info-panel, .auth-form-panel {
        width: 100%;
        box-sizing: border-box;
    }
    .auth-info-panel {
        padding: 30px;
    }
    .info-panel-logo {
        display: none; /* Hide logo in panel on mobile to save space */
    }
}
