/* MyMyst Game Styles */

/* ===== CSS Variables ===== */
:root {
    --color-bg: #1a1a2e;
    --color-bg-dark: #0f0f1a;
    --color-primary: #e94560;
    --color-secondary: #16213e;
    --color-text: #eaeaea;
    --color-text-dim: #888;
    --color-overlay: rgba(0, 0, 0, 0.85);
    --color-hotspot: rgba(255, 255, 255, 0.1);
    --color-hotspot-hover: rgba(233, 69, 96, 0.3);

    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-title: Georgia, 'Times New Roman', Times, serif;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--color-bg-dark);
    font-family: var(--font-main);
    color: var(--color-text);
}

/* ===== Game Container ===== */
#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: var(--color-bg);
}

/* ===== Screens ===== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen.hidden {
    display: none;
}

/* ===== Loading Screen ===== */
#loading-screen {
    background: var(--color-bg);
}

.loading-content {
    text-align: center;
}

.loading-content h1 {
    font-family: var(--font-title);
    font-size: 4rem;
    margin-bottom: 2rem;
    color: var(--color-primary);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-secondary);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Main Menu ===== */
#main-menu {
    background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-dark) 100%);
}

.menu-content {
    text-align: center;
    padding: 2rem;
    background: var(--color-overlay);
    border-radius: 10px;
    min-width: 300px;
}

.menu-content h1 {
    font-family: var(--font-title);
    font-size: 3.5rem;
    margin-bottom: 2rem;
    color: var(--color-primary);
}

.menu-content h2 {
    font-family: var(--font-title);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.menu-buttons button {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-family: var(--font-main);
    background: var(--color-secondary);
    color: var(--color-text);
    border: 2px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.menu-buttons button:hover:not(:disabled) {
    background: var(--color-primary);
    transform: translateY(-2px);
}

.menu-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Game Screen ===== */
#game-screen {
    background: #000;
}

/* Scene Container */
#scene-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scene-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

#hotspot-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

#hotspot-overlay > * {
    pointer-events: auto;
    fill: var(--color-hotspot);
    stroke: none;
    cursor: pointer;
    transition: fill var(--transition-fast);
}

#hotspot-overlay > *:hover {
    fill: var(--color-hotspot-hover);
}

/* Hotspot cursor types */
#hotspot-overlay .cursor-forward { cursor: n-resize; }
#hotspot-overlay .cursor-back { cursor: s-resize; }
#hotspot-overlay .cursor-left { cursor: w-resize; }
#hotspot-overlay .cursor-right { cursor: e-resize; }
#hotspot-overlay .cursor-hand { cursor: pointer; }
#hotspot-overlay .cursor-eye { cursor: zoom-in; }
#hotspot-overlay .cursor-grab { cursor: grab; }

/* ===== UI Overlay ===== */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#ui-overlay > * {
    pointer-events: auto;
}

/* Top Bar */
#top-bar {
    display: flex;
    justify-content: flex-end;
    padding: 1rem;
}

.ui-button {
    width: 50px;
    height: 50px;
    background: var(--color-overlay);
    border: 2px solid var(--color-secondary);
    border-radius: 5px;
    color: var(--color-text);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ui-button:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

#btn-audio {
    margin-right: 0.5rem;
}

#btn-audio.audio-muted {
    animation: pulse-audio 2s ease-in-out infinite;
    border-color: #ff6b6b;
}

#btn-audio.audio-playing {
    border-color: #51cf66;
}

@keyframes pulse-audio {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Inventory Bar */
#inventory-bar {
    background: linear-gradient(to top, var(--color-overlay), transparent);
    padding: 1rem;
    min-height: 100px;
}

#inventory-items {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.inventory-item {
    width: 70px;
    height: 70px;
    background: var(--color-secondary);
    border: 2px solid var(--color-text-dim);
    border-radius: 5px;
    padding: 5px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.inventory-item:hover {
    border-color: var(--color-primary);
    transform: translateY(-5px);
}

.inventory-item.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 15px var(--color-primary);
}

.inventory-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== Overlays ===== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

/* Dialogue Box */
#dialogue-box {
    max-width: 800px;
    width: 90%;
    background: var(--color-secondary);
    border: 2px solid var(--color-text-dim);
    border-radius: 10px;
    padding: 2rem;
}

#dialogue-text {
    font-size: 1.3rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

#dialogue-choices {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dialogue-choice {
    padding: 1rem;
    background: var(--color-bg);
    border: 2px solid var(--color-text-dim);
    border-radius: 5px;
    color: var(--color-text);
    font-size: 1.1rem;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dialogue-choice:hover {
    border-color: var(--color-primary);
    background: var(--color-secondary);
}

/* Examine Overlay */
#examine-content {
    text-align: center;
    max-width: 600px;
}

#examine-image {
    max-width: 100%;
    max-height: 50vh;
    border-radius: 10px;
    margin-bottom: 1rem;
}

#examine-text {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

#btn-close-examine {
    padding: 0.75rem 2rem;
    background: var(--color-primary);
    border: none;
    border-radius: 5px;
    color: var(--color-text);
    font-size: 1rem;
    cursor: pointer;
}

/* Modal */
.modal-content {
    background: var(--color-secondary);
    border-radius: 10px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
}

.modal-content h2 {
    font-family: var(--font-title);
    margin-bottom: 1.5rem;
    text-align: center;
}

#save-slots {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.save-slot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--color-bg);
    border: 2px solid var(--color-text-dim);
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.save-slot:hover {
    border-color: var(--color-primary);
}

.save-slot-info {
    text-align: left;
}

.save-slot-name {
    font-weight: bold;
}

.save-slot-date {
    font-size: 0.85rem;
    color: var(--color-text-dim);
}

#btn-close-modal {
    width: 100%;
    padding: 0.75rem;
    background: var(--color-bg);
    border: 2px solid var(--color-text-dim);
    border-radius: 5px;
    color: var(--color-text);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

#btn-close-modal:hover,
#btn-close-settings:hover {
    border-color: var(--color-primary);
}

#btn-close-settings {
    width: 100%;
    padding: 0.75rem;
    background: var(--color-bg);
    border: 2px solid var(--color-text-dim);
    border-radius: 5px;
    color: var(--color-text);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 1.5rem;
}

/* Settings Modal */
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--color-bg);
    border-radius: 5px;
    cursor: pointer;
}

.setting-row span {
    font-size: 1rem;
}

.setting-row input[type="range"] {
    width: 120px;
    accent-color: var(--color-primary);
}

.setting-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
}

.setting-row select {
    padding: 0.5rem;
    background: var(--color-secondary);
    border: 1px solid var(--color-text-dim);
    border-radius: 4px;
    color: var(--color-text);
    font-size: 0.9rem;
}

/* ===== Transition Overlay ===== */
#transition-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    pointer-events: none;
    opacity: 0;
    z-index: 200;
    transition: opacity var(--transition-slow);
}

#transition-overlay.active {
    opacity: 1;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .menu-content h1 {
        font-size: 2.5rem;
    }

    .inventory-item {
        width: 55px;
        height: 55px;
    }

    #dialogue-box {
        padding: 1.5rem;
    }

    #dialogue-text {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .menu-content h1 {
        font-size: 2rem;
    }

    .menu-buttons button {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .inventory-item {
        width: 45px;
        height: 45px;
    }

    #inventory-bar {
        min-height: 70px;
        padding: 0.5rem;
    }
}
