/**
 * Engine Base CSS
 * Core styling for the survival game engine
 */

/* Container layouts */
.game-container {
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    min-height: 500px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Change game-stats to overlay on top of game-content */
.game-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    z-index: 10;
    padding: 10px 0;
}

.game-content {
    flex-grow: 1;
    position: relative;
    min-height: 250px;
    padding: 20px;
    margin-bottom: 20px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    overflow: hidden;
    /* Adjust top padding to account for stats */
    padding-top: 70px;
}

.game-mini-game {
    display: none;
    flex-grow: 1;
    min-height: 300px;
    padding: 20px;
    background-color: #f7f7f7;
    border-radius: 8px;
}

.game-choices {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid #ddd;
}

/* Resources display */
.resource-display {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    background-color: rgba(240, 240, 240, 0.85);
    border-radius: 4px;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    /* Make sure no bottom margin so no line break */
    margin-bottom: 0;
}

.resource-icon {
    width: 20px;
    height: 20px;
    margin-right: 5px;
}

.resource-name {
    margin-right: 5px;
    font-weight: bold;
}

.resource-value {
    color: #444;
}

.resource-max {
    color: #777;
    font-size: 12px;
}

/* Stage content */
.stage-title {
    margin-top: 0;
    margin-bottom: 15px;
    color: #222;
}

.stage-content {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Choice buttons */
.choices-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-button {
    padding: 12px 20px;
    background-color: #3a7ca5;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: left;
}

.choice-button:hover {
    background-color: #2c6084;
}

.choice-button:active {
    background-color: #1d4058;
}

/* Control buttons */
.game-control-button {
    padding: 8px 15px;
    background-color: #6c757d;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.game-control-button:hover {
    background-color: #5a6268;
}

/* Game events */
.game-event {
    position: absolute;
    top: 20px;
    right: 20px;
    max-width: 300px;
    background-color: #4a5568;
    color: white;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 5;
    animation: slide-in 0.3s ease-out;
}

.game-event h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 18px;
}

.game-event p {
    margin: 0;
    font-size: 14px;
}

.game-event.fade-out {
    animation: fade-out 1s ease-in forwards;
}

/* Mini game results */
.mini-game-results-container {
    max-width: 600px;
    margin: 0 auto;
}

.game-results {
    margin-bottom: 20px;
}

.positive-change {
    color: #38a169;
}

.negative-change {
    color: #e53e3e;
}

.penalty-message {
    background-color: #fed7d7;
    color: #c53030;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
}

.resources-gained {
    margin-top: 15px;
}

.resources-gained ul {
    margin: 5px 0;
    padding-left: 20px;
}

/* Resource feedback styling */
.resource-feedback {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
}

.resource-changes {
    margin: 5px 0;
}

.resource-changes ul {
    list-style: none;
    padding-left: 10px;
    margin: 5px 0;
}

.resource-changes.positive li::before {
    content: "▲ ";
    color: #38a169;
}

.resource-changes.negative li::before {
    content: "▼ ";
    color: #e53e3e;
}

.event-resource-changes {
    margin-top: 10px;
    font-size: 14px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 5px;
}

.game-event .resource-changes.positive li {
    color: #b9f6ca;
}

.game-event .resource-changes.negative li {
    color: #ffcdd2;
}

/* Inventory and Journal panels */
.game-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 500px;
    max-height: 80vh;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 100;
    padding: 20px;
    display: none;
    overflow-y: auto;
}

.panel-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #555;
}

.panel-close-btn:hover {
    color: #000;
}

/* Inventory specific */
.inventory-panel h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.inventory-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.inventory-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.inventory-item:last-child {
    border-bottom: none;
}

.item-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

.item-name {
    flex: 1;
}

.item-quantity {
    font-weight: bold;
    color: #555;
}

