/* Mobile Responsiveness Fixes */

/* Fix white background issue - remove any stray white backgrounds */
.main-wrapper,
.hero,
.results,
.results-content {
    background: transparent !important;
}

/* Ensure proper dark backgrounds where needed */
.value-card {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(18, 18, 18, 0.95) 100%) !important;
}

.top-items-card {
    background-color: var(--bg-elevated) !important;
}

.category-row {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

.search-box {
    background-color: var(--bg-elevated) !important;
}

.item-card:hover {
    background-color: var(--bg-hover) !important;
}

/* Mobile-specific fixes */
@media (max-width: 768px) {
    /* Fix header on mobile */
    .header-content {
        grid-template-columns: auto 1fr !important;
        gap: 12px;
    }
    
    .nav {
        display: none !important; /* Hide nav on mobile - consider hamburger menu later */
    }
    
    .logo span {
        font-size: 20px !important;
    }
    
    .logo img {
        width: 48px !important;
        height: 48px !important;
    }
    
    /* Fix hero section */
    .hero {
        padding: 40px 16px 30px;
    }
    
    .hero-title {
        font-size: 28px !important;
    }
    
    .hero-description {
        font-size: 16px;
    }
    
    /* Fix search box */
    .search-box {
        max-width: 100%;
    }
    
    /* Fix results section */
    .results {
        padding: 16px;
    }
    
    .results-content {
        padding: 0;
    }
    
    /* Fix wide card to stack vertically on mobile */
    .wide-card {
        margin: 0 -16px; /* Full width on mobile */
    }
    
    .wide-card .value-card-content {
        padding: 20px !important;
    }
    
    .chart-categories-flex {
        flex-direction: column !important;
        gap: 30px !important;
    }
    
    /* Fix chart size on mobile */
    .chart-wrapper-large {
        width: 100% !important;
        max-width: 350px !important;
        height: 350px !important;
        position: relative !important;
        margin: 0 auto !important;
    }
    
    /* Ensure canvas is properly sized */
    .chart-wrapper-large canvas {
        max-width: 100% !important;
        max-height: 100% !important;
    }
    
    /* Fix chart center text positioning on mobile */
    .chart-center-text {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        z-index: 10;
        pointer-events: none;
        width: auto !important;
        text-align: center;
    }
    
    .center-value {
        font-size: 2rem !important;
        display: flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
    }
    
    .dollar-sign {
        font-size: 1.8rem !important;
    }
    
    .dollar-amount,
    .cents-amount {
        font-size: 2rem !important;
    }
    
    /* Fix categories section */
    .categories-section {
        width: 100% !important;
        padding: 0 10px;
    }
    
    .section-title {
        font-size: 1.1rem;
        margin-bottom: 16px;
    }
    
    /* Make categories list single column on mobile */
    .categories-list {
        grid-auto-flow: row !important;
        grid-template-columns: 1fr !important;
        grid-template-rows: auto !important;
        gap: 8px !important;
    }
    
    .category-row {
        padding: 10px 12px;
    }
    
    .category-name {
        font-size: 0.9rem;
    }
    
    .category-value {
        font-size: 1rem !important;
    }
    
    .category-count {
        font-size: 0.8rem !important;
    }
    
    /* Fix top items card */
    .top-items-card {
        margin: 20px -16px 0; /* Full width on mobile */
        border-radius: 0;
        padding: 20px 16px;
    }
    
    .card-title {
        font-size: 1.2rem !important;
        margin-bottom: 20px;
    }
    
    /* Fix items grid */
    .items-grid {
        gap: 12px;
    }
    
    .item-card {
        padding: 12px;
        flex-wrap: wrap;
    }
    
    .item-rank {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .item-info {
        flex: 1;
        min-width: 0; /* Allow text to shrink */
        margin-right: 10px;
    }
    
    .item-name {
        font-size: 0.9rem;
        white-space: normal !important; /* Allow wrapping on mobile */
        overflow: visible !important;
        text-overflow: initial !important;
        line-height: 1.3;
    }
    
    .item-meta {
        font-size: 0.8rem;
    }
    
    .item-total-value {
        font-size: 1rem;
        margin-left: auto;
        white-space: nowrap;
    }
    
    /* Fix Steam button */
    .btn-steam {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .btn-steam .steam-logo {
        width: 20px;
        height: 20px;
    }
    
    /* Fix footer */
    .footer {
        padding: 20px 16px;
    }
    
    .footer-content {
        font-size: 0.9rem;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .chart-wrapper-large {
        width: 400px !important;
        height: 400px !important;
    }
    
    .categories-list {
        grid-template-rows: repeat(4, 1fr) !important;
    }
}

/* Small mobile devices (iPhone SE, etc.) */
@media (max-width: 375px) {
    .chart-wrapper-large {
        max-width: 280px !important;
        height: 280px !important;
    }
    
    .center-value {
        font-size: 1.5rem !important;
    }
    
    .dollar-sign {
        font-size: 1.3rem !important;
    }
    
    .dollar-amount,
    .cents-amount {
        font-size: 1.5rem !important;
    }
}

/* Ensure proper scrolling */
html, body {
    overflow-x: hidden;
}

body {
    position: relative;
}

/* Fix any potential white background from main wrapper */
.main-wrapper {
    background: transparent !important;
}

/* Ensure value card has proper styling */
.value-card {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(18, 18, 18, 0.95) 100%) !important;
    backdrop-filter: blur(10px);
}