/* Inventory System Styles */

/* Inventory Panel Overlay - Acts as container query context */
#inventory-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    padding: 10vh 10vw;  /* Margen de 1/10 de pantalla */
    z-index: 200;
    box-sizing: border-box;
    container-type: size;
    container-name: inventory-panel;
}

#inventory-panel.visible {
    display: flex;
    cursor: default;
}

/* Inventory Container - Uses container query units */
.inventory-container {
    display: flex;
    gap: 2cqmin;
    padding: 2cqmin;
    background: rgba(20, 20, 20, 0.95);
    border: 3cqmin solid transparent;
    border-image: url('../Textures/GUI/border_tileset.png') 16 fill repeat;
}

/* Tabs */
.inventory-tabs {
    display: flex;
    gap: 0.5cqmin;
    margin-bottom: 1.5cqmin;
}

.inventory-tab {
    padding: 1cqmin 2cqmin;
    background: rgba(0, 0, 0, 0.5);
    border: 3cqmin solid transparent;
    border-image: url('../Textures/GUI/border_tileset.png') 16 fill repeat;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Jacquarda Bastarda 9', serif;
    font-size: 2.3cqmin;
    cursor: pointer;
    transition: all 0.2s ease;
}

.inventory-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.inventory-tab.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Equipment Sections */
.equipment-section {
    display: flex;
    flex-direction: column;
    gap: 2cqmin;
}

.equipment-left {
    padding-right: 2cqmin;
    border-right: 0.3cqmin solid rgba(255, 255, 255, 0.1);
}

.equipment-right {
    padding-left: 2cqmin;
    border-left: 0.3cqmin solid rgba(255, 255, 255, 0.1);
}

/* Section Titles */
.section-title {
    font-family: 'Jacquarda Bastarda 9', serif;
    font-size: 2.3cqmin;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    margin-bottom: 1cqmin;
}

/* Passive Slots Section */
.passive-section {
    display: flex;
    flex-direction: column;
    gap: 1cqmin;
}

/* Hotbar Section */
.hotbar-section {
    display: flex;
    flex-direction: column;
    gap: 1cqmin;
}

/* Base slot style - uses cqmin for responsive sizing */
.hotbar-slot,
.passive-slot,
.inv-slot,
.recipe-slot {
    width: 8cqmin;
    height: 8cqmin;
    box-sizing: content-box;
    background: rgba(0, 0, 0, 0.5);
    border: 3cqmin solid transparent;
    border-image: url('../Textures/GUI/border_tileset.png') 16 fill repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: visible;
}

.hotbar-slot:hover {
    background: rgba(255, 200, 100, 0.15);
}

.hotbar-slot.drag-over {
    background: rgba(255, 200, 100, 0.25);
}

.passive-slot:hover {
    background: rgba(100, 200, 255, 0.15);
}

.passive-slot.drag-over {
    background: rgba(100, 200, 255, 0.25);
}

.inv-slot:hover {
    background: rgba(255, 255, 255, 0.1);
}

.inv-slot.drag-over {
    background: rgba(255, 255, 255, 0.2);
}

.inv-slot.dragging {
    opacity: 0.5;
}

/* Inventory Section (Right) */
.inventory-section {
    display: flex;
    flex-direction: column;
}

/* Inventory Grid (4x4) */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1cqmin;
}

/* Item Sprite - fills the slot content area */
.item-sprite {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: contain;
    image-rendering: pixelated;
    pointer-events: none;
}

/* Item Count (for stacks) */
.item-count {
    position: absolute;
    bottom: 0.5cqmin;
    right: 0.8cqmin;
    font-family: 'Jacquarda Bastarda 9', serif;
    font-size: 2.1cqmin;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 10;
}

/* Durability Bar */
.item-durability {
    position: absolute;
    bottom: 0.5cqmin;
    left: 0.5cqmin;
    right: 0.5cqmin;
    width: auto;
    height: 0.6cqmin;
    background: rgba(0, 0, 0, 0.5);
    overflow: hidden;
    padding: 0;
    z-index: 10;
}

.durability-fill {
    height: 100%;
    background: #ffffff;
    transition: width 0.2s ease;
}

.durability-fill.low {
    background: #ff4444;
}

/* Context Menu */
#inventory-context-menu {
    position: fixed;
    background: rgba(30, 30, 30, 0.95);
    border: 2vh solid transparent;
    border-image: url('../Textures/GUI/border_tileset.png') 16 fill repeat;
    min-width: 12vh;
    z-index: 300;
    display: none;
}

