/* --- Component Styles --- */

/* --- Actions Area --- */
#actions {
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 5px;
    background-color: #ffffff;
    text-align: center;
}

#actions button {
    padding: 8px 15px;
    margin: 5px;
    cursor: pointer;
    border: 1px solid #aaa;
    border-radius: 4px;
    background-color: #fff;
    transition: background-color 0.2s, border-color 0.2s;
}

#actions button:hover {
    background-color: #eee;
    border-color: #888;
}

/* --- Status Message --- */
#status-message {
    text-align: center;
    padding: 10px;
    background-color: #fffbeb;
    border: 1px solid #f0e0a0;
    border-radius: 4px;
    font-weight: bold;
    min-height: 1.5em;
}

/* --- Token Styles (General) --- */
.tokens-display {
    /* Layout handled in layout.css */
}

.token-group {
    display: flex; /* This might be overridden by bank/player styles */
    flex-direction: column; 
    align-items: center;
    min-width: 60px;
    text-align: center;
}

.token {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #555;
    margin-bottom: 5px;
    display: inline-block;
}

.token-small {
    width: 18px;
    height: 18px;
    border-radius: 50%; /* Ensure small tokens are round */
    border: 1px solid #444; /* Slightly darker border for small */
    margin-right: 4px;
    vertical-align: middle;
    display: inline-block; /* Ensure display works */
}

.token-white { background-color: #eee; }
.token-blue { background-color: #6a8dff; }
.token-green { background-color: #5ad65a; }
.token-red { background-color: #ff5c5c; }
.token-black { background-color: #333; color: white; }
.token-gold { background-color: #ffd700; }

.token-count {
    font-weight: bold;
    font-size: 1.1em;
}

.token-label {
    font-size: 0.8em;
    text-transform: capitalize;
    color: #555;
}

/* --- Bank Styles --- */
#bank {
    border: 1px solid #ccc;
    padding: 10px; /* Adjust padding */
    border-radius: 5px;
    background-color: #ffffff;
}

#bank h2 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 1.2em;
}

#bank .tokens-display { /* The grid container */
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
    gap: 10px; 
    justify-items: center; /* Center items horizontally in grid cells */
    align-items: center;   /* Center items vertically */
    /* Remove old flex styles if they existed here */
}

#bank .token-group { /* Container for each token */
    cursor: pointer;
    padding: 0; /* Remove padding */
    border-radius: 0;
    transition: transform 0.1s ease-in-out;
    /* Remove old bank-specific flex styles */
    width: auto; /* Reset width */
    display: flex; /* Needed to center token inside */
    justify-content: center;
    align-items: center;
}

#bank .token-group:hover {
    /* background-color: #eee; */ /* Remove background hover */
    transform: scale(1.05);
}

#bank .token-group.selected .token { /* Style the token when selected */
     outline: 3px solid #aae0ff;
     outline-offset: 2px; 
     box-shadow: 0 0 8px #6a8dff;
}

#bank .token { /* Style the token circle itself */
    width: 50px; /* Make tokens larger */
    height: 50px;
    margin-bottom: 0; /* Remove margin */
    position: relative; /* For positioning the count overlay */
    display: flex; /* To help center the overlay text */
    align-items: center;
    justify-content: center;
    border-width: 3px;
}

/* Style for the count inside the token */
.token-count-overlay {
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7); 
    position: relative; /* Keep it within the token flow */
    z-index: 1; /* Make sure it's above potential pseudo-elements */
}

/* Adjust text color for light tokens */
#bank .token-white .token-count-overlay,
#bank .token-gold .token-count-overlay {
    color: black;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7);
}

/* --- Cards and Nobles Area --- */
#cards-nobles-area {
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 5px;
    background-color: #ffffff;
}

/* --- Nobles --- */
.nobles-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.noble-card {
    width: 140px;
    height: 140px;
    border: 2px solid #333;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.noble-header {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1;
}

.noble-vp {
    background-color: rgba(255, 255, 255, 0.8);
    color: #333;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 1.6em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1.1;
    min-width: 25px;
    text-align: center;
}

.noble-cost {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.cost-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cost-item span {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.5);
    order: 2;
    margin-left: -8px;
    box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.7);
    text-shadow: 1px 1px 1px rgba(0,0,0,0.7);
}

.cost-item .token-small {
    order: 1;
    width: 32px;
    height: 32px;
    border-width: 2px;
    border-color: #555;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
    margin-right: 0;
}

.noble-placeholder {
    width: 150px;
    height: 150px;
    border: 2px dashed #aaa;
    background-color: #f0f0f0;
    color: #777;
    font-size: 0.9em;
    display: flex; /* Enable Flexbox */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    text-align: center; /* Center text for multi-line */
}

