/* Minecraft-style fonts */
@font-face {
    font-family: "MinecraftFont";
    src: url("../assets/fonts/minecraft.woff2") format("woff2");
    font-display: swap;
}

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

body,
html {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #0a0a1a;
    font-family: "MinecraftFont", monospace, sans-serif;
    width: 100%;
    height: 100%;
    user-select: none;
}

/* Loading screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #0a0a1a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-screen h1 {
    color: #ffaa00;
    font-size: 36px;
    margin-bottom: 20px;
    text-shadow: 3px 3px 0 #000;
    text-align: center;
}

.loading-container {
    width: 300px;
    padding: 10px;
    background-color: #333;
    border: 4px solid #5a5a5a;
}

.loading-bar {
    height: 30px;
    background-color: #222;
    border: 2px solid #5a5a5a;
    position: relative;
}

.loading-bar .progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: #ffaa00;
    width: 0%;
    transition: width 0.2s ease-in-out;
}

#loading-message {
    margin-top: 20px;
    color: #aaa;
    font-size: 16px;
}

/* Game container */
.game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* HUD elements */
.hud-element {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid #5a5a5a;
    padding: 5px;
    color: white;
    image-rendering: pixelated;
}

/* Stats panel */
.stats-panel {
    top: 10px;
    left: 10px;
    font-size: 14px;
    min-width: 150px;
}

.stats-panel h3 {
    margin: 0;
    padding: 0;
    color: #ffaa00;
    font-size: 16px;
    text-align: center;
    border-bottom: 2px solid #5a5a5a;
    padding-bottom: 5px;
    margin-bottom: 5px;
}

.stats-panel div {
    margin: 3px 0;
}

.stats-panel .stat-value {
    color: #ffaa00;
    float: right;
}

/* Hotbar */
.hotbar {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    padding: 5px;
    background-color: rgba(0, 0, 0, 0.7);
}

.hotbar-slot {
    width: 40px;
    height: 40px;
    background-color: #8b8b8b;
    border: 2px solid #5a5a5a;
    margin: 0 2px;
    position: relative;
    image-rendering: pixelated;
}

.hotbar-slot.selected {
    border-color: #ffaa00;
    background-color: #a0a0a0;
}

.hotbar-slot img {
    width: 32px;
    height: 32px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.hotbar-slot .item-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 10px;
    color: white;
    text-shadow: 1px 1px 0 black;
}

/* View toggle button */
.view-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #ffaa00;
    border: 2px solid #5a5a5a;
    color: white;
    padding: 8px 12px;
    font-family: "MinecraftFont", monospace, sans-serif;
    font-size: 14px;
    cursor: pointer;
    z-index: 100;
}

.view-toggle:hover {
    background-color: #ff8800;
}

/* Inventory UI */
.inventory-ui {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    max-width: 600px;
    background-color: #c6c6c6;
    border: 3px solid #5a5a5a;
    padding: 10px;
    z-index: 10;
    display: none;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #5a5a5a;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.inventory-header h3 {
    margin: 0;
    color: #5a5a5a;
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #5a5a5a;
    cursor: pointer;
}

.inventory-section {
    margin-bottom: 15px;
}

.inventory-section h4 {
    margin: 0 0 5px 0;
    color: #5a5a5a;
    font-size: 16px;
}

.inventory-item {
    display: flex;
    align-items: center;
    margin: 5px 0;
    padding: 5px;
    background-color: #d9d9d9;
    border: 1px solid #7e7e7e;
}

.inventory-item img {
    width: 32px;
    height: 32px;
    margin-right: 10px;
    image-rendering: pixelated;
}

.durability-bar {
    flex-grow: 1;
    height: 5px;
    background-color: #7e7e7e;
    margin-left: 10px;
    position: relative;
}

.durability-fill {
    height: 100%;
    background-color: #44dd44;
    position: absolute;
    left: 0;
    top: 0;
}

/* Quest UI */
.quest-ui {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    max-width: 600px;
    background-color: #c6c6c6;
    border: 3px solid #5a5a5a;
    padding: 10px;
    z-index: 10;
    display: none;
}