.empty-inventory {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Journal specific */
.journal-panel h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.journal-entries {
    max-height: 60vh;
    overflow-y: auto;
}

.journal-day {
    font-weight: bold;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
    margin-top: 10px;
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 1;
}

.journal-day-entries {
    padding: 5px 0 15px 0;
}

.journal-entry {
    padding: 8px 5px;
    border-left: 3px solid transparent;
    margin-bottom: 5px;
}

.resource-entry {
    border-left-color: #3498db;
}

.inventory-entry {
    border-left-color: #f39c12;
}

.empty-journal {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Animations */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slide-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slide-left {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slide-right {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes wave {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

@keyframes dust-storm {
    0% { opacity: 0.2; }
    50% { opacity: 0.7; }
    100% { opacity: 0.2; }
}

/* Animation classes */
.animation.fade-in {
    animation: fade-in 2s;
}

.animation.slide-left {
    animation: slide-left 3s;
}

.animation.slide-right {
    animation: slide-right 3s;
}

.animation.wave {
    animation: wave 4s infinite;
}

.animation.dust-storm {
    animation: dust-storm 4s;
}

/* Error display */
.error-container {
    padding: 20px;
    background-color: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 4px;
}

.error-details {
    font-family: monospace;
    background-color: #eee;
    padding: 10px;
    overflow-x: auto;
}

/* Message modal */
.message-modal {
    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: 1000;
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    max-width: 500px;
    text-align: center;
}

/* Debug panel */
.debug-panel {
    background-color: #f8f9fa;
    border: 2px solid #6c757d;
}

.debug-panel h2 {
    color: #343a40;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
}

.debug-games-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.debug-game-button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.debug-game-button:hover {
    background-color: #dee2e6;
}

.debug-game-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.debug-game-desc {
    font-size: 12px;
    color: #6c757d;
}

/* Mini-game buttons in controls */
.mini-game-button {
    background-color: #28a745 !important;
}

.mini-game-button:hover {
    background-color: #218838 !important;
}

/* Debug button */
.debug-button {
    background-color: #dc3545 !important;
}

.debug-button:hover {
    background-color: #c82333 !important;
}

/* Debug Controls */
.debug-controls {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.debug-button {
    background-color: #9c27b0;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    margin-left: 5px;
}

.debug-panel {
    position: fixed;
    top: 60px;
    right: 10px;
    background-color: rgba(20, 20, 20, 0.9);
    border: 1px solid #9c27b0;
    border-radius: 5px;
    padding: 15px;
    width: 300px;
    max-height: 80vh;
    overflow-y: auto;
    color: white;
    z-index: 1000;
    box-shadow: 0 0 15px rgba(156, 39, 176, 0.5);
}

.debug-panel.hidden {
    display: none;
}

.debug-panel h2 {
    margin-top: 0;
    color: #9c27b0;
    border-bottom: 1px solid #9c27b0;
    padding-bottom: 10px;
}

.debug-panel h3 {
    margin-top: 15px;
    color: #ba68c8;
}

.debug-section {
    margin-bottom: 20px;
}

.debug-list {
    list-style-type: none;
    padding: 0;
}

.debug-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 5px;
    border-bottom: 1px solid rgba(156, 39, 176, 0.3);
}

.debug-list button {
    background-color: #673ab7;
    color: white;
    border: none;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
}

.debug-list button:hover {
    background-color: #9c27b0;
}

/* Debug Mini-games Panel */
.debug-minigames-panel {
    width: 90%;
    max-width: 600px;
    background-color: #343a40;
    color: white;
    border: 2px solid #6c757d;
}

.debug-minigames-panel h2 {
    color: #f8f9fa;
    border-bottom: 1px solid #6c757d;
    padding-bottom: 10px;
    margin-top: 0;
}

/* Debug button in game controls */
.game-control-button.debug-button {
    background-color: #9c27b0;
}

.game-control-button.debug-button:hover {
    background-color: #7b1fa2;
}

/* Mini-game integration in main content area */
.mini-game-header {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 5px;
    text-align: center;
}

.mini-game-header h2 {
    margin-top: 0;
    margin-bottom: 5px;
    color: #333;
}

.mini-game-instructions {
    background-color: rgba(255, 255, 255, 0.85);
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 5px;
    border-left: 4px solid #3182ce;
}

.mini-game-wrapper {
    background-color: transparent;
    width: 100%;
    height: 100%;
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

.mini-game-results {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    margin-top: 20px;
    border-radius: 8px;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.mini-game-results h2 {
    color: #2c5282;
    margin-top: 0;
    margin-bottom: 15px;
}

.mini-game-results .result-message {
    margin-bottom: 20px;
}

.mini-game-results .penalty-message {
    background-color: #fed7d7;
    color: #c53030;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

.mini-game-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 600px;
    margin: 20px auto;
}

/* Transparent background for content - don't override the background image! */
.transparent-bg {
    position: relative;
    /* Note: we're not changing background-image here, it's set inline with !important */
}

/* Add semi-transparent overlay for readability */
.transparent-bg::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.25); /* More transparent */
    border-radius: 8px;
    z-index: 0; /* Lower than content */
}

/* Ensure the stage content is properly transparent with good readability */
.transparent-bg .stage-content {
    background-color: rgba(255, 255, 255, 0.85);
    position: relative;
    z-index: 1;
}

/* Rest of CSS remains unchanged */