/* --- Cards --- */
.deck-placeholder {
    width: 80px;
    height: 120px;
    border: 2px solid #aaa;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    text-align: center;
    font-size: 0.9em;
    color: #777;
    background-color: #eee;
    margin-right: 10px;
    cursor: pointer;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.deck-placeholder span:not(.deck-card-count) {
     background-color: rgba(255, 255, 255, 0.7);
     padding: 2px 5px;
     border-radius: 3px;
     font-size: 0.8em;
}

/* Styles for the card count */
.deck-card-count {
    position: absolute;
    bottom: 5px;
    left: 5px;
    width: 24px;
    height: 24px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 1;
}

.card {
    width: 90px;
    height: 135px;
    border: 1px solid #777;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.9em;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
    position: relative;
    overflow: hidden;

    /* Add fallback background and properties */
    background: linear-gradient(135deg, #d0e0f0, #a0b0c0); /* Default fallback */
    background-size: cover;
    background-position: center;
}

.card:hover {
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.2);
    transform: translateY(-3px) scale(1.02);
}

.card-header {
    padding: 0;
    width: 100%;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-pv {
    font-weight: bold;
    font-size: 1.6em;
    color: #333;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    background-color: rgba(255, 255, 255, 0.8);
    padding: 0px 5px;
    border-radius: 4px;
    line-height: 1.1;
    min-width: 25px;
    text-align: center;
}

.card-gem-icon {
    width: 24px;
    height: 24px;
    border-width: 2px;
    border-color: #fff;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
    /* Inherits token color styles */
}

.card-cost {
    padding: 0;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.cost-item {
    display: flex;
    align-items: center;
    padding: 0;
    background-color: transparent;
    border-radius: 0;
}

.cost-item span { /* Cost number */
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.5);
    order: 2;
    margin-left: -8px;
    box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.7);
    text-shadow: 1px 1px 1px rgba(0,0,0,0.7);
}

.cost-item .token-small { /* Cost token icon */
    order: 1;
    width: 24px;
    height: 24px;
    border-width: 1px;
    border-color: #555;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
    margin-right: 0;
    /* Uses general .token-small styles */
}

/* --- Player Areas --- */
.player-info {
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 5px;
    background-color: #ffffff;
}

.player-info.current-player {
    border-color: #ff9800;
    box-shadow: 0 0 8px rgba(255, 152, 0, 0.5);
    border-width: 2px;
}

.player-tokens, .player-gems {
    min-height: 30px;
    padding: 5px;
    border: 1px solid #eee;
    margin-bottom: 10px;
    border-radius: 3px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.player-tokens .token-group, /* Player token group layout */
.player-gems .gem-group {
    flex-direction: row; /* Side-by-side */
    align-items: center;
    gap: 5px;
    min-width: auto;
    margin-bottom: 0;
    /* Uses general .token-group styles */
}

.player-gems .gem-group {
     background-color: #e0e0e0;
     padding: 2px 5px;
     border-radius: 3px;
     border: 1px solid #ccc;
}

.gem-count {
    font-size: 0.9em;
    font-weight: bold;
}

.player-vp {
    font-weight: bold;
    font-size: 1.2em;
    color: #4CAF50;
}

.reserved-cards {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
    font-size: 0.9em;
}

.reserved-cards-display { /* Container for reserved cards */
    display: flex;
    gap: 8px;
    flex-wrap: wrap; /* Allow wrapping if many reserved */
    margin-top: 5px;
    min-height: 145px; /* Approximate height of one card + padding */
    align-items: flex-start; /* Align cards to the top */
}

.reserved-card { /* Styling for the reserved card itself */
    width: 80px; /* Slightly smaller than board cards */
    height: 120px;
    cursor: pointer; /* Indicate it can be clicked (for purchase later) */
    border-color: #b0a080; /* Different border color */
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
}

/* Optional: Adjust reserved card header/cost for smaller size */
.reserved-card .card-header {
    /* Example: Reduce padding or icon size if needed */
}
.reserved-card .card-cost {
     gap: 2px; /* Tighter cost items */
}
.reserved-card .cost-item span {
     width: 18px;
     height: 18px;
     font-size: 0.8em;
     margin-left: -6px; /* Adjust overlap */
}
.reserved-card .cost-item .token-small {
     width: 20px;
     height: 20px;
}

.player-tokens .token-group {
    cursor: default; /* Default: player tokens aren't clickable */
}

.player-token-group.discard-candidate {
    cursor: pointer !important; /* Make clickable during discard */
    outline: 2px dashed orange; /* Highlight candidate tokens */
    outline-offset: 2px;
}

/* Example: Style for tokens already clicked for discard this phase */
/*
.player-token-group.discard-candidate.marked-for-discard {
    opacity: 0.5;
    outline-style: solid;
    outline-color: red;
}
*/

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: white;
    padding: 20px 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 80%;
    position: relative;
}

.modal-message {
    font-size: 1.2em;
    margin: 20px 0;
    color: #333;
}

.modal-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 10px;
}

.modal-button:hover {
    background-color: #45a049;
} 