
/* Reset basic styles */
body, h1, h2, h3, p, button, ul, select, input {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

ul {
    list-style: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f0f0;
    color: #333;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top for longer content */
    min-height: 100vh;
    padding: 20px;
}

#app-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 900px; /* Increased max-width for more content */
}

header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

header h1 {
    color: #333;
    font-size: 2em;
}

#game-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#top-row {
    display: grid;
    grid-template-areas: "message sidebar";
    grid-template-columns: 2fr 1fr; /* Message area wider */
    gap: 20px;
}

#message-area {
    grid-area: message;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

#message-area p { margin-bottom: 10px; }
#message-area p:last-child { margin-bottom: 0; }
#message-area p.message-info { color: #31708f; }
#message-area p.message-event { color: #555; font-style: italic; }
#message-area p.message-damage { color: #a94442; font-weight: bold; }
#message-area p.message-heal { color: #3c763d; font-weight: bold; }
#message-area p.message-combat { color: #d9534f; font-weight: bold; }
#message-area p.message-victory { color: #5cb85c; font-weight: bold; }


#sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#player-info {
    background-color: #e9f7ef;
    border: 1px solid #c8e6c9;
    border-radius: 5px;
    padding: 15px;
}

#player-info h2 {
    font-size: 1.2em;
    color: #2e7d32;
    margin-bottom: 10px;
    border-bottom: 1px solid #a5d6a7;
    padding-bottom: 5px;
}

#player-stats p { margin-bottom: 5px; font-size: 0.95em; }
#player-stats span { font-weight: bold; }

#action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#action-buttons button, .shop-item button, .inventory-item button, #combat-actions button, #map-select,
#data-management-area button, #data-management-area input[type="text"] {
    background-color: #4CAF50; /* Green for general actions */
    color: white;
    border: 1px solid transparent; /* Added for consistency with input */
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    font-size: 0.95em;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease, border-color 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#data-management-area input[type="text"] {
    color: #333;
    background-color: #fff;
    border: 1px solid #ccc;
}
#data-management-area input[type="text"]:focus {
    border-color: #4CAF50;
    outline: 2px solid #76c779;
    outline-offset: 0;
}


#map-select {
    width: 100%;
    background-color: #fff; /* Select usually has white background */
    color: #333;
    border: 1px solid #ccc;
}
#map-select:focus {
    border-color: #4CAF50;
    outline: 2px solid #76c779;
    outline-offset: 0;
}


.shop-item button {
    background-color: #007bff; /* Blue for buy buttons */
}
.shop-item button:hover {
    background-color: #0069d9;
}
.shop-item button:disabled, 
#action-buttons button:disabled, 
#combat-actions button:disabled,
.inventory-item button:disabled,
#data-management-area button:disabled {
    background-color: #aaa;
    cursor: not-allowed;
    opacity: 0.7;
}


.inventory-item button {
    background-color: #ffc107; /* Yellow for use buttons */
    color: #333;
    margin-left: 10px;
}
.inventory-item button:hover:not(:disabled) {
    background-color: #e0a800;
}


#action-buttons button:hover:not(:disabled) { background-color: #45a049; }
#action-buttons button:active:not(:disabled),
.shop-item button:active:not(:disabled),
.inventory-item button:active:not(:disabled),
#combat-actions button:active:not(:disabled),
#data-management-area button:active:not(:disabled) {
    transform: translateY(1px);
}


#combat-area {
    background-color: #fceaea; /* Light red for combat area */
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    padding: 15px;
}
#combat-area h2 {
    font-size: 1.3em;
    color: #721c24; /* Dark red for combat title */
    margin-bottom: 10px;
    border-bottom: 1px solid #f5c6cb;
    padding-bottom: 8px;
}
#enemy-info-display p {
    margin-bottom: 5px;
    font-size: 0.95em;
}
#enemy-info-display span {
    font-weight: bold;
}

#combat-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

#combat-actions #attack-button {
    background-color: #d9534f; /* Red for attack */
}
#combat-actions #attack-button:hover:not(:disabled) {
    background-color: #c9302c;
}
#combat-actions #run-button {
    background-color: #5bc0de; /* Info blue for run */
}
#combat-actions #run-button:hover:not(:disabled) {
    background-color: #31b0d5;
}

#map-list-area { /* Renamed in HTML but style might be for section containing select */
    background-color: #e7f3fe;
    border: 1px solid #b3d7f7;
    border-radius: 5px;
    padding: 15px;
}
#map-list-area h2 {
    font-size: 1.3em;
    color: #004085;
    margin-bottom: 15px;
    border-bottom: 1px solid #b3d7f7;
    padding-bottom: 8px;
}

#bottom-row {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

#inventory-area, #shop-area {
    flex: 1; /* Make inventory and shop share space */
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    min-width: 300px; /* Ensure they don't get too squished */
}

#inventory-area h2, #shop-area h2 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

#equipped-items {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
}
#equipped-items h3 {
    font-size: 1em;
    color: #555;
    margin-bottom: 5px;
}
#equipped-items p {
    font-size: 0.9em;
}

#inventory-list li {
    padding: 8px 5px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#inventory-list li:last-child {
    border-bottom: none;
}

.shop-item {
    border: 1px solid #e0e0e0;
    background-color: #fdfdfd;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.shop-item-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.shop-item-info p {
    font-size: 0.9em;
    color: #555;
    margin-top: 3px;
}

.shop-item strong {
    font-size: 1.05em;
}

#data-management-area {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    margin-top: 20px;
}

#data-management-area h2 {
    font-size: 1.3em;
    color: #495057;
    margin-bottom: 15px;
    border-bottom: 1px solid #ced4da;
    padding-bottom: 8px;
}

#data-management-area .data-control-group {
    margin-bottom: 15px;
}

#data-management-area .data-control-group input[type="text"] {
    margin-right: 10px;
    padding: 8px 12px; /* Slightly smaller padding for input */
    min-width: 200px;
}

#data-management-area .data-control-group button {
     background-color: #6c757d; /* Grey for save/load actions */
}
#data-management-area .data-control-group button:hover:not(:disabled) {
    background-color: #5a6268;
}

#load-slots-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}
#load-slots-list li:last-child {
    border-bottom: none;
}
#load-slots-list button {
    background-color: #17a2b8; /* Info blue for load slot button */
    font-size: 0.9em;
    padding: 6px 12px;
}
#load-slots-list button:hover:not(:disabled) {
    background-color: #138496;
}
#no-saves-found {
    font-style: italic;
    color: #6c757d;
}


footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 0.9em;
    color: #777;
}

button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) { /* Adjusted breakpoint */
    #top-row {
        grid-template-areas:
            "message"
            "sidebar";
        grid-template-columns: 1fr;
    }
    #sidebar {
      flex-direction: column; 
    }
    #action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    #action-buttons button {
        flex-grow: 1;
        min-width: 120px;
    }
    #combat-actions {
        flex-direction: column;
    }
    #combat-actions button {
        width: 100%;
    }
    .shop-item-details {
        flex-direction: column;
        align-items: flex-start;
    }
    .shop-item button {
        margin-top: 10px;
        width: 100%;
    }
    #bottom-row {
        flex-direction: column;
    }
    #data-management-area .data-control-group {
        display: flex;
        flex-direction: column;
    }
    #data-management-area .data-control-group input[type="text"] {
        margin-right: 0;
        margin-bottom: 10px;
        width: 100%;
    }
     #data-management-area .data-control-group button {
        width: 100%;
    }
}