#inventory-context-menu.visible {
    display: block;
}

.context-option {
    padding: 1.2vh 2vh;
    font-family: 'Jacquarda Bastarda 9', serif;
    font-size: 2.3vh;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: background 0.15s ease;
}

.context-option:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Crafteo Tab Content */
.crafting-section {
    display: none;
    width: calc(4 * 14cqmin + 3 * 1cqmin);
}

.crafting-section.visible {
    display: block;
}

.crafting-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1cqmin;
}

.recipe-slot {
    flex-direction: column;
}

.recipe-slot:hover {
    background: rgba(255, 200, 100, 0.15);
}

.recipe-slot.can-craft {
    background: rgba(100, 255, 100, 0.1);
}

.recipe-slot.cannot-craft {
    opacity: 0.5;
}

.recipe-name {
    font-family: 'Jacquarda Bastarda 9', serif;
    font-size: 1.7cqmin;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 0.5cqmin;
    text-align: center;
}

/* Weapon Slots (Hotbar) - Updated for dragging */
.weapon-slot.drag-over {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
}

.weapon-slot.dragging {
    opacity: 0.5;
}

/* Inventory Close Button */
.inventory-close {
    position: absolute;
    top: 2cqmin;
    right: 2cqmin;
    width: 5cqmin;
    height: 5cqmin;
    background: rgba(0, 0, 0, 0.5);
    border: 3cqmin solid transparent;
    border-image: url('../Textures/GUI/border_tileset.png') 16 fill repeat;
    color: #fff;
    font-size: 3cqmin;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.inventory-close:hover {
    background: rgba(255, 100, 100, 0.2);
}

/* Tooltip */
.item-tooltip {
    position: fixed;
    background: rgba(20, 20, 20, 0.95);
    border: 2vh solid transparent;
    border-image: url('../Textures/GUI/border_tileset.png') 16 fill repeat;
    padding: 1.2vh 1.8vh;
    pointer-events: none;
    z-index: 350;
    max-width: 30vh;
    display: none;
}

.item-tooltip.visible {
    display: block;
}

.tooltip-name {
    font-family: 'Micro 5', sans-serif;
    font-size: 2.8vh;
    color: #fff;
    margin-bottom: 0.6vh;
}

.tooltip-type {
    font-family: 'Micro 5', sans-serif;
    font-size: 2.2vh;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 1vh;
}

.tooltip-stats {
    font-family: 'Micro 5', sans-serif;
    font-size: 2vh;
    color: rgba(200, 200, 200, 0.8);
    margin-bottom: 0.5vh;
}

.tooltip-effects {
    font-family: 'Micro 5', sans-serif;
    font-size: 1.9vh;
    margin-top: 0.5vh;
}

.tooltip-effect {
    color: rgba(100, 200, 255, 0.9);
}

.tooltip-effects-negative {
    font-family: 'Micro 5', sans-serif;
    font-size: 1.9vh;
    margin-top: 0.5vh;
}

.tooltip-effect-negative {
    color: rgba(255, 100, 100, 0.9);
}

/* Enchantment Styles */
.tooltip-enchantments {
    font-family: 'Micro 5', sans-serif;
    font-size: 1.9vh;
    margin-top: 0.8vh;
    padding-top: 0.5vh;
    border-top: 1px solid rgba(153, 51, 255, 0.3);
}

.tooltip-enchant {
    color: rgba(180, 100, 255, 1);
    display: block;
    text-shadow: 0 0 5px rgba(153, 51, 255, 0.5);
}

/* Enchanted item slot glow */
.hotbar-slot.enchanted,
.passive-slot.enchanted,
.inv-slot.enchanted {
    box-shadow: 0 0 10px rgba(153, 51, 255, 0.6),
                inset 0 0 15px rgba(153, 51, 255, 0.2);
    animation: enchant-pulse 2s ease-in-out infinite;
}

@keyframes enchant-pulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(153, 51, 255, 0.6),
                    inset 0 0 15px rgba(153, 51, 255, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(153, 51, 255, 0.9),
                    inset 0 0 20px rgba(153, 51, 255, 0.35);
    }
}

.item-enchant-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center,
                rgba(153, 51, 255, 0.15) 0%,
                transparent 70%);
    pointer-events: none;
    z-index: 5;
    animation: enchant-glow 2s ease-in-out infinite;
}

@keyframes enchant-glow {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}
