/* Trade Modal - Compact Design */
.trade-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.trade-modal.active {
    display: flex;
    opacity: 1;
}

.trade-modal-content {
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    border-radius: 16px;
    padding: 0;
    max-width: 650px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 
        0 25px 50px rgba(0,0,0,0.6),
        0 0 0 1px rgba(100,100,100,0.2),
        inset 0 1px 0 rgba(255,255,255,0.1);
    transform: scale(0.8);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(100,100,100,0.3);
}

.trade-modal.active .trade-modal-content {
    transform: scale(1);
}

/* Trade Header - Compact */
.trade-header {
    background: linear-gradient(135deg, #444 0%, #666 50%, #888 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
    position: relative;
    overflow: hidden;
}

.trade-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.1) 100%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.trade-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

#trade-partner-name {
    font-size: 0.9rem;
    opacity: 0.9;
}

.close-trade-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    pointer-events: none;
}

.close-trade-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
}

.close-trade-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.close-trade-btn:active {
    transform: scale(0.95);
}

/* Trade Body - Compact */
.trade-body {
    padding: 12px;
    overflow-y: auto;
    max-height: calc(85vh - 60px);
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
}

.trade-body::-webkit-scrollbar {
    width: 6px;
}

.trade-body::-webkit-scrollbar-track {
    background: #000000;
    border-radius: 10px;
}

.trade-body::-webkit-scrollbar-thumb {
    background: #000000;
    border-radius: 10px;
}

.trade-body::-webkit-scrollbar-thumb:hover {
    background: #1a1a1a;
}

