/* ============================================================
   EURUS - Time Loop RPG Styles
   Medieval fantasy theme with dark atmosphere
   ============================================================ */

/* === CSS Variables === */
:root {
    --bg-dark: #1a1a1f;
    --bg-panel: #252530;
    --bg-hover: #2d2d3a;
    --bg-modal: rgba(0, 0, 0, 0.85);

    --text-primary: #e8e6e3;
    --text-secondary: #a0a0a0;
    --text-muted: #666;

    --accent-gold: #c9a227;
    --accent-blue: #4a7c9b;
    --accent-green: #4a8c5a;
    --accent-red: #8c4a4a;

    --border-color: #3a3a45;
    --border-light: #4a4a55;

    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-strong: 0 4px 16px rgba(0, 0, 0, 0.5);

    --font-main: 'Segoe UI', system-ui, sans-serif;
    --font-heading: Georgia, 'Times New Roman', serif;
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    min-height: 100vh;
}

/* === Game Container === */
#game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 100vh;
}

/* === Header === */
#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.header-left, .header-center, .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.day-display {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--accent-gold);
}

.season-display {
    color: var(--text-secondary);
    font-style: italic;
}

.cycle-display {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-primary);
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.btn-icon:hover {
    background: var(--bg-hover);
    border-color: var(--accent-gold);
}

/* === Main Area === */
#main-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    flex: 1;
}

#left-panel, #right-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* === Sections === */
section {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
}

h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--accent-gold);
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === Villager Info === */
#villager-info {
    text-align: center;
    padding: 1.5rem;
}

#villager-info h2 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.profession-title {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 1.1rem;
}

/* === Resources === */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
}

.resource-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--bg-dark);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.resource-name {
    color: var(--text-secondary);
    text-transform: capitalize;
    font-size: 0.9rem;
}

.resource-value {
    color: var(--accent-gold);
    font-weight: bold;
}

/* === Discoveries === */
.discovery-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.discovery-tier {
    margin-bottom: 0.5rem;
}

.discovery-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    background: var(--bg-dark);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.discovery-item.unlocked {
    border-color: var(--accent-gold);
    background: rgba(201, 162, 39, 0.1);
}

.discovery-name {
    font-size: 0.9rem;
}

.discovery-progress {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-gold);
    transition: width 0.3s ease;
}

/* === Activity Log === */
#activity-log {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.log-entries {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.log-entry {
    padding: 0.5rem;
    background: var(--bg-dark);
    border-radius: 4px;
    font-size: 0.9rem;
    border-left: 3px solid var(--border-color);
}

.log-entry .log-day {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.log-decision { border-left-color: var(--accent-blue); }
.log-discovery { border-left-color: var(--accent-gold); }
.log-replay { border-left-color: var(--text-muted); opacity: 0.8; }
.log-effect { border-left-color: var(--accent-green); }
.log-error { border-left-color: var(--accent-red); }
.log-cycle { border-left-color: var(--accent-gold); font-style: italic; }

/* === Timeline === */
#timeline {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.timeline-track {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.track-label {
    width: 150px;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-bar {
    flex: 1;
    height: 20px;
    background: var(--bg-dark);
    border-radius: 4px;
    position: relative;
    border: 1px solid var(--border-color);
}

.day-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent-gold);
    z-index: 2;
}

.event-marker {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--accent-blue);
    border-radius: 50%;
    z-index: 1;
}

.timeline-track.past .event-marker {
    background: var(--text-muted);
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-modal);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-strong);
}

.modal-content h2 {
    font-size: 1.75rem;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--accent-gold);
}

/* === Decision Modal === */
.decision-description {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

.decision-day {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.choice-btn {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    color: var(--text-primary);
}

.choice-btn:hover:not(.disabled) {
    border-color: var(--accent-gold);
    background: var(--bg-hover);
}

.choice-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.choice-label {
    font-weight: bold;
    font-size: 1.1rem;
}

.choice-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.choice-cost {
    color: var(--accent-gold);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* === Profession Select === */
.profession-select {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profession-btn {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    color: var(--text-primary);
}

.profession-btn:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.prof-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.prof-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* === Narrative Text === */
.intro-narrative,
.death-narrative,
.soul-narrative,
.victory-narrative {
    text-align: center;
    margin-bottom: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.cycle-summary {
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: 4px;
    margin: 1.5rem 0;
    text-align: center;
}

.cycle-summary h3 {
    border: none;
    margin-bottom: 0.5rem;
}

.victory-stats {
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: 4px;
    margin: 1.5rem 0;
    text-align: center;
}

/* === Buttons === */
.btn-primary {
    display: block;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--accent-gold);
    color: var(--bg-dark);
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.btn-primary:hover {
    background: #ddb830;
}

.btn-secondary {
    display: block;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* === Notifications === */
#notifications {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 2000;
    pointer-events: none;
}

.notification {
    background: var(--bg-panel);
    border: 1px solid var(--accent-gold);
    border-radius: 4px;
    padding: 1rem;
    min-width: 250px;
    box-shadow: var(--shadow-strong);
    animation: slideIn 0.3s ease;
}

.notification.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

.notif-title {
    font-weight: bold;
    color: var(--accent-gold);
    margin-bottom: 0.25rem;
}

.notif-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* === Responsive === */
@media (max-width: 768px) {
    #main-area {
        grid-template-columns: 1fr;
    }

    #header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-center {
        order: -1;
        width: 100%;
        justify-content: center;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .track-label {
        width: 100px;
        font-size: 0.75rem;
    }
}
