/* Inventory Panel Styles - Desktop Default */
#inventory-panel {
    position: fixed;
    top: 50%;
    left: 25%;
    transform: translate(-50%, -50%);
    width: 372px; /* 332px grid + 20px padding each side */
    height: 380px; /* 264px grid + 40px title + 60px bottom area + padding */
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #555;
    border-radius: 10px;
    padding: 20px;
    z-index: 1000;
    color: white;
    font-family: Arial, sans-serif;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
}

#inventory-panel h2 {
    margin: 0 0 20px 0;
    text-align: center;
    color: #fff;
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 60px);
    grid-template-rows: repeat(4, 60px);
    gap: 8px;
    justify-content: center;
    align-content: start;
    margin: 0 auto 15px;
}

.inventory-slot {
    width: 60px;
    height: 60px;
    background: rgba(50, 50, 50, 0.8);
    border: 2px solid #666;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.inventory-slot:hover {
    background: rgba(70, 70, 70, 0.9);
    border-color: #888;
    transform: scale(1.05);
}

.inventory-slot.occupied {
    background: rgba(100, 150, 100, 0.8);
    border-color: #4CAF50;
}

.inventory-slot.occupied:hover {
    background: rgba(120, 170, 120, 0.9);
    border-color: #66BB6A;
}

.inventory-slot.dragging {
    opacity: 0.5;
    transform: rotate(5deg) scale(0.95);
    z-index: 1001;
}

.inventory-slot[draggable="true"] {
    cursor: grab;
}

.inventory-slot[draggable="true"]:active {
    cursor: grabbing;
}

.inventory-slot.drag-over {
    background-color: rgba(255, 255, 0, 0.3);
    border-color: #ffff00;
    transform: scale(1.05);
}

.inventory-slot .item-icon {
    font-size: 20px;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.inventory-slot .item-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 10px;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 1px 3px;
    border-radius: 3px;
    min-width: 12px;
    text-align: center;
}

/* Utility class for hiding elements */
.hidden {
    display: none !important;
}

/* Close button for inventory */
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.close-btn:hover {
    color: #ff6b6b;
}

/* ==================== RESPONSIVE MEDIA QUERIES ==================== */

/* Tablet and smaller desktop screens */
@media (max-width: 1024px) {
    #inventory-panel {
        width: 450px;
        height: 350px;
    }
    
    #inventory-grid {
        grid-template-columns: repeat(5, 50px);
        grid-template-rows: repeat(4, 50px);
        gap: 6px;
    }
    
    .inventory-slot {
        width: 50px;
        height: 50px;
    }
    
    .inventory-slot .item-icon {
        font-size: 18px;
    }
}

/* Mobile phones and small tablets */
@media (max-width: 768px) {
    #inventory-panel {
        width: 95vw;
        height: 70vh;
        padding: 15px;
        border-radius: 8px;
        left: 2.5%;
        transform: translateY(-50%);
    }
    
    #inventory-panel h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    #inventory-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(5, 1fr);
        height: calc(100% - 60px);
        gap: 8px;
    }
    
    .inventory-slot {
        min-width: 50px;
        min-height: 50px;
    }
    
    .inventory-slot .item-icon {
        font-size: 16px;
    }
    
    .inventory-slot .item-count {
        font-size: 9px;
        bottom: 1px;
        right: 1px;
    }
    
    .close-btn {
        font-size: 24px;
        top: 8px;
        right: 12px;
    }
}

/* Very small mobile screens */
@media (max-width: 480px) {
    #inventory-panel {
        width: 98vw;
        height: 80vh;
        padding: 10px;
        border-radius: 5px;
    }
    
    #inventory-panel h2 {
        font-size: 18px;
        margin-bottom: 10px;
    }
    
    #inventory-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(7, 1fr);
        gap: 6px;
    }
    
    .inventory-slot {
        min-width: 40px;
        min-height: 40px;
    }
    
    .inventory-slot .item-icon {
        font-size: 14px;
    }
    
    .inventory-slot .item-count {
        font-size: 8px;
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .inventory-slot {
        border-width: 1px;
    }
    
    .inventory-slot .item-icon {
        text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
    }
}

