/* Basic Reset & Body Styling */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Courier New';
    font-size: 120%;
    background-color: #1a1a1a;
    color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* Game Container */
#game-container {
    width: 100%;
    min-width: 816px;
    max-width: 1920px; /*full screen*/
    height: 100%;
    min-height: 624px;
    max-height: 1080px; /*full screen*/
    border: 1px solid #c481fe;
    border-radius: 8px;
    background-color: #e4e4e4;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Top Bar - Character Info */
#top-bar {
    padding: 10px 20px;
    background-color: #2b0050;
    border-bottom: 1px solid #c481fe;
    display: flex; 
    justify-content: space-between; /* Pushes stats left, buttons right */
    align-items: center;
}

.char-info {
    display: flex;
    gap: 25px; /* Space between "Balance" and "Coins" */
    align-items: center;
}

.char-info span {
    line-height: 1.2;
}

.top-bar-button {
    background-color: #4a1a7a;
    color: white;
    border: 1px solid #c481fe;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;    font-family: 'Courier New';
    margin-left: 10px; /* Add some space between buttons */
    transition: background-color 0.2s;
}

.top-bar-button:hover {
    background-color: #6a3a9a;
}

/* --- ADDITION: Style for all disabled buttons --- */
.top-bar-button:disabled,
button:disabled,
button[disabled] {
    background-color: #262626;
    color: #666666;
    cursor: not-allowed;
    border-color: #999999;
}

/* Style for the notification button when there are unread messages */
.top-bar-button.new-notification {
    background-color: #c481fe; /* A brighter, attention-grabbing color */
    border: 1px solid #fff;
    animation: pulse 1.5s infinite; /* Add a subtle pulse to draw attention */
}

/* Marquee Styles */
.event-marquee {
    width: 100%;
    background-color: #330066;
    color: #fff;
    padding: 8px 0;
    font-size: 0.9em;
    white-space: nowrap; /* Prevent text from wrapping */
}

/* Center Bar - Message Area */
#center-bar {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex; /* Use flexbox for layout */
    flex-direction: row; /* Arrange items horizontally */
    flex-wrap: wrap; /* Allow items to wrap to the next line */
    align-content: flex-start; /* Align wrapped lines to the start */
    gap: 15px;
}

.message {
    padding: 15px;
    border-radius: 15px;
    line-height: 1.4;
}

.message p {
    /* This will make the browser respect newline characters (\n) in the text */
    white-space: pre-wrap;
}

.game-message {
    background-color: #2b0050;
    border-bottom-left-radius: 3px;
}

.player-message {
    background-color: #2b0050;
    /* Player-specific alignment is handled by container if needed */
}

.error-message {
    background-color: #430000;
    color: #f0f0f0;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

.note-message {
    background-color: #e4e4e4;
    color: rgb(118, 118, 118);
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

/* Calendar Navigation */
.calendar-navigation {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 20px;
}

/* Styles for the new table-based calendar */
.calendar-container {
    width: 100%;
    background-color: #2b0050;
    padding: 20px;
    border-radius: 15px;
}

.calendar-container h2 {
    text-align: center;
    color: #c481fe;
    margin-bottom: 15px;
}

.calendar-navigation .nav-button {
    background-color: #4a1a7a;
    color: white;
    border: 1px solid #c481fe;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.calendar-table {
    width: 100%;
    table-layout: fixed; /* Ensures columns have equal width */
    border-collapse: collapse;
}

.calendar-table th {
    padding: 10px;
    text-align: center;
    border-bottom: 2px solid #c481fe;
}

.calendar-table td {
    border: 1px solid #4a1a7a;
    height: 100px; /* Give cells a fixed height */
    vertical-align: top; /* Align content to the top */
    position: relative; /* For positioning content inside */
    padding: 4px;
}

.calendar-day .day-number {
    font-size: 0.8em;
    color: #a0a0a0;
}

.calendar-day.current-day {
    background-color: rgba(196, 129, 254, 0.2); /* Highlight current day */
}

.calendar-day.current-day .day-number {
    font-weight: bold;
    color: #e0e0e0;
}

.calendar-day.clickable-day {
    cursor: pointer;
    transition: background-color 0.2s;
}

.day-icon-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 4px; /* Space between icons */
    font-size: 1.8em; /* Slightly smaller to fit both */
    line-height: 1;
}

/* Styles for the Calendar Event Modal */
.calendar-modal {
    position: fixed; /* Sit on top of the page content */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Black background with opacity */
    z-index: 1000; /* Sit on top */
    display: flex;
    justify-content: center;
    align-items: center;
}

.calendar-modal-content {
    background-color: #2b0050;
    padding: 20px;
    border: 1px solid #c481fe;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.calendar-modal-content h4 {
    text-align: center;
    color: #c481fe;
}

.calendar-modal-content #close-modal-btn {
    background-color: #9317ff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    font-family: 'Courier New';
    transition: background-color 0.2s;
    align-self: center;
    margin-top: 10px;
}


