/* Mobile-specific styles for Ranking Page */
@media (max-width: 768px) {
    /* Fix: Prevent horizontal overflow */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }
    
    /* Fix: Override inline padding-top for mobile navbar */
    .main-content {
        padding-top: 65px !important;
        padding-bottom: 2rem !important;
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }
    
    /* Fix: Ensure containers don't overflow */
    .container,
    .container-fluid {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        max-width: 100% !important;
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* Fix: Ensure text doesn't overflow */
    p, span, div {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    /* Adjust main title font size */
    .ranking-title {
        font-size: 2rem; /* Reduce from default */
        margin-top: 1rem;
        margin-bottom: 1rem;
    }


    /* Ensure ranking cards stack and have proper spacing */
    .row > .col-md-6 {
        padding-left: 10px;
        padding-right: 10px;
    }

    .ranking-card {
        margin-bottom: 2rem;
    }

    /* Adjust card subtitle font size */
    .ranking-subtitle {
        font-size: 1.25rem;
    }

    /* Adjust font size within the ranking list for better readability */
    .ranking-list .list-group-item {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .ranking-list .asset-value {
        font-size: 0.9rem;
    }

    /* Make Swiper navigation buttons smaller and position them better */
    .swiper-button-next,
    .swiper-button-prev {
        width: 28px;
        height: 28px;
    }

    .swiper-button-next::after,
    .swiper-button-prev::after {
        font-size: 14px;
    }
    
    .school-swiper-button-next, .individual-swiper-button-next {
        right: 5px;
    }

    .school-swiper-button-prev, .individual-swiper-button-prev {
        left: 5px;
    }

    /* Fix: rank.css sets .swiper-slide .list-group to 70% width. Use full width on mobile. */
    .swiper-slide .list-group {
        width: 100% !important;
    }

    /* Adjust investment guide accordion */
    .ranking-guide-card .card-title {
        font-size: 1.5rem;
    }

    .accordion-button {
        font-size: 1rem;
        padding: 1rem;
    }

    /* Adjust live clock font size */
    #live-clock-container {
        font-size: 0.8rem;
    }

    /* Ranking tabs mobile adjustments */
    .ranking-tabs {
        padding: 0.3rem;
        margin-bottom: 1rem;
    }

    .ranking-tabs .nav-link {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
        font-weight: 500;
    }

    /* Ranking items mobile adjustments */
    .ranking-item {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }

    .rank-position {
        font-size: 1rem;
        font-weight: 700;
    }

    .rank-name {
        font-size: 0.9rem;
        font-weight: 600;
    }

    .rank-details {
        font-size: 0.75rem;
    }

    .rank-assets {
        font-size: 0.85rem;
        font-weight: 600;
    }
    
}

@media (max-width: 480px) {
    /* Fix: Override inline padding-top for small mobile navbar */
    .main-content {
        padding-top: 60px !important;
        padding-bottom: 2rem !important;
    }
    
    /* Further adjustments for very small screens */
    .ranking-title {
        font-size: 1.8rem;
    }

    .ranking-subtitle {
        font-size: 1.1rem;
    }

    .ranking-list .list-group-item {
        flex-direction: column; /* Stack rank/name and asset value */
        align-items: flex-start !important;
    }

    .ranking-list .asset-value {
        margin-top: 5px;
        font-weight: bold;
    }
    
    .footer .col-md-4, .footer .col-md-2 {
        text-align: center;
    }
    
    .footer .social-icons {
        justify-content: center;
    }

    /* Extra small screens - further tab and ranking adjustments */
    .ranking-tabs .nav-link {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }

    .ranking-item {
        font-size: 0.8rem;
        padding: 0.5rem 0.6rem;
    }

    .rank-position {
        font-size: 0.9rem;
    }

    .rank-name {
        font-size: 0.85rem;
    }

    .rank-details {
        font-size: 0.7rem;
    }

    .rank-assets {
        font-size: 0.8rem;
    }
}