/* Compact Layout */
.trade-compact-layout {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    background: linear-gradient(145deg, #333 0%, #2a2a2a 100%);
    border-radius: 12px;
    padding: 10px;
    border: 2px solid #555;
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.trade-section {
    flex: 1;
    /* Làm ô rõ ràng cho cả PC lẫn mobile (BẠN ĐƯA / HỌ ĐƯA) */
    background: radial-gradient(circle at top, rgba(255,255,255,0.06), transparent 55%),
                linear-gradient(145deg, #3a3a3a 0%, #262626 100%);
    border-radius: 10px;
    padding: 8px;
    box-shadow:
        0 3px 10px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.section-title span {
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-title-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Select Item Button - Compact */
.select-item-btn.compact {
    background: rgba(155, 89, 182, 0.8);
    border: 1px solid rgba(155, 89, 182, 1);
    color: white;
    padding: 4px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    font-size: 14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

.select-item-btn.compact:hover {
    background: rgba(155, 89, 182, 1);
    transform: scale(1.1);
}

/* Confirm Button - Compact */
.confirm-trade-btn.compact {
    background: rgba(52, 152, 219, 0.8);
    border: 1px solid rgba(52, 152, 219, 1);
    color: white;
    padding: 4px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    font-size: 14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

.confirm-trade-btn.compact:hover:not(:disabled) {
    background: rgba(52, 152, 219, 1);
    transform: scale(1.1);
}

.confirm-trade-btn.compact:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.confirm-trade-btn.compact.confirmed {
    background: rgba(46, 204, 113, 0.8);
    border-color: rgba(46, 204, 113, 1);
}

.confirm-status.compact {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    padding: 4px;
    border-radius: 6px;
    font-size: 14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-status.compact.confirmed {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.4);
}

/* Trade Arrow */
.trade-arrow {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

/* Offer Slots */
.trade-offer-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 60px;
    /* PC: cho phép nhiều item nhưng cuộn trong ô, không kéo dài modal */
    max-height: 180px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 8px;
}

/* Gold Input Section */
.trade-gold-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.trade-gold-input label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffd700;
    white-space: nowrap;
}

.trade-gold-input input {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 4px;
    padding: 4px 8px;
    color: #ffd700;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 0;
    /* Ẩn spinner của input number */
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.trade-gold-input input::-webkit-outer-spin-button,
.trade-gold-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.trade-gold-input input:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 4px rgba(255, 215, 0, 0.5);
}

.trade-gold-input input::placeholder {
    color: rgba(255, 215, 0, 0.5);
}

.gold-fee-info {
    font-size: 0.7rem;
    color: rgba(255, 165, 0, 0.8);
    white-space: nowrap;
}

.trade-gold-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.trade-gold-display label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffd700;
    white-space: nowrap;
}

.trade-gold-display span:not(.gold-fee-info) {
    flex: 1;
    color: #ffd700;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
}

.offer-slot {
    width: 45px;
    height: 45px;
    background: linear-gradient(145deg, #444 0%, #333 100%);
    border: 2px solid #555;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 
        0 2px 6px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

.offer-slot.empty {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    line-height: 1.2;
    padding: 4px;
    border-style: dashed;
}

.offer-slot.filled {
    background: linear-gradient(145deg, #e8f5e8 0%, #f0f8f0 100%);
    border-color: #4caf50;
    box-shadow: 
        0 4px 12px rgba(76, 175, 80, 0.2),
        inset 0 1px 0 rgba(255,255,255,0.6);
}

.offer-slot.filled::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    height: 2px;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    border-radius: 2px;
}

.offer-slot img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 4px;
}

.slot-quantity {
    position: absolute;
    top: 2px;
    left: 2px;
    background: linear-gradient(135deg, #666, #888);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.3);
}

.slot-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(231, 76, 60, 0.9);
    border: none;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.slot-remove:hover {
    background: rgba(231, 76, 60, 1);
    transform: scale(1.15);
}

/* Inventory Section - Hidden */
.trade-inventory-section {
    display: none;
}

/* Item Selection Menu */
.item-selection-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    border-radius: 12px;
    padding: 12px;
    border: 2px solid #555;
    box-shadow: 
        0 25px 50px rgba(0,0,0,0.8),
        0 0 0 1px rgba(100,100,100,0.2),
        inset 0 1px 0 rgba(255,255,255,0.1);
    z-index: 6000;
    max-width: 500px;
    width: 90%;
    max-height: 70vh;
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.item-selection-menu.active {
    display: flex;
    opacity: 1;
}

.item-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.item-menu-header span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.close-item-menu-btn {
    background: rgba(231, 76, 60, 0.8);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-item-menu-btn:hover {
    background: rgba(231, 76, 60, 1);
    transform: scale(1.1);
}

.item-menu-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 1px;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px;
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.3);
}

.inventory-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.trade-inventory-grid {
    display: grid;
    /* PC: 8 cột để item nhỏ gọn hơn */
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 1px;
    max-height: 110px;
    overflow-y: auto;
    overflow-x: hidden; /* Không cho scroll ngang */
    padding: 2px;
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.3);
}

.trade-inventory-grid::-webkit-scrollbar {
    width: 5px;
}

.trade-inventory-grid::-webkit-scrollbar-track {
    background: #000000;
    border-radius: 5px;
}

.trade-inventory-grid::-webkit-scrollbar-thumb {
    background: #000000;
    border-radius: 5px;
}

.trade-inventory-grid::-webkit-scrollbar-thumb:hover {
    background: #1a1a1a;
}

.inventory-item-slot {
    aspect-ratio: 1;
    max-width: 50px;
    max-height: 50px;
    background: linear-gradient(145deg, #444 0%, #333 100%);
    border: 1px solid #555;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    box-shadow: 
        0 2px 6px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.inventory-item-slot:hover {
    border-color: #888;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 6px 15px rgba(150, 150, 150, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2);
    background: linear-gradient(145deg, #555 0%, #444 100%);
}

.inventory-item-slot img {
    width: 100%;
    height: 100%;
    max-width: 45px;
    max-height: 45px;
    object-fit: contain;
    border-radius: 3px;
    padding: 1px;
}

.slot-count {
    position: absolute;
    top: 2px;
    left: 2px;
    background: linear-gradient(135deg, #666, #888);
    color: white;
    font-size: 8px;
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.3);
}

/* Actions Compact */
.trade-actions-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px;
    background: linear-gradient(145deg, #333 0%, #2a2a2a 100%);
    border-radius: 12px;
    border: 2px solid #555;
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.trade-status-compact {
    flex: 1;
    text-align: center;
    font-size: 11px;
    color: #4CAF50;
    font-weight: 600;
}

.cancel-trade-btn.compact,
.execute-trade-btn.compact {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.cancel-trade-btn.compact {
    background: rgba(231, 76, 60, 0.8);
    color: white;
}

.cancel-trade-btn.compact:hover {
    background: rgba(231, 76, 60, 1);
    transform: translateY(-2px);
}

.execute-trade-btn.compact {
    background: rgba(100, 100, 100, 0.5);
    color: rgba(255, 255, 255, 0.6);
}

.execute-trade-btn.compact:not(:disabled):hover {
    background: rgba(46, 204, 113, 1);
    color: white;
    transform: translateY(-2px);
}

.execute-trade-btn.compact.ready {
    background: rgba(46, 204, 113, 0.8);
    color: white;
}

.execute-trade-btn.compact:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Desktop - Larger screens */
@media (min-width: 1024px) {
    .trade-modal-content {
        max-width: 750px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .trade-modal-content {
        width: 95%;
        max-width: 380px;
    }

    .trade-header h3 {
        font-size: 1rem;
    }

    .trade-body {
        padding: 10px;
    }

    .trade-compact-layout {
        padding: 8px;
    }

    .section-title span {
        font-size: 0.7rem;
    }

    /* Vùng BẠN ĐƯA / HỌ ĐƯA: nhiều item thì cuộn dọc trong ô, không kéo cả modal */
    .trade-offer-slots {
        max-height: 140px;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .offer-slot {
        width: 42px;
        height: 42px;
    }

    .offer-slot img {
        width: 35px;
        height: 35px;
    }

    .item-selection-menu {
        max-width: 90%;
        max-height: 80vh;
    }

    .item-menu-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        max-height: 70vh;
    }

    .inventory-item-slot {
        padding: 2px;
    }

    .slot-count {
        font-size: 7px;
        padding: 1px 2px;
    }

    .trade-actions-compact {
        padding: 8px;
        gap: 6px;
    }

    .trade-status-compact {
        font-size: 10px;
    }

    .cancel-trade-btn.compact,
    .execute-trade-btn.compact {
        padding: 8px 12px;
        font-size: 10px;
    }
}

/* Mobile nhỏ (< 480px): ép 3 cột để chắc chắn không tràn ngang */
@media (max-width: 480px) {
    .trade-modal-content {
        width: 96%;
        max-width: 420px;
        box-sizing: border-box;
    }

    .item-menu-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}
/* New RPG Trade Layout Follows */
.rpg-trade-modal-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 2px solid #333333;
    border-radius: 8px;
    padding: 0;
    max-width: 750px;
    width: 90%;
    max-height: 85vh;
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.9),
        inset 0 0 10px rgba(255, 255, 255, 0.05);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Header */
.rpg-trade-header {
    background: linear-gradient(180deg, #2a2a2a 0%, #111111 100%);
    border-bottom: 2px solid #000000;
    padding: 10px 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.rpg-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rpg-star-icon {
    font-size: 24px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.rpg-header-title h2 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9), 0 0 8px rgba(150, 150, 150, 0.5);
    letter-spacing: 2px;
}

.rpg-close-trade {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
    border: 2px solid #7a1b1b;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 100, 100, 0.5);
    transition: all 0.2s ease;
}

.rpg-close-trade:hover {
    filter: brightness(1.2);
}

.rpg-close-trade:active {
    transform: translateY(-50%) scale(0.9);
}

.rpg-close-trade img {
    width: 14px;
    height: 14px;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
}

/* Main Body layout */
.rpg-trade-body {
    display: flex;
    padding: 15px;
    gap: 10px;
    align-items: stretch;
    flex: 1;
}

.rpg-trade-panel {
    flex: 1;
    background: #0d0d0d;
    border: 1px solid #222222;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8);
    position: relative;
}

.rpg-panel-header {
    background: linear-gradient(90deg, transparent 0%, rgba(50, 50, 50, 0.6) 50%, transparent 100%);
    text-align: center;
    padding: 8px;
    font-size: 14px;
    font-weight: bold;
    color: #ffffff;
    border-bottom: 1px solid #1a1a1a;
}

.rpg-panel-content {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
    min-height: 200px;
    overflow-y: auto;
}

/* Scrollbars for RPG panels */
.rpg-panel-content::-webkit-scrollbar { width: 6px; }
.rpg-panel-content::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
.rpg-panel-content::-webkit-scrollbar-thumb { background: #444444; border-radius: 3px; }

/* The Add + button inside Your Trade */
.rpg-add-item-btn {
    width: 50px;
    height: 50px;
    background: rgba(30, 30, 30, 0.8);
    border: 2px solid rgba(80, 80, 80, 0.5);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rpg-add-item-btn:hover {
    background: rgba(50, 50, 50, 0.9);
    border-color: rgba(120, 120, 120, 0.8);
}

.rpg-add-item-btn span {
    color: white;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* Middle connection column */
.rpg-trade-middle {
    width: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.rpg-middle-deco {
    width: 24px;
    height: 24px;
    background: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: bold;
    font-size: 14px;
}

.rpg-arrow-right {
    color: #ffffff;
    font-size: 32px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.rpg-arrow-left {
    color: #ffffff;
    font-size: 32px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.confirm-status-icon {
    font-size: 20px;
}

/* Footer / Actions */
.rpg-trade-actions {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #1a1a1a;
    background: rgba(0, 0, 0, 0.4);
}

.rpg-trade-status {
    flex: 1;
    text-align: center;
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
}

.rpg-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rpg-btn:hover { filter: brightness(1.15); }
.rpg-btn:active { transform: translateY(2px); box-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.rpg-btn:disabled { filter: grayscale(1); opacity: 0.5; cursor: not-allowed; }

.btn-ready, .btn-execute { background: linear-gradient(180deg, #2ecc71 0%, #27ae60 100%); border: 1px solid #1e8449; }
.btn-cancel { background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%); border: 1px solid #922b21; }

/* Overriding inventory grid slots for the trade window */
.rpg-panel-content .offer-slot {
    width: 48px;
    height: 48px;
    background: rgba(15, 15, 15, 0.8);
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}
.rpg-panel-content .offer-slot img {
    width: 100%; height: 100%; padding: 2px; object-fit: contain;
}
.rpg-panel-content .slot-quantity {
    background: rgba(0,0,0,0.8);
    bottom: 2px; right: 2px; top: auto; left: auto;
}

/* Gold Area */
.rpg-gold-area {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.6);
    border-top: 1px solid #1a1a1a;
}

.rpg-gold-area input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-weight: bold;
    font-size: 14px;
    text-align: left;
    width: 100%;
    outline: none;
    padding-right: 5px;
}

.rpg-gold-area span {
    color: #ffffff;
    font-weight: bold;
    flex: 1;
}

.rpg-gold-area .gold-icon {
    width: 16px;
    height: 16px;
}

.rpg-gold-fee {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    margin-left: auto;
}

/* The left-side inventory popup */
.rpg-inventory-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Since modal max-width is 750px (half is 375px), setting right edge to 385px left of center */
    transform: translate(calc(-100% - 385px), -50%);
    width: 300px;
    height: 400px;
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    border: 2px solid #333333;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.9);
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 50;
}

/* If screen is small, hover it over the main modal instead */
@media (max-width: 1100px) {
    .rpg-inventory-popup {
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 9999;
    }
}

.rpg-inventory-popup.active {
    display: flex;
    opacity: 1;
}

.rpg-inventory-header {
    background: linear-gradient(180deg, #2a2a2a 0%, #111111 100%);
    padding: 8px;
    text-align: center;
    border-bottom: 2px solid #000000;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.rpg-inventory-header h3 {
    margin: 0;
    font-size: 16px;
    color: #ffffff;
    text-transform: uppercase;
}

.rpg-inventory-controls {
    display: flex;
    gap: 5px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.5);
}

.rpg-search-input {
    flex: 1;
    background: #050505;
    border: 1px solid #222222;
    border-radius: 4px;
    padding: 6px;
    color: white;
    font-size: 12px;
}

.rpg-qty-btn {
    background: #1a1a1a;
    border: 1px solid #333333;
    color: white;
    border-radius: 4px;
    padding: 4px 10px;
    font-weight: bold;
    cursor: pointer;
}

.rpg-close-inventory-btn {
    background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
    border: none;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    padding: 4px 10px;
    cursor: pointer;
}

.rpg-inventory-grid {
    flex: 1;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: max-content;
    gap: 6px;
    overflow-y: auto;
}

.rpg-inventory-grid::-webkit-scrollbar { width: 5px; }
.rpg-inventory-grid::-webkit-scrollbar-thumb { background: #444444; }

/* Apply button.webp to all buttons */
.rpg-btn, .rpg-close-trade, .rpg-qty-btn, .rpg-close-inventory-btn, .rpg-add-item-btn {
    background: url('../assets/icon/ui/button.webp') center/100% 100% no-repeat !important;
    border: none !important;
    color: white !important;
    box-shadow: none !important;
}

.rpg-close-trade {
    background-color: transparent !important;
}

.rpg-btn:hover, .rpg-close-trade:hover, .rpg-qty-btn:hover, .rpg-close-inventory-btn:hover {
    filter: brightness(1.2) drop-shadow(0 0 5px rgba(255, 255, 255, 0.4)) !important;
}

.rpg-btn:active, .rpg-close-trade:active, .rpg-qty-btn:active, .rpg-close-inventory-btn:active {
    transform: translateY(2px) scale(0.98) !important;
}

.rpg-btn.btn-ready { color: #ffffff !important; }
.rpg-btn.btn-cancel { color: #ffffff !important; }
.rpg-btn.btn-execute { color: #ffffff !important; }

/* Quantity Prompt Modal Styling */
.rpg-qty-modal-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    border: 2px solid #333333;
    border-radius: 8px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9), inset 0 0 10px rgba(255, 255, 255, 0.05);
    padding: 20px;
    width: 320px;
    text-align: center;
    position: relative;
    z-index: 10000;
}

.rpg-qty-header h2 {
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    margin: 0 0 15px 0;
    border-bottom: 1px solid #333333;
    padding-bottom: 10px;
}

.rpg-qty-body p {
    color: #cccccc;
    font-size: 14px;
    margin-bottom: 15px;
}

.rpg-qty-body input {
    width: 60%;
    padding: 10px;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    background: #050505;
    border: 2px solid #222222;
    border-radius: 6px;
    color: #ffffff;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 10px;
}

.rpg-qty-body input:focus {
    border-color: #555555;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
}

.rpg-qty-footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
}

.rpg-qty-footer .rpg-btn {
    flex: 1;
    font-size: 14px;
    padding: 8px 10px;
}

/* Landscape Mode / Short Screen Fixes */
@media (max-height: 500px) {
    .rpg-trade-modal-content { max-height: 98vh; width: 95%; border-width: 1px; }
    .rpg-trade-body { padding: 5px; gap: 5px; }
    .rpg-panel-header { padding: 4px; font-size: 12px; }
    .rpg-panel-content { min-height: 100px; padding: 5px; gap: 4px; }
    .rpg-panel-content .offer-slot { width: 36px; height: 36px; }
    .rpg-trade-actions { padding: 5px 10px; }
    .rpg-trade-header { padding: 5px 10px; }
    .rpg-header-title h2 { font-size: 18px; }
    .rpg-btn { padding: 5px 15px; font-size: 12px; }
    .rpg-add-item-btn { width: 36px; height: 36px; }
    .rpg-add-item-btn span { font-size: 20px; }
    .rpg-gold-area { padding: 4px 5px; }
    .rpg-gold-area input { font-size: 12px; }
    .rpg-inventory-popup { height: 95vh; max-height: 350px; }
    .rpg-qty-modal-content { padding: 10px; }
    .rpg-qty-body p { margin-bottom: 5px; }
    .rpg-qty-body input { padding: 5px; margin-bottom: 5px; }
    .rpg-qty-footer { margin-top: 10px; }
}
