/* src/styles/main.css */

:root {
    /* Palette */
    --c-bg: #121212;
    --c-bg-panel: #1e1e1e;
    --c-text: #e0e0e0;
    --c-text-dim: #a0a0a0;
    --c-accent: #c0a060;
    /* Muted gold */
    --c-accent-hover: #d0b070;
    --c-danger: #8b0000;
    /* Blood red */
    --c-border: #333;

    /* Typography */
    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    background-color: var(--c-bg-panel);
    width: 100%;
    max-width: 800px;
    height: 100%;
    /* Mobile full height */
    max-height: 900px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--c-border);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
}

#game-container.hidden {
    display: none;
}

/* TOP BAR */
#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--c-border);
    background: #181818;
}

.stat-group {
    display: flex;
    gap: 1rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--c-accent);
}

#inventory-btn {
    background: transparent;
    border: 1px solid var(--c-accent);
    color: var(--c-accent);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.2s;
}

#inventory-btn:hover {
    background: var(--c-accent);
    color: var(--c-bg);
}

/* MAIN DISPLAY */
#main-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem;
    gap: 1rem;
}

#image-area {
    width: 100%;
    height: 200px;
    background: #000;
    border: 1px solid var(--c-border);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    overflow: hidden;
    /* Ensure image doesn't spill out */
    position: relative;
}

.location-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: fadeIn 1s ease;
}

.combat-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #ff5555;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 1.2rem;
    border: 1px solid #ff0000;
    pointer-events: none;
    z-index: 10;
}

.placeholder-art {
    color: var(--c-text-dim);
    font-style: italic;
}

#narrative-log {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding-right: 0.5rem;
    font-size: 1rem;
    line-height: 1.6;
}

.log-entry {
    animation: fadeIn 0.5s ease;
}

.log-combat {
    color: #ffaaaa;
}

.log-loot {
    color: #ffd700;
}

/* ACTION AREA */
#action-area {
    padding: 1rem;
    border-top: 1px solid var(--c-border);
    background: #181818;
    min-height: 150px;
    max-height: 50vh;
    /* Allow it to grow but cap it */
    overflow-y: auto;
    /* Scroll if content exceeds height */
    display: flex;
    flex-direction: column;
}

#choice-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.choice-btn {
    background: var(--c-bg-panel);
    border: 1px solid var(--c-border);
    color: var(--c-text);
    padding: 1rem;
    text-align: left;
    cursor: pointer;
    font-family: var(--font-body);
    transition: border-color 0.2s, background 0.2s;
}

.choice-btn:hover {
    border-color: var(--c-accent);
    background: #252525;
}

/* MODALS */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(145deg, #1a1a1a, #0d0d0d);
    padding: 2rem;
    border: 2px solid var(--c-accent);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 50px rgba(0, 0, 0, 0.5);
    width: 95%;
    max-width: 800px;
    max-height: 90%;
    overflow-y: auto;
    text-align: left;
    color: var(--c-text);
    display: grid;
    grid-template-areas:
        "header header"
        "equip   bag"
        "footer  footer";
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    border-radius: 4px;
}

.modal-content h2 {
    grid-area: header;
    text-align: center;
    font-family: 'Cinzel', serif;
    color: var(--c-accent);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid var(--c-border);
    padding-bottom: 1rem;
    margin-bottom: 0;
}

#equipment-slots {
    grid-area: equip;
    border-right: 1px solid var(--c-border);
    padding-right: 1rem;
}

#equipment-slots h3,
#inventory-list h3 {
    font-family: 'Cinzel', serif;
    color: #a0a0a0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    text-transform: uppercase;
}

#inventory-list {
    grid-area: bag;
}

#close-inventory {
    grid-area: footer;
    margin-top: 1rem;
    background: transparent;
    border: 1px solid var(--c-accent);
    color: var(--c-accent);
    padding: 12px;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    transition: all 0.2s;
    width: 100%;
    text-transform: uppercase;
}

#close-inventory:hover {
    background: var(--c-accent);
    color: #000;
    box-shadow: 0 0 15px var(--c-accent);
}

/* Item Slots */
.item-slot {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--c-border);
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-slot.equipped {
    border-color: #ffd700;
    background: rgba(212, 175, 55, 0.1);
}

.choice-btn.inventory-item {
    width: 100%;
    margin-bottom: 0.5rem;
    text-align: left;
    border: 1px solid #444;
    background: #222;
}

.choice-btn.inventory-item:hover {
    border-color: var(--c-accent);
    background: #333;
}

@media (max-width: 600px) {
    .modal-content {
        grid-template-areas:
            "header"
            "equip"
            "bag"
            "footer";
        grid-template-columns: 1fr;
    }

    #equipment-slots {
        border-right: none;
        border-bottom: 1px solid var(--c-border);
        padding-bottom: 1rem;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (min-width: 800px) {
    #game-container {
        margin-top: 2rem;
        margin-bottom: 2rem;
        height: 90vh;
    }
}

.start-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #111 0%, #000 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 1.2s ease;
}

.start-content {
    text-align: center;
    color: #d4af37;
    animation: riseUp 1.5s ease forwards;
}

.game-title {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    letter-spacing: 3px;
    margin-bottom: 1rem;
}

.game-subtitle {
    color: #b0b0b0;
    margin-bottom: 2rem;
}

.start-buttons button {
    background: transparent;
    border: 1px solid #d4af37;
    color: #d4af37;
    padding: 12px 28px;
    margin: 0 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-buttons button:hover {
    background: #d4af37;
    color: #000;
}

.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes riseUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stat Bars */
.stats-bars {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-grow: 1;
}

.stat-container {
    width: 200px;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 2px;
    color: var(--c-text-dim);
}

.stat-bar {
    height: 10px;
    background: #222;
    border: 1px solid #444;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    transition: width 0.3s ease-out;
}

.hp-fill {
    background: linear-gradient(90deg, #c0392b, #e74c3c);
    box-shadow: 0 0 10px #c0392b;
}

.xp-fill {
    background: linear-gradient(90deg, #2980b9, #3498db);
    box-shadow: 0 0 10px #2980b9;
}

.gold-container {
    margin-left: auto;
    font-weight: bold;
    color: var(--c-accent);
}