.quest-item {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #d9d9d9;
    border: 1px solid #7e7e7e;
    position: relative;
}

.quest-item.complete {
    background-color: #d9ffdb;
    border-color: #44dd44;
}

.quest-item h4 {
    margin: 0 0 5px 0;
    color: #5a5a5a;
    font-size: 16px;
}

.quest-progress {
    display: flex;
    align-items: center;
    margin: 5px 0;
}

.progress-bar {
    flex-grow: 1;
    height: 10px;
    background-color: #7e7e7e;
    margin-right: 10px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background-color: #44dd44;
    position: absolute;
    left: 0;
    top: 0;
}

.quest-complete-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #44dd44;
    color: white;
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 3px;
}

/* Conversation UI */
.conversation-ui {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 700px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #ffaa00;
    padding: 10px;
    z-index: 10;
    display: none;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ffaa00;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.conversation-header h3 {
    margin: 0;
    color: #ffaa00;
    font-size: 18px;
}

.conversation-content {
    margin-bottom: 15px;
    color: white;
    font-size: 16px;
    line-height: 1.4;
}

.conversation-options {
    display: flex;
    justify-content: flex-end;
}

.next-btn {
    background-color: #ffaa00;
    border: none;
    color: white;
    padding: 5px 15px;
    font-size: 14px;
    cursor: pointer;
    font-family: "MinecraftFont", monospace, sans-serif;
}

/* Character nametags */
.character-nametag {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid white;
    padding: 2px 5px;
    color: white;
    font-size: 12px;
    text-align: center;
    transform: translate(-50%, -50%);
    pointer-events: none;
    white-space: nowrap;
    z-index: 5;
}

/* Interaction prompt */
.interaction-prompt {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -70px);
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid white;
    padding: 5px 10px;
    color: white;
    font-size: 14px;
    text-align: center;
    white-space: nowrap;
    display: none;
    z-index: 10;
}

/* Mining UI */
.mining-ui {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #ffaa00;
    padding: 10px;
    color: white;
    font-size: 14px;
    z-index: 10;
    display: none;
    width: 250px;
}

.mining-header {
    margin: 0 0 5px 0;
    color: #ffaa00;
    font-size: 16px;
    text-align: center;
    border-bottom: 1px solid #ffaa00;
    padding-bottom: 5px;
}

.mining-progress {
    height: 10px;
    background-color: #7e7e7e;
    margin: 10px 0;
    position: relative;
}

.mining-progress .progress-bar {
    height: 100%;
    background-color: #ffaa00;
    position: absolute;
    left: 0;
    top: 0;
    width: 0%;
    transition: width 0.5s;
}

.mining-info {
    font-size: 12px;
    text-align: center;
}

/* Quest notification */
.quest-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    border: 3px solid #ffaa00;
    padding: 20px;
    color: white;
    text-align: center;
    z-index: 100;
}

.quest-notification h3 {
    margin: 0 0 10px 0;
    color: #ffaa00;
    font-size: 24px;
}

.quest-notification h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
}

@keyframes quest-notification {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    10% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    20% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    80% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Inventory and quest buttons */
.inventory-button,
.quest-button {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #ffaa00;
    color: white;
    padding: 5px 10px;
    font-size: 14px;
    cursor: pointer;
    font-family: "MinecraftFont", monospace, sans-serif;
    z-index: 5;
}

.inventory-button {
    top: 20px;
    right: 100px;
}

.quest-button {
    top: 20px;
    right: 20px;
}

/* Crosshair */
.crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    pointer-events: none;
    z-index: 4;
}

.crosshair::before,
.crosshair::after {
    content: "";
    position: absolute;
    background-color: white;
}

.crosshair::before {
    top: 9px;
    left: 0;
    width: 20px;
    height: 2px;
}

.crosshair::after {
    top: 0;
    left: 9px;
    width: 2px;
    height: 20px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .inventory-ui,
    .quest-ui {
        width: 90%;
    }

    .conversation-ui {
        width: 90%;
        bottom: 80px;
    }

    .hotbar {
        bottom: 5px;
    }

    .stats-panel {
        font-size: 12px;
    }
}
