/* Trade container layout */
/* Trade container overrides */
.game-modal-container.trade-modal {
    max-width: 1400px;
    width: 95vw;
    max-height: 90%;
    height: 90%;
}

.trade-modal .game-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.trade-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 15px;
    overflow: hidden;
}

.trade-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.trade-column {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #444;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.column-header {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: #ffd700;
    text-align: center;
    border-bottom: 1px solid #444;
    padding-bottom: 0.5rem;
    flex-shrink: 0;
}

.search-bar {
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--game-border-color);
    color: var(--game-text-primary);
    font-family: var(--game-font-main);
    font-size: 0.95rem;
    clip-path: var(--game-clip-path-sm);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.search-bar:focus {
    outline: none;
    border-color: #6bb9f0;
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 10px rgba(107, 185, 240, 0.2);
}

.trade-inventory-grid {
    display: grid;
    grid-auto-rows: max-content;
    /* Ensure rows don't stretch */
    grid-template-columns: repeat(auto-fill, 90px);
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    overflow-y: auto;
}

.trade-item-card {
    position: relative;
    aspect-ratio: 1;
    background: var(--game-bg-card);
    border: 1px solid var(--game-border-color);
    clip-path: var(--game-clip-path);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    box-shadow: var(--game-shadow-sm);
    width: 90px;
    height: 90px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.trade-item-card:hover {
    border-color: #63b3ed;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    z-index: 10;
}

.trade-item-card.text-tier-0 {
    border-color: #a0aec0;
}

.trade-item-card.text-tier-1 {
    border-color: #ffffff;
}

.trade-item-card.text-tier-2 {
    border-color: #68d391;
}

.trade-item-card.text-tier-3 {
    border-color: #63b3ed;
}

.trade-item-card.text-tier-4 {
    border-color: #9f7aea;
}

.trade-item-card.text-tier-5 {
    border-color: #ed8936;
}

.trade-item-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    /* Margins inside container */
}

.trade-item-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    z-index: 1;
}



.trade-item-value {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: rgba(0, 0, 0, 0.7);
    /* Keep visible background for value */
    color: #ffd700;
    font-size: 0.7rem;
    padding: 1px 4px;
    clip-path: var(--game-clip-path-sm);
    font-weight: bold;
    pointer-events: none;
}

/* Cart Grid - Slightly different or same? User checked inventory grid, so same is safe for source lists. 
   Cart lists might need to remain distinct or use same style. 
   Currently they use same .trade-item-card class, so they will inherit this. */
.cart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    /* Smaller for cart? */
    gap: 0.5rem;
    padding: 0.5rem;
    overflow-y: auto;
    max-height: 200px;
}

.trade-center-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: hidden;
}

.trade-cart-section {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #444;
    padding: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 90px);
    justify-content: center;
    grid-auto-rows: max-content;
    gap: 0.5rem;
    overflow-y: auto;
    padding-right: 5px;
    margin-top: 10px;
    align-content: start;
}

.trade-list-header {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #ddd;
    display: flex;
    justify-content: space-between;
}

.cart-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-right: 0.25rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.cart-item:hover {
    background: rgba(255, 0, 0, 0.2);
}

.trade-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #444;
}

.trade-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.1rem;
}

.trade-total {
    font-weight: bold;
    color: #ffd700;
}

.trade-action-btn {
    padding: 0.75rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    background: linear-gradient(to bottom, #4caf50, #2e7d32);
    border: none;
    color: white;
    cursor: pointer;
    clip-path: var(--game-clip-path);
}

.trade-action-btn:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.7;
}

.quantity-modal {
    background: #2d3748;
    padding: 1rem;
    border: 1px solid #4a5568;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    clip-path: var(--game-clip-path);
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-input {
    width: 60px;
    text-align: center;
    padding: 0.25rem;
    background: #1a202c;
    border: 1px solid #4a5568;
    color: white;
    border-radius: 0;
}