/* Inventory System Styles - Modern Glass-Morphism */

.inventory-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 5, 10, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.inventory-panel {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--glass-shadow), var(--border-glow);
    overflow: hidden;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.inventory-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-glow), transparent);
}

.inventory-header h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--primary);
    letter-spacing: 0.15em;
    text-shadow: 0 0 10px var(--primary-glow);
}

.close-btn {
    font-size: 1.5rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    line-height: 1;
    padding: var(--space-xs) var(--space-sm);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--primary);
    background: var(--primary-subtle);
    border-color: var(--border-color);
    box-shadow: 0 0 12px var(--primary-glow);
}

.inventory-content {
    display: grid;
    grid-template-columns: 200px 120px 1fr;
    gap: var(--space-lg);
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

/* Paper Doll Portrait */
.paper-doll-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.portrait-container {
    width: 180px;
    height: 280px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.portrait-container::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
    z-index: 1;
}

.portrait-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portrait-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Equipment Slots */
.equipment-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.equipment-slot {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    cursor: pointer;
    transition: all var(--transition-normal);
    min-height: 60px;
    position: relative;
    overflow: hidden;
}

.equipment-slot::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.equipment-slot:hover {
    border-color: var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 12px var(--primary-glow);
}

.equipment-slot:hover::before {
    opacity: 1;
}

.equipment-slot.filled {
    border-color: var(--primary-dim);
    background: var(--primary-subtle);
    box-shadow: inset 0 0 15px var(--primary-subtle);
}

.equipment-slot.drag-over {
    border-color: var(--success);
    background: rgba(68, 221, 136, 0.1);
    box-shadow: 0 0 15px rgba(68, 221, 136, 0.3);
}

.slot-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-dim);
    letter-spacing: 0.1em;
}

.slot-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.slot-icon.empty::before {
    content: '+';
    font-size: 1.5rem;
    color: var(--text-dim);
    opacity: 0.3;
}

/* Items Section */
.items-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.items-section h4 {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--primary);
    letter-spacing: 0.12em;
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
    text-shadow: 0 0 8px var(--primary-glow);
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    max-height: 300px;
    overflow-y: auto;
    padding-right: var(--space-xs);
}

.inventory-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
}

.inventory-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.inventory-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.inventory-item:hover::before {
    opacity: 0.5;
}

.inventory-item.selected {
    background: var(--primary-subtle);
    border-color: var(--primary-dim);
    box-shadow: 0 0 12px var(--primary-glow);
}

.inventory-item.selected::before {
    opacity: 1;
}

.inventory-item.dragging {
    opacity: 0.5;
}

.item-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-normal);
}

.item-icon img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.item-brief {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-type {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

/* Item Details Panel */
.item-details {
    grid-column: 1 / -1;
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
    position: relative;
}

.item-details::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 1px;
    background: linear-gradient(90deg, var(--primary-dim), transparent);
}

.item-details .item-image {
    width: 120px;
    height: 120px;
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.item-details .item-image img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.item-info h4 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--primary);
    text-shadow: 0 0 8px var(--primary-glow);
}

.item-description {
    font-size: 0.875rem;
    color: var(--text-normal);
    line-height: 1.6;
}

.item-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.stat-tag {
    padding: 4px 10px;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
}

.stat-tag .value {
    color: var(--success);
    font-weight: 600;
}

.item-lore {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-style: italic;
    padding: var(--space-sm) var(--space-md);
    border-left: 2px solid var(--accent);
    background: rgba(155, 109, 255, 0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.item-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.item-action-btn {
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--text-bright);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(0, 212, 255, 0.05));
    border: 1px solid var(--primary-dim);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.item-action-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25), rgba(0, 212, 255, 0.1));
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-1px);
}

.item-action-btn.equip {
    background: linear-gradient(135deg, rgba(68, 221, 136, 0.2), rgba(68, 221, 136, 0.08));
    border-color: var(--success);
    color: var(--success);
}

.item-action-btn.equip:hover {
    background: linear-gradient(135deg, rgba(68, 221, 136, 0.3), rgba(68, 221, 136, 0.15));
    box-shadow: 0 0 15px rgba(68, 221, 136, 0.4);
}

.item-action-btn.danger {
    background: linear-gradient(135deg, rgba(255, 85, 85, 0.15), rgba(255, 85, 85, 0.05));
    border-color: rgba(255, 85, 85, 0.5);
    color: var(--danger);
}

.item-action-btn.danger:hover {
    background: linear-gradient(135deg, rgba(255, 85, 85, 0.25), rgba(255, 85, 85, 0.1));
    border-color: var(--danger);
    box-shadow: 0 0 15px rgba(255, 85, 85, 0.3);
}

/* Item rarity colors */
.inventory-item.common .item-name { color: var(--text-normal); }
.inventory-item.uncommon .item-name { color: var(--success); }
.inventory-item.rare .item-name { color: var(--primary); text-shadow: 0 0 6px var(--primary-glow); }
.inventory-item.epic .item-name { color: var(--accent); text-shadow: 0 0 6px var(--accent-glow); }
.inventory-item.legendary .item-name { color: var(--warning); text-shadow: 0 0 8px rgba(255, 204, 68, 0.5); }

/* Item rarity borders and glow */
.inventory-item.uncommon {
    border-left: 2px solid var(--success);
}
.inventory-item.uncommon::before {
    background: var(--success);
}
.inventory-item.rare {
    background: rgba(0, 212, 255, 0.04);
}
.inventory-item.rare::before {
    background: var(--primary);
    opacity: 0.7;
}
.inventory-item.epic {
    background: rgba(155, 109, 255, 0.05);
}
.inventory-item.epic::before {
    background: var(--accent);
    opacity: 0.8;
}
.inventory-item.legendary {
    background: linear-gradient(135deg, rgba(255, 204, 68, 0.08), rgba(255, 140, 66, 0.04));
    box-shadow: inset 0 0 20px rgba(255, 204, 68, 0.08);
}
.inventory-item.legendary::before {
    background: linear-gradient(180deg, var(--warning), var(--secondary));
    opacity: 1;
    width: 3px;
}

/* Item type icon background colors */
.inventory-item.uncommon .item-icon {
    border-color: rgba(68, 221, 136, 0.4);
}
.inventory-item.rare .item-icon {
    border-color: var(--primary-dim);
    box-shadow: 0 0 8px var(--primary-glow);
}
.inventory-item.epic .item-icon {
    border-color: var(--accent-dim);
    box-shadow: 0 0 8px var(--accent-glow);
}
.inventory-item.legendary .item-icon {
    border-color: var(--warning);
    box-shadow: 0 0 12px rgba(255, 204, 68, 0.5);
}

/* Placeholder */
.placeholder {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-dim);
    font-style: italic;
    text-align: center;
    padding: var(--space-lg);
}

/* Loading spinner */
.loading-spinner.small {
    width: 30px;
    height: 30px;
    border-width: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .inventory-content {
        grid-template-columns: 1fr;
    }

    .paper-doll-section {
        order: 1;
    }

    .equipment-section {
        order: 2;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .equipment-slot {
        min-width: 60px;
    }

    .items-section {
        order: 3;
    }

    .item-details {
        flex-direction: column;
        align-items: center;
    }
}