/* Context Menu Styles */
.item-context-menu {
    position: fixed;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #666;
    border-radius: 5px;
    padding: 5px;
    z-index: 2000;
    min-width: 120px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.item-context-menu button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin: 2px 0;
    background: rgba(50, 50, 50, 0.8);
    border: 1px solid #555;
    border-radius: 3px;
    color: #fff;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: all 0.2s ease;
}

.item-context-menu button:hover {
    background: rgba(100, 100, 100, 0.9);
    border-color: #888;
}

.item-context-menu button.equip {
    color: #4CAF50;
}

.item-context-menu button.equip:hover {
    background: rgba(76, 175, 80, 0.3);
}

.item-context-menu button.destroy {
    color: #ff6b6b;
}

.item-context-menu button.destroy:hover {
    background: rgba(255, 107, 107, 0.3);
}

/* Currency Bar */
.currency-bar {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 264px; /* 4 slots + 3 gaps = 4*60 + 3*8 */
    height: 40px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #444;
    border-radius: 5px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 20px;
}

.currency-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: #fff;
}

.currency-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.currency-icon.gold {
    color: #FFD700;
    text-shadow: 0 0 4px rgba(255, 215, 0, 0.5);
}

.currency-amount {
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* Trash Bin Slot */
.trash-bin-container {
    position: absolute;
    bottom: 20px;
    right: 20px; /* Align with rightmost grid column */
    width: 60px;
    height: 60px;
}

.trash-bin-slot {
    width: 100%;
    height: 100%;
    background: rgba(50, 0, 0, 0.8);
    border: 2px solid #800;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.trash-bin-slot:hover {
    background: rgba(100, 0, 0, 0.9);
    border-color: #ff0000;
    transform: scale(1.05);
}

.trash-bin-slot.drag-over {
    background: rgba(255, 0, 0, 0.5);
    border-color: #ff0000;
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.trash-bin-icon {
    font-size: 24px;
    color: #ff6b6b;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.trash-bin-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    color: #ff6b6b;
    font-size: 12px;
    white-space: nowrap;
}

/* Quick Bar Styles */
#quick-bar-container {
    position: fixed;
    bottom: 20px; /* Small offset from bottom */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px; /* Gap between the two quick bars */
    z-index: 100;
    pointer-events: none; /* Let clicks pass through container */
}

.quick-bar {
    display: flex;
    flex-direction: row; /* Horizontal layout */
    gap: 5px; /* Space between slots */
    pointer-events: auto; /* Enable clicks on bars */
    position: relative;
}

.quick-slot {
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #444;
    border-radius: 5px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.quick-slot:hover {
    border-color: #666;
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.7);
}

.quick-slot.occupied {
    border-color: #555;
}

.quick-slot .slot-key {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 10px;
    color: #888;
    font-weight: bold;
}

.quick-slot .item-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
}

.quick-slot .item-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 12px;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 1px 3px;
    border-radius: 3px;
}

.quick-slot .cooldown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 3px;
    pointer-events: none;
}

.quick-slot .cooldown-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

/* Teleport Button */
.teleport-button {
    width: 50px; /* Match quick slot width */
    height: 50px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #4a90e2;
    border-radius: 5px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.teleport-button:hover {
    border-color: #5ba3ff;
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.7);
}

.teleport-button:hover .teleport-tooltip {
    opacity: 1;
    visibility: visible;
}

.teleport-icon {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
}

.teleport-button .slot-key {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #4a90e2;
    font-weight: bold;
}

.teleport-tooltip {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

/* Skill slots (differentiate from consumable slots) */
.skill-slot {
    border-color: #663399;
}

.skill-slot:hover {
    border-color: #8a5ac2;
}

.skill-slot .slot-key {
    color: #8a5ac2;
}

/* Skill cooldown overlay */
.skill-slot .cooldown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 3px;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skill-slot .cooldown-text {
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Drag and drop for quick slots */
.quick-slot.drag-over {
    background: rgba(100, 100, 100, 0.3);
    border-color: #fff;
}

/* Visual separator between consumable and skill bars */
#consumable-quick-bar::after {
    content: "";
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1px;
}