/* =================================================================
   UNDERGROUND FARMER - MARKET SYSTEM
   ================================================================= */

/* =================================================================
   1. MARKET CONTAINER
   ================================================================= */
#market-area {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
    background: linear-gradient(180deg, #2c1810 0%, #1a0f0a 100%);
}

.market-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* =================================================================
   2. MARKET HEADER
   ================================================================= */
.market-header {
    text-align: center;
    background: linear-gradient(135deg, #654321, #8b4513);
    border: 2px solid #8b4513;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.market-title {
    font-size: 24px;
    color: #f5deb3;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.market-description {
    color: #d2b48c;
    font-size: 14px;
    opacity: 0.9;
}

/* =================================================================
   3. MARKET TABS
   ================================================================= */
.market-tabs {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.market-tab {
    background: linear-gradient(135deg, #654321, #8b4513);
    border: 2px solid #8b4513;
    border-radius: 8px;
    color: #e0d0c0;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.market-tab:hover {
    background: linear-gradient(135deg, #8b4513, #cd853f);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.market-tab.active {
    background: linear-gradient(135deg, #daa520, #ffd700);
    color: #1a0f0a;
    border-color: #ffd700;
}

.market-tab-icon {
    font-size: 16px;
}

/* =================================================================
   4. MARKET CONTENT
   ================================================================= */
.market-content {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #8b4513;
    border-radius: 12px;
    padding: 20px;
    min-height: 400px;
}

.market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

/* =================================================================
   5. MARKET ITEMS
   ================================================================= */
.market-item {
    background: linear-gradient(135deg, #3a2518, #4a2e1d);
    border: 2px solid #654321;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.market-item:hover {
    border-color: #8b4513;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.market-item.affordable {
    border-color: #32cd32;
    box-shadow: 0 0 10px rgba(50, 205, 50, 0.3);
}

.market-item.expensive {
    border-color: #dc143c;
    opacity: 0.7;
}

.market-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.market-item-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid #654321;
}

.market-item-info {
    flex: 1;
}

.market-item-name {
    font-size: 16px;
    font-weight: bold;
    color: #f5deb3;
    margin-bottom: 2px;
}

.market-item-category {
    font-size: 11px;
    color: #d2b48c;
    opacity: 0.8;
}

.market-item-description {
    color: #e0d0c0;
    font-size: 12px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.market-item-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 10px;
}

.price-display {
    display: flex;
    align-items: center;
    gap: 5px;
}

.price-cost {
    font-weight: bold;
    color: #ffd700;
}

.price-resource {
    font-size: 14px;
}

.market-item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.quantity-btn {
    background: #654321;
    border: 1px solid #8b4513;
    color: #e0d0c0;
    width: 30px;
    height: 25px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.quantity-btn:hover {
    background: #8b4513;
}

.quantity-input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #654321;
    color: #e0d0c0;
    text-align: center;
    width: 60px;
    padding: 4px;
    border-radius: 4px;
    font-family: inherit;
}

.buy-btn {
    background: linear-gradient(135deg, #32cd32, #228b22);
    border: 2px solid #228b22;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    width: 100%;
    font-family: inherit;
}

.buy-btn:hover {
    background: linear-gradient(135deg, #228b22, #006400);
    transform: translateY(-1px);
}

.buy-btn:disabled {
    background: #666;
    border-color: #555;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

/* =================================================================
   6. SELL MODE
   ================================================================= */
.sell-mode .market-item {
    background: linear-gradient(135deg, #2a1810, #3a1d10);
}

.sell-mode .buy-btn {
    background: linear-gradient(135deg, #daa520, #cd853f);
    border-color: #cd853f;
}

.sell-mode .buy-btn:hover {
    background: linear-gradient(135deg, #cd853f, #b8860b);
}

/* =================================================================
   7. MARKET STATS
   ================================================================= */
.market-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.market-stat {
    background: linear-gradient(135deg, #654321, #8b4513);
    border: 2px solid #8b4513;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.market-stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.market-stat-label {
    color: #d2b48c;
    font-size: 12px;
}

/* =================================================================
   8. PRICE TRENDS
   ================================================================= */
.price-trend {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.price-trend.up {
    background: rgba(255, 0, 0, 0.2);
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
}

.price-trend.down {
    background: rgba(0, 255, 0, 0.2);
    color: #51cf66;
    border: 1px solid #51cf66;
}

.price-trend.stable {
    background: rgba(255, 255, 0, 0.2);
    color: #ffd43b;
    border: 1px solid #ffd43b;
}

/* =================================================================
   9. RESPONSIVE DESIGN
   ================================================================= */
@media (max-width: 768px) {
    .market-grid {
        grid-template-columns: 1fr;
    }
    
    .market-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .market-tab {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
    
    .market-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    #market-area {
        padding: 10px;
    }
    
    .market-header {
        padding: 15px;
    }
    
    .market-title {
        font-size: 20px;
    }
    
    .market-content {
        padding: 15px;
    }
} 