/* Mobile-Optimized Responsive Layout */
/* Desktop: 4 cryptos per row | Mobile: 1 crypto per row */

/* Desktop Layout (1200px and above) - 4 columns */
@media (min-width: 1200px) {
    .crypto-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1rem !important;
    }
    
    .crypto-card {
        max-width: none !important;
        min-width: 280px !important;
        padding: 1.2rem !important;
    }
    
    .container {
        padding: 0 1rem !important;
    }
}

/* Large Desktop (1400px and above) - More comfortable spacing */
@media (min-width: 1400px) {
    .crypto-grid {
        gap: 1.5rem !important;
    }
    
    .crypto-card {
        padding: 1.5rem !important;
    }
}

/* Compressed Desktop (1000px to 1199px) - 4 columns tight */
@media (min-width: 1000px) and (max-width: 1199px) {
    .crypto-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.5rem !important;
    }
    
    .crypto-card {
        padding: 0.8rem !important;
        min-width: 240px !important;
        min-height: 450px !important;
        font-size: 0.9rem !important;
    }
    
    .container {
        padding: 0 0.5rem !important;
    }
    
    /* Compress chart area */
    .chart-container {
        min-height: 250px !important;
    }
    
    .chart-placeholder {
        height: 250px !important;
    }
    
    /* Smaller text in tight layout */
    .crypto-title {
        font-size: 1.1rem !important;
    }
    
    .current-rate {
        font-size: 0.9rem !important;
        min-width: 60px !important;
    }
    
    .high-low-value {
        font-size: 0.8rem !important;
    }
}

/* Tablet Layout (768px to 999px) - 2 columns */
@media (min-width: 768px) and (max-width: 999px) {
    .crypto-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
        max-width: 100% !important;
    }
    
    .crypto-card {
        max-width: none !important;
        min-width: 300px !important;
        padding: 1.2rem !important;
    }
    
    .container {
        padding: 0 1rem !important;
    }
    
    /* Adjust header for tablet */
    .header-content {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .header-ad-space {
        min-width: 300px !important;
        min-height: 60px !important;
    }
    
    /* Adjust navigation for tablet */
    .nav-menu {
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
    
    .nav-link {
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
    }
}

/* Mobile Layout (767px and below) - 1 COLUMN ONLY */
@media (max-width: 767px) {
    /* SINGLE COLUMN LAYOUT FOR MOBILE */
    .crypto-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    .crypto-card {
        max-width: 100% !important;
        min-width: auto !important;
        padding: 1rem !important;
        min-height: auto !important;
        margin: 0 !important;
    }
    
    .container {
        padding: 0 0.5rem !important;
    }
    
    /* Mobile Header Adjustments */
    .header-content {
        flex-direction: column !important;
        gap: 0.5rem !important;
        padding: 0.5rem 0 !important;
    }
    
    .logo-section {
        flex-direction: column !important;
        text-align: center !important;
        gap: 0.5rem !important;
    }
    
    .logo {
        height: 60px !important;
    }
    
    .title-section h1 {
        font-size: 1.5rem !important;
    }
    
    .site-subtitle {
        font-size: 0.8rem !important;
    }
    
    .header-ad-space {
        min-width: 280px !important;
        min-height: 50px !important;
        font-size: 0.75rem !important;
    }
    
    /* Mobile Navigation */
    .nav-menu {
        flex-direction: column !important;
        gap: 0 !important;
        width: 100% !important;
    }
    
    .nav-link {
        padding: 0.75rem 1rem !important;
        justify-content: center !important;
        border-radius: 0 !important;
        border-bottom: 1px solid var(--gray-200) !important;
        font-size: 0.9rem !important;
    }
    
    .nav-link:last-child {
        border-bottom: none !important;
    }
    
    /* Mobile Dashboard Adjustments */
    .market-summary-header {
        flex-direction: column !important;
        padding: 1rem !important;
        gap: 1rem !important;
    }
    
    .summary-stats {
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100% !important;
    }
    
    .stat-item {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.5rem 0 !important;
        border-bottom: 1px solid var(--gray-200) !important;
    }
    
    .stat-item:last-child {
        border-bottom: none !important;
    }
    
    .stat-label {
        font-size: 0.9rem !important;
        text-align: left !important;
    }
    
    .stat-value {
        font-size: 1rem !important;
        text-align: right !important;
    }
    
    .dashboard-actions {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.5rem !important;
    }
    
    .btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.75rem !important;
    }
    
    /* Mobile Educational Snippet */
    .educational-snippet {
        padding: 1rem !important;
        text-align: left !important;
    }
    
    .educational-snippet h3 {
        font-size: 1.2rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .educational-snippet p {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
    }
    
    /* Mobile Crypto Card Adjustments */
    .crypto-header {
        margin-bottom: 1rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    .crypto-info {
        gap: 0.5rem !important;
    }
    
    .crypto-icon {
        font-size: 1.25rem !important;
    }
    
    .crypto-title {
        font-size: 1.1rem !important;
    }
    
    .opportunity-badge {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.7rem !important;
    }
    
    .download-btn {
        padding: 0.4rem !important;
        font-size: 1rem !important;
    }
    
    /* Mobile Exchange Data */
    .exchange-row {
        padding: 10px 0 !important;
        margin: 6px 0 !important;
        flex-wrap: wrap !important;
    }
    
    .exchange-left {
        flex: 1 !important;
        min-width: 120px !important;
        padding-left: 12px !important;
    }
    
    .exchange-name {
        font-size: 0.8rem !important;
    }
    
    .current-rate {
        font-size: 14px !important;
        min-width: 70px !important;
        max-width: 70px !important;
        margin: 0 10px !important;
    }
    
    .high-low-container {
        gap: 10px !important;
        padding-right: 12px !important;
        min-width: 100px !important;
    }
    
    .high-low-item {
        font-size: 0.7rem !important;
    }
    
    .high-low-value {
        max-width: 40px !important;
    }
    
    /* Mobile Chart Container */
    .chart-container {
        min-height: 200px !important;
    }
    
    .chart-placeholder {
        height: 200px !important;
    }
    
    /* Mobile Data Info */
    .data-info {
        margin-top: 0.75rem !important;
        padding-top: 0.75rem !important;
    }
    
    .data-points {
        font-size: 0.8rem !important;
    }
    
    /* Mobile Main Content */
    .main-content {
        padding: 1rem 0 !important;
    }
    
    .dashboard-container {
        padding: 0 !important;
    }
}

/* Extra Small Mobile (480px and below) */
@media (max-width: 480px) {
    .crypto-card {
        padding: 0.75rem !important;
    }
    
    .crypto-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }
    
    .card-actions {
        align-self: flex-end !important;
    }
    
    .exchange-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
        padding: 8px 12px !important;
    }
    
    .exchange-left {
        width: 100% !important;
        padding-left: 0 !important;
    }
    
    .current-rate {
        margin: 0 !important;
        text-align: left !important;
        min-width: auto !important;
        max-width: none !important;
    }
    
    .high-low-container {
        width: 100% !important;
        justify-content: flex-start !important;
        padding-right: 0 !important;
        min-width: auto !important;
    }
    
    .chart-container {
        min-height: 150px !important;
    }
    
    .chart-placeholder {
        height: 150px !important;
    }
}

