/* ===================================
   MOBILE OPTIMIZATION - PROFESSIONAL
   Inspired by modern crypto app design
   =================================== */

/* ===================================
   MOBILE BASE LAYOUT FIXES
   Prevents horizontal overflow on all pages
   =================================== */

/* Prevent horizontal overflow globally */
html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    /* Ensure proper box-sizing for all mobile elements */
    box-sizing: border-box;
}

/* Universal box-sizing for all elements */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ===== MOBILE NAVIGATION IMPROVEMENTS ===== */
@media (max-width: 968px) {
    
    /* ===== NAVBAR MOBILE OPTIMIZATION ===== */
    .navbar {
        padding: 0.8rem 0;
    }
    
    .nav-content {
        padding: 0 1rem;
    }
    
    .logo-icon {
        width: 45px;
        height: 45px;
    }
    
    .logo-text {
        font-size: 1.2rem;
    }
    
    /* ===== LAUNCH DEGEN APP BUTTON - PROPERLY SIZED ===== */
    .launch-app-wrapper {
        position: relative;
    }
    
    .launch-degen-app-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
        border-radius: 25px;
        background: var(--gradient-bull);
        border: 2px solid var(--accent);
        color: var(--dark);
        font-weight: 700;
        cursor: pointer;
        transition: all 0.3s ease;
        white-space: nowrap;
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    }
    
    .launch-degen-app-btn:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
    }
    
    .launch-app-badge {
        position: absolute;
        top: -8px;
        right: -8px;
        background: var(--secondary);
        color: white;
        font-size: 0.6rem;
        padding: 2px 6px;
        border-radius: 10px;
        font-weight: 700;
        white-space: nowrap;
        box-shadow: 0 2px 8px rgba(255, 0, 128, 0.4);
    }
    
    /* Hide regular nav menu on mobile */
    .nav-menu {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
        font-size: 1.5rem;
        color: var(--primary);
    }
    
    /* ===== HOME HERO SECTION MOBILE FIX ===== */
    /* Prevent horizontal overflow in hero section */
    .hero {
        min-height: 50vh;
        padding-top: 120px;
        padding-bottom: 2rem;
        overflow-x: hidden;
        width: 100%;
    }
    
    .hero .container {
        padding: 0 1rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .hero-content {
        width: 100%;
        max-width: 100%;
        padding: 0;
        overflow-x: hidden;
    }
    
    /* ===== INDEXES HERO SECTION MOBILE ===== */
    .indexes-hero {
        min-height: 50vh;
        padding-top: 120px;
        padding-bottom: 2rem;
    }
    
    .hero-badge {
        font-size: 0.75rem;
        padding: 0.4rem 1rem;
        margin-bottom: 1rem;
    }
    
    /* Home page hero title mobile sizing */
    .hero-title {
        font-size: 2rem !important;
        margin-bottom: 1rem;
        line-height: 1.2;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .title-main {
        font-size: 1.8rem !important;
        display: block;
        word-wrap: break-word;
    }
    
    .title-degen {
        font-size: 2.5rem !important;
        display: block;
        word-wrap: break-word;
    }
    
    /* Index page specific title sizing */
    .index-ticker {
        font-size: 1.8rem !important;
    }
    
    .index-full-name {
        font-size: 1rem !important;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }
    
    .hero-description {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* ===== HERO BUTTONS MOBILE CENTERING ===== */
    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        align-items: center;
        justify-content: center;
        margin-bottom: 2rem;
    }
    
    .hero-buttons .btn {
        width: 100%;
        max-width: 280px;
        text-align: center;
        justify-content: center;
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
        white-space: nowrap;
    }
    
    /* ===== HERO STATS MOBILE - CONTRACT ADDRESS FIX ===== */
    .hero-stats {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        width: 100%;
        align-items: center;
        padding: 0;
    }
    
    .hero-stats .stat {
        width: 100%;
        text-align: center;
        padding: 0 0.5rem;
    }
    
    /* Fix contract address overflow - main issue */
    .hero-stats .stat-value {
        font-size: 0.75rem !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-all;
        line-height: 1.4;
        padding: 0.5rem;
        max-width: 100%;
        display: block;
        /* Ensure text wraps instead of overflowing */
        white-space: normal;
        hyphens: auto;
    }
    
    .hero-stats .stat-label {
        font-size: 0.85rem;
        margin-top: 0.5rem;
    }
    
    /* ===== ALERT BANNER MOBILE ===== */
    .alert-banner {
        padding: 0.7rem 0;
    }
    
    .alert-content {
        font-size: 0.85rem;
        gap: 0.5rem;
    }
    
    .alert-icon {
        font-size: 1rem;
    }
    
    /* ===== SURPRISE BOX MOBILE ===== */
    .surprise-box {
        padding: 1.5rem 1rem;
        margin-bottom: 2rem;
    }
    
    .surprise-icon {
        font-size: 2.5rem;
        margin-bottom: 0.8rem;
    }
    
    .surprise-box h2 {
        font-size: 1.4rem;
        margin-bottom: 0.8rem;
    }
    
    .surprise-box p {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    /* ===== INDEX CARD MOBILE - APP-STYLE ===== */
    .index-card {
        padding: 1.5rem 1rem;
        margin-bottom: 2rem;
        border-radius: 20px;
    }
    
    .index-header {
        flex-direction: column;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }
    
    .index-info {
        width: 100%;
    }
    
    /* Mobile-friendly index description - SHORTER */
    .index-description {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* Hide detailed text on mobile, show only on desktop */
    .index-description br {
        display: none;
    }
    
    .index-description::after {
        content: "";
        font-weight: 600;
    }
    
    /* ===== VALUE DISPLAY - CARD STYLE ===== */
    .index-value-display {
        width: 100%;
        text-align: center;
        padding: 1.2rem 1rem;
        border-radius: 12px;
        background: linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(26, 31, 58, 0.6));
        border: 2px solid rgba(255, 215, 0, 0.3);
    }
    
    .value-label {
        font-size: 0.75rem;
        margin-bottom: 0.4rem;
    }
    
    .value-number {
        font-size: 2rem !important;
        text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    }
    
    .value-change {
        font-size: 0.9rem;
        margin-top: 0.4rem;
    }
    
    .total-mc {
        margin-top: 0.8rem;
        padding-top: 0.8rem;
    }
    
    .mc-label {
        font-size: 0.75rem;
        margin-bottom: 0.3rem;
    }
    
    .mc-value {
        font-size: 1.2rem;
    }
    
    .update-time {
        font-size: 0.7rem;
        margin-top: 0.4rem;
    }
    
    /* ===== CHART MOBILE ===== */
    .chart-container {
        height: 250px;
        margin-bottom: 2rem;
        padding: 1rem;
        border-radius: 12px;
    }
    
    /* ===== INDEX COMPONENTS - COMPACT MOBILE ===== */
    .index-components {
        margin-top: 2rem;
    }
    
    .index-components h3 {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
    }
    
    .components-description {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }
    
    .components-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* ===== COMPONENT CARDS - APP STYLE ===== */
    .component-card {
        padding: 1rem;
        border-radius: 12px;
        background: linear-gradient(135deg, rgba(0, 0, 0, 0.3), rgba(26, 31, 58, 0.5));
    }
    
    .component-header {
        margin-bottom: 0.8rem;
    }
    
    .component-symbol {
        font-size: 1.1rem;
    }
    
    .component-fullname {
        font-size: 0.8rem;
    }
    
    .component-weight {
        font-size: 0.95rem;
    }
    
    .component-rank {
        top: 8px;
        right: 8px;
        font-size: 0.7rem;
        padding: 3px 6px;
    }
    
    .component-stats {
        gap: 0.8rem;
        margin-top: 0.8rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .stat-value {
        font-size: 0.8rem;
    }
    
    /* ===== COMPOSITION SECTION MOBILE ===== */
    .composition-section {
        padding: 2rem 1rem;
        margin: 2rem 0;
    }
    
    .composition-title {
        font-size: 1.5rem;
        margin-bottom: 0.8rem;
    }
    
    .composition-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    .criteria-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .criteria-card {
        padding: 1.2rem;
    }
    
    .criteria-number {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .criteria-content h4 {
        font-size: 0.95rem;
    }
    
    .criteria-value {
        font-size: 1.5rem;
    }
    
    .criteria-desc {
        font-size: 0.85rem;
    }
    
    /* ===== VERIFICATION BOX MOBILE ===== */
    .verification-box {
        padding: 1.5rem 1rem;
        margin-top: 2rem;
    }
    
    .verification-badge {
        font-size: 1rem;
        padding: 0.6rem 1.5rem;
        gap: 0.6rem;
    }
    
    .verification-badge i {
        font-size: 1.2rem;
    }
    
    .verification-platforms {
        font-size: 0.9rem;
    }
    
    /* ===== METHODOLOGY BOX MOBILE ===== */
    .methodology-box {
        padding: 1.5rem 1rem;
        margin-top: 2rem;
    }
    
    .methodology-box h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .formula-display {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .formula-display code {
        font-size: 0.85rem;
        word-break: break-word;
    }
    
    .methodology-list li {
        font-size: 0.9rem;
        padding: 0.6rem 0;
        padding-left: 1.8rem;
    }
    
    .methodology-list li::before {
        font-size: 1rem;
    }
    
    /* ===== WHY MATTERS SECTION MOBILE ===== */
    .why-matters-section {
        margin-top: 2rem;
    }
    
    .section-title {
        font-size: 1.6rem;
        margin-bottom: 2rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .feature-card {
        padding: 1.2rem;
        border-radius: 12px;
    }
    
    .feature-icon {
        font-size: 2.5rem;
        margin-bottom: 0.8rem;
    }
    
    .feature-card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .feature-card p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* ===== JOIN SECTION MOBILE ===== */
    .join-section {
        padding: 3rem 0;
    }
    
    .join-content h2 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }
    
    .join-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    .cta-box {
        padding: 2rem 1.5rem;
        border-radius: 15px;
    }
    
    .cta-box h3 {
        font-size: 1.4rem;
        margin-bottom: 0.8rem;
    }
    
    .cta-box p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .btn-mega {
        font-size: 1.1rem;
        padding: 1.2rem 2rem;
    }
    
    .disclaimer {
        font-size: 0.85rem;
        margin-top: 1rem;
    }
    
    /* ===== FOOTER MOBILE ===== */
    .footer {
        padding: 2rem 0 1.5rem;
    }
    
    .footer-logo {
        font-size: 1.5rem;
        margin-bottom: 0.8rem;
    }
    
    .footer-text {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }
    
    .footer-links {
        gap: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .copyright {
        font-size: 0.85rem;
    }
    
    .disclaimer-footer {
        font-size: 0.75rem;
        line-height: 1.5;
    }
    
    /* ===== CONTAINER MOBILE ===== */
    .container {
        padding: 0 1rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Ensure all sections respect mobile width */
    section {
        width: 100%;
        overflow-x: hidden;
    }
    
    /* ===== SCROLL INDICATOR MOBILE ===== */
    .scroll-indicator {
        font-size: 1.5rem;
        bottom: 1rem;
    }
}

/* ===== EXTRA SMALL MOBILE (320px - 480px) ===== */
@media (max-width: 480px) {
    
    /* Extra small screens - more aggressive text sizing */
    .title-main {
        font-size: 1.5rem !important;
    }
    
    .title-degen {
        font-size: 2rem !important;
    }
    
    .hero-subtitle {
        font-size: 0.95rem !important;
    }
    
    .hero-description {
        font-size: 0.85rem !important;
    }
    
    .hero-buttons .btn {
        font-size: 0.85rem;
        padding: 0.9rem 1.2rem;
        max-width: 260px;
    }
    
    /* Contract address even smaller on tiny screens */
    .hero-stats .stat-value {
        font-size: 0.65rem !important;
        padding: 0.4rem;
    }
    
    .launch-degen-app-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    .launch-app-badge {
        font-size: 0.55rem;
        padding: 2px 5px;
    }
    
    .hero-badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.8rem;
    }
    
    .index-ticker {
        font-size: 1.5rem !important;
    }
    
    .value-number {
        font-size: 1.6rem !important;
    }
    
    .chart-container {
        height: 200px;
        padding: 0.8rem;
    }
    
    .index-components h3 {
        font-size: 1.1rem;
    }
    
    .component-card {
        padding: 0.8rem;
    }
    
    .composition-title {
        font-size: 1.3rem;
    }
    
    .section-title {
        font-size: 1.4rem;
    }
    
    .cta-box {
        padding: 1.5rem 1rem;
    }
    
    .btn-mega {
        font-size: 1rem;
        padding: 1rem 1.5rem;
    }
}

/* ===== TABLET OPTIMIZATION (769px - 968px) ===== */
@media (min-width: 769px) and (max-width: 968px) {
    
    .components-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
    }
    
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .criteria-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* ===== DESKTOP ONLY - FULL TEXT ===== */
@media (min-width: 969px) {
    /* Desktop keeps full detailed text */
    .index-description::after {
        content: none;
    }
}