.empty-day {
    background-color: rgba(0, 0, 0, 0.2);
}

/* Styles for the detailed coin info view */
.coin-info-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: flex-start;
}

.coin-image {
    width: 144px;
    height: 144px;
    flex-shrink: 0; /* Prevents the image from shrinking */
    background-size: 576px 576px; /* The full size of the sprite sheet */
}

.coin-details {
    flex-grow: 1;
}

/* Styles for inventory list items */
.inventory-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.coin-image-small {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    background-size: 288px 288px; /* 50% of the full 576px sprite sheet */
    border: 0px solid #c481fe;
    border-radius: 50%;
    background-color: #e0e0e0; /* A light background for the coin */
}

.inventory-item-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inventory-item-details button {
    background-color: #9317ff;
    color: white;
    border: none;
    padding: 5px 10px; /* Smaller padding for in-list buttons */
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7em; /* Smaller font size */    font-family: 'Courier New';
    transition: background-color 0.2s;
    align-self: flex-start; /* Align buttons to the start of the flex container */
}

.inventory-item-details button:hover {
    background-color: #c481fe;
}

/* Bottom Bar - Player Input */
#bottom-bar {
    display: flex;
    padding: 10px;
    gap: 10px; /* Adds space between buttons */
    justify-content: center; /* Center the buttons */
    border-top: 1px solid #c481fe;
    background-color: #2b0050;
}

#bottom-bar button {
    background-color: #9317ff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;    font-family: 'Courier New';
    transition: background-color 0.2s;
}

#bottom-bar button:hover {
    background-color: #c481fe;
}

/* Styles for the sorting controls container */
.sort-controls {
    flex-basis: 100%; /* Ensures the container takes the full width, pushing items below */
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 15px;
    margin-bottom: 10px;
    border-bottom: 1px solid #9637f5;
}

.sort-controls span {
    font-style: italic;
    color: #4a1a7a;
}

.sort-controls button {
    background-color: #c481fe;
    font-size: 0.75em;
    padding: 4px 8px;
    border: 1px solid #c481fe;
}

.active-filter {
    background-color: #c481fe !important; /* Ensure it overrides hover */
    border: 1px solid #fff !important;
}

/* Style for the NPC bank display */
.npc-bank-display {
    flex-basis: 100%;
    text-align: center;
    padding: 5px;
    margin-bottom: 10px;
    background-color: #261039;
    border-radius: 4px;
}

/* Styles for the Collection Checklist view */
.checklist-series-container {
    flex-basis: 100%;
    margin-bottom: 20px;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.checklist-series-container h3 {
    color: #c481fe;
    border-bottom: 1px solid #4a1a7a;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.checklist-coins-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checklist-coin {
    position: relative; /* Needed for positioning child elements */
    width: 72px;
    height: 72px;
    background-size: 288px 288px;
    border-radius: 50%;
    transition: opacity 0.3s ease;
    cursor: help; /* Indicates more info is available on hover */
}

.checklist-coin-count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black; /* Makes text readable on any background */
    pointer-events: none; /* Prevents the text from interfering with clicks on the coin */
}

.checklist-coin.missing {
    opacity: 0.15;
    background-color: #e0e0e0; /* Give it a slight background so the shape is visible */
}

.checklist-coin.missing:hover {
    opacity: 0.4; /* Make it slightly more visible on hover */
}

/* Animation for the notification button */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(228, 228, 228, 0.4);
    }
    70% {
        box-shadow: 0 0 0 1000px rgba(228, 228, 228, 0);
    }
}