/* Highest Funding Rate Banner - Mobile Optimizations */
@media (max-width: 767px) {
    .highest-crypto-banner {
        padding: 1rem !important;
        margin: 1rem 0 !important;
        font-size: 1.2rem !important;
    }
    
    .banner-text-inline {
        flex-direction: column !important;
        gap: 0.5rem !important;
        text-align: center !important;
    }
    
    .banner-text-inline .trophy-icon {
        font-size: 1.5rem !important;
    }
    
    .banner-text-inline .rate-label {
        font-size: 0.9rem !important;
    }
    
    .banner-text-inline .crypto-symbol {
        font-size: 1.3rem !important;
    }
    
    .banner-text-inline .rate-value {
        font-size: 1.1rem !important;
    }
}

/* Force layout fixes for very small screens */
@media (max-width: 360px) {
    .container {
        padding: 0 0.25rem !important;
    }
    
    .crypto-card {
        padding: 0.5rem !important;
        min-height: auto !important;
    }
    
    .crypto-title {
        font-size: 1rem !important;
    }
    
    .exchange-name {
        font-size: 0.75rem !important;
    }
    
    .current-rate {
        font-size: 12px !important;
    }
    
    .high-low-item {
        font-size: 0.65rem !important;
    }
}

/* Ensure no horizontal overflow */
* {
    max-width: 100% !important;
}

html, body {
    overflow-x: hidden !important;
}

.crypto-grid {
    overflow-x: visible !important;
}

/* Print styles */
@media print {
    .crypto-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    .crypto-card {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
    
    .chart-container {
        display: none !important;
    }
}

