/**
 * Item Frame Styles - Consolidated styles for all item frames across the application
 * This file consolidates duplicate styles from trade.css, coinflip.css, and other files
 */

/* ============================================================================
 * BASE ITEM FRAME STYLES
 * ============================================================================ */

/* Base rapper-frame style - standard inventory items */
.rapper-frame,
.ui-item-frame {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: move;
    user-select: none;
    box-sizing: border-box;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}

/* Larger UI frame for specific contexts */
.ui-item-frame {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

/* ============================================================================
 * ITEM FRAME STATES
 * ============================================================================ */

.rapper-frame:hover,
.ui-item-frame:hover {
    border-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.rapper-frame.draggable {
    cursor: move;
}

.rapper-frame.dragging,
.ui-item-frame.dragging {
    opacity: 0.7;
    transform: rotate(5deg);
    z-index: 1000;
}

/* ============================================================================
 * RARITY BORDER COLORS - CONSOLIDATED
 * ============================================================================ */

.rapper-frame[data-rarity="Legendary"],
.ui-item-frame[data-rarity="Legendary"] {
    border-color: #ff8000;
}

.rapper-frame[data-rarity="Mythical"],
.ui-item-frame[data-rarity="Mythical"] {
    border-color: #e600e6;
}

.rapper-frame[data-rarity="Exotic"],
.ui-item-frame[data-rarity="Exotic"] {
    border-color: #ff00ff;
}

.rapper-frame[data-rarity="Epic"],
.ui-item-frame[data-rarity="Epic"] {
    border-color: #a335ee;
}

.rapper-frame[data-rarity="Rare"],
.ui-item-frame[data-rarity="Rare"] {
    border-color: #0070dd;
}

.rapper-frame[data-rarity="Uncommon"],
.ui-item-frame[data-rarity="Uncommon"] {
    border-color: #1eff00;
}

.rapper-frame[data-rarity="Common"],
.ui-item-frame[data-rarity="Common"] {
    border-color: #666666;
}

/* ============================================================================
 * ITEM NAME TOOLTIP
 * ============================================================================ */

.rapper-frame::after {
    content: attr(data-name);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.6em;
    padding: 1px 2px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================================
 * ITEM VALUE BADGES
 * ============================================================================ */

.rapper-frame .item-value,
.ui-item-frame .item-value {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: #4CAF50;
    color: white;
    font-size: 9px;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: bold;
    z-index: 2;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

.item-count-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    background: #222222;
    color: #fff;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
    z-index: 2;
}

/* ============================================================================
 * IMAGE CONTAINER STYLES
 * ============================================================================ */

.item-image-container {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 6px;
    overflow: hidden;
}

.rapper-image,
.item-image {
    height: 100%;
    object-fit: contain !important;
    object-position: center !important;
    border-radius: 6px;
}

/* ============================================================================
 * LISTING-SPECIFIC OVERRIDES
 * ============================================================================ */

/* Ensure listing items match inventory size consistently */
.listing-items .ui-item-frame,
.listing-items .rapper-frame,
.coinflip-listing .ui-item-frame,
.coinflip-listing .rapper-frame,
.trade-listing .ui-item-frame,
.trade-listing .rapper-frame {
    width: 50px !important;
    height: 50px !important;
}

.listing-items {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    margin-bottom: 4px;
}

/* Smaller value badges for listings */
.listing-items .item-value {
    font-size: 8px;
    padding: 1px 3px;
    bottom: 1px;
    right: 1px;
}

/* ============================================================================
 * PREVIEW ITEMS
 * ============================================================================ */

.preview-item,
.glass-items-container .preview-item,
.glass-items-container > div,
.listing-items > div {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    min-height: 50px !important;
    max-width: 50px !important;
    max-height: 50px !important;
}

/* ============================================================================
 * CONTEXT-SPECIFIC OVERRIDES
 * ============================================================================ */

/* Trade-specific */
.trade-items-grid .rapper-frame {
    position: relative;
}

/* Modal previews */
.modal-items-preview .rapper-frame {
    position: relative;
    margin: 2px;
}

/* Received items */
.received-items-grid .rapper-frame {
    position: relative;
    margin: 2px;
    opacity: 0.9;
}

/* Notification items */
.notification-items-grid .rapper-frame {
    width: 40px;
    height: 40px;
}

/* Spinner items */
.spinner-item .rapper-frame {
    width: 60px;
    height: 60px;
    margin: 0 auto;
}

/* ============================================================================
 * RESPONSIVE ADJUSTMENTS
 * ============================================================================ */

@media (max-width: 768px) {
    .rapper-frame,
    .ui-item-frame {
        width: 45px;
        height: 45px;
    }
    
    .listing-items .ui-item-frame,
    .listing-items .rapper-frame {
        width: 45px !important;
        height: 45px !important;
    }
}

@media (max-width: 480px) {
    .rapper-frame,
    .ui-item-frame {
        width: 40px;
        height: 40px;
    }
    
    .listing-items .ui-item-frame,
    .listing-items .rapper-frame {
        width: 40px !important;
        height: 40px !important;
    }
}
