/* ==============================================
   MOBILE RESPONSIVE FIXES - CRITICAL UPDATES
   ============================================== */

/* Enhanced Mobile Media Queries */
@media (max-width: 768px) {

    /* === TYPOGRAPHY === */
    h1 {
        font-size: 1.8rem !important;
        /* Reduced from 2.5rem */
        line-height: 1.2 !important;
    }

    h2 {
        font-size: 1.6rem !important;
    }

    p {
        font-size: 1rem !important;
    }

    /* === HEADER & NAVIGATION === */
    :root {
        --header-height: 80px;
        /* Reduced from 140px */
    }

    .header {
        height: 80px;
    }

    .top-bar {
        display: none;
        /* Hide lottery balls bar on mobile */
    }

    .header-container {
        justify-content: space-between;
        padding: 0 1rem;
    }

    .logo img {
        height: 50px !important;
    }

    /* Hamburger Menu */
    .nav {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 280px;
        height: calc(100vh - 80px);
        background: #ffffff;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transition: left 0.3s ease;
        z-index: 999;
        overflow-y: auto;
    }

    .nav.active {
        left: 0;
    }

    .nav ul {
        flex-direction: column;
        padding: 2rem 0;
        gap: 0;
    }

    .nav li {
        border-bottom: 1px solid #e2e8f0;
    }

    .nav a {
        display: block;
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        color: #334155 !important;
        font-weight: 700;
        border-bottom: 1px solid #f1f5f9;
        text-align: left;
    }

    .nav a:hover {
        background: #f8fafc;
        color: #004799 !important;
    }

    .nav a::after {
        display: none;
        /* Remove underline animation */
    }

    /* Hide 3D Ticket Visual on Mobile (Too much space/broken) */
    .simulator-visual {
        display: none !important;
    }

    /* Prize Table Mobile Redesign (Card Layout) - Replaces scroll fix */
    .prize-breakdown-container {
        overflow: visible;
    }

    .prize-table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    .prize-table thead {
        display: none;
        /* Hide headers */
    }

    .prize-table tr {
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        margin-bottom: 1.5rem;
        padding: 1.5rem;
        display: flex !important;
        /* Switch to Flex for robust wrapping */
        flex-wrap: wrap;
        align-items: center;
        gap: 0;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
        position: relative;
    }

    .prize-table td {
        border: none;
        padding: 0.5rem 0;
        text-align: left;
        display: block;
        box-sizing: border-box;
    }

    /* Column 1: Class (Top Left - 50%) */
    .prize-table td:nth-child(1) {
        width: 50%;
        font-weight: 700;
        color: #64748b;
        font-size: 0.9rem;
        order: 1;
    }

    .prize-table td:nth-child(1)::before {
        content: "Class ";
        font-weight: 400;
        opacity: 0.7;
    }

    /* Column 4: Prize (Top Right - 50%) */
    .prize-table td:nth-child(4) {
        width: 50%;
        text-align: right;
        font-weight: 800;
        color: #005fcc;
        font-size: 1.1rem;
        order: 2;
        padding: 0.75rem 0;
        /* Increased vertical padding */
    }

    /* Column 2: Match Visual (Middle - 100%) */
    .prize-table td:nth-child(2) {
        width: 100%;
        order: 3;
        display: flex;
        justify-content: center;
        padding: 1.75rem 1rem;
        /* Increased vertical breathing room */
        background: #f8fafc;
        border-radius: 12px;
        margin: 1.25rem 0;
    }

    .prize-table td:nth-child(2) .match-cell {
        justify-content: center;
    }

    /* Column 3: Winners (Bottom - 100%) */
    .prize-table td:nth-child(3) {
        width: 100%;
        order: 4;
        text-align: right;
        /* Align right to match user preference/screenshot hint */
        font-size: 0.85rem;
        color: #64748b;
        border-top: 1px dashed #e2e8f0;
        padding: 1.75rem 0 1rem 0;
        /* More space above and below the winners count */
        margin-top: 0.5rem;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 0.25rem;
    }

    /* Localization via html lang attribute */
    html[lang="de"] .prize-table td:nth-child(1)::before {
        content: "Klasse ";
    }

    html[lang="en"] .prize-table td:nth-child(3)::before {
        content: "Winners: ";
    }

    html[lang="de"] .prize-table td:nth-child(3)::before {
        content: "Gewinner: ";
    }

    /* Hamburger Button */
    .hamburger {
        display: flex !important;
        flex-direction: column;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
    }

    .hamburger span {
        width: 25px;
        height: 3px;
        background: #334155;
        transition: all 0.3s ease;
        border-radius: 2px;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    /* Overlay when menu is open */
    .nav-overlay {
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        height: calc(100vh - 80px);
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 998;
    }

    .nav-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    /* === HERO & SUB-HERO SECTIONS === */
    .hero {
        min-height: 60vh;
        padding-top: 120px;
        /* Increased from 80px to add breathing room for H1 */
        padding-bottom: 2rem;
    }

    .hero-content {
        padding: 1rem;
    }

    .sub-hero {
        min-height: auto !important;
        padding-top: calc(80px + 2rem) !important;
        padding-bottom: 2rem !important;
    }

    .sub-hero-content {
        flex-direction: column !important;
        gap: 2rem !important;
        padding-bottom: 1rem !important;
    }

    .sub-hero-text {
        text-align: center;
        max-width: 100% !important;
    }

    .sub-hero-text h1 {
        font-size: 2rem !important;
    }

    .sub-hero-text p {
        font-size: 1.1rem !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .hero-benefits {
        justify-content: center;
    }

    .hero-benefits li {
        font-size: 0.95rem !important;
    }

    /* === OFFER CARDS === */
    .offer-card {
        padding: 1.5rem !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    .jackpot-highlight {
        font-size: 2.5rem !important;
    }

    .btn-offer {
        font-size: 1.1rem !important;
        padding: 0.875rem 1.5rem !important;
    }

    /* === CONTAINER & SPACING === */
    .container {
        padding: 0 1rem;
    }

    .main-content {
        padding: 3rem 0 !important;
    }

    /* === GRIDS === */
    .features-grid,
    .stats-grid,
    .news-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* === FOOTER === */
    .footer {
        padding: 3rem 0 2rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }

    .responsible-tag {
        flex-direction: column;
        gap: 0.5rem;
    }

    .separator {
        display: none;
    }

    select,
    button {
        font-size: 16px !important;
        /* Prevents iOS zoom */
    }

    /* === TOUCH TARGETS === */
    .btn,
    .nav a,
    button,
    a.button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Reduce gap between Spin Wheel and GO Widget */
    .secondary-cta-section {
        padding-bottom: 1.5rem !important;
    }

    .go-section {
        margin-top: 0 !important;
        margin-bottom: 1rem !important;
        /* Reduced from 4rem */
    }

    .faq-section {
        padding-top: 1rem !important;
    }

    /* === WHATSAPP STICKY BUTTON (MOBILE ONLY) === */
    .whatsapp-sticky {
        position: fixed;
        bottom: 20px;
        right: 20px;
        background-color: #25D366;
        color: white;
        border-radius: 50px;
        padding: 12px 20px;
        display: flex;
        align-items: center;
        gap: 10px;
        box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
        z-index: 9999;
        text-decoration: none;
        font-weight: 700;
        font-size: 0.9rem;
        transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        animation: popIn 0.5s 1s backwards;
    }

    .whatsapp-sticky:hover {
        transform: scale(1.05);
    }

    /* EuroMillions GO Widget Mobile */
    .go-widget-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        text-align: center;
    }

    .whatsapp-icon {
        width: 24px;
        height: 24px;
        fill: white;
    }

    /* Fix overlap in 'How to Play' cards */
    .sim-step {
        padding-right: 70px !important;
        /* Ensure text creates space for the badge */
        transform: none !important;
        /* Disable desktop hover/active shift */
    }

    .sim-step.active {
        transform: none !important;
        box-shadow: 0 10px 30px rgba(0, 71, 153, 0.1) !important;
        /* Subtler shadow for mobile */
    }

    .sim-step h3 {
        font-size: 1.4rem !important;
        /* Slightly smaller text */
        line-height: 1.2;
    }

    .sim-step .step-number {
        position: absolute;
        top: 20px;
        right: 20px;
        transform: none !important;
        /* Reset any desktop transforms */
        margin: 0 !important;
    }

}

/* End mobile media query */

/* Extra Small Devices (320px - 375px) */
@media (max-width: 375px) {
    h1 {
        font-size: 1.5rem !important;
    }

    .jackpot-highlight {
        font-size: 2rem !important;
    }

    .offer-card {
        padding: 1rem !important;
    }

    .container {
        padding: 0 0.75rem;
    }
}

/* Tablet Portrait (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .sub-hero-content {
        gap: 2rem;
    }

    .offer-card {
        max-width: 380px;
    }
}

/* =================================================================
   comparison-table-fix
   ================================================================= */
@media (max-width: 768px) {

    /* 1. Reset Container */
    .faq-answer-inner {
        overflow: visible !important;
        padding: 0 0 1.5rem 0 !important;
        /* Restored padding-bottom */
        margin: 0 !important;
    }

    /* 2. Target Table (High Specificity) */
    table.mini-odds-table,
    .faq-content table.mini-odds-table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        /* Override inline styles */
        min-width: 0 !important;
        border: none !important;
        margin: 0 !important;
        border-collapse: separate !important;
    }

    /* 3. Hide Headers */
    table.mini-odds-table thead,
    .faq-content table.mini-odds-table thead {
        display: none !important;
    }

    /* 4. Force Rows to be Flex Cards */
    table.mini-odds-table tbody,
    table.mini-odds-table tr,
    .faq-content table.mini-odds-table tbody,
    .faq-content table.mini-odds-table tr {
        display: flex !important;
        flex-wrap: wrap !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    table.mini-odds-table tr {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 12px !important;
        margin-bottom: 1rem !important;
        padding: 1rem !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
    }

    /* 5. Cells Layout */
    table.mini-odds-table td,
    .faq-content table.mini-odds-table td {
        display: block !important;
        padding: 0.5rem 0 !important;
        border: none !important;
        background: transparent !important;
        box-sizing: border-box !important;
    }

    /* Col 1: FEATURE TITLE (Full Width) */
    table.mini-odds-table tr td:first-child {
        width: 100% !important;
        text-align: left !important;
        font-size: 1.1rem !important;
        font-weight: 800 !important;
        color: #1e293b !important;
        border-bottom: 2px solid #e2e8f0 !important;
        margin-bottom: 1rem !important;
        padding-bottom: 0.5rem !important;
    }

    /* Col 2: EuroMillions (Left 50%) */
    table.mini-odds-table tr td:nth-child(2) {
        width: 50% !important;
        display: inline-block !important;
        /* Side by side */
        text-align: left !important;
        font-size: 1rem !important;
        color: #005fcc !important;
        font-weight: 700 !important;
    }

    table.mini-odds-table tr td:nth-child(2)::before {
        content: "EuroMillions";
        display: block;
        font-size: 0.75rem;
        color: #64748b;
        text-transform: uppercase;
        font-weight: 600;
        margin-bottom: 4px;
    }

    /* Col 3: EuroJackpot (Right 50%) */
    table.mini-odds-table tr td:nth-child(3) {
        width: 50% !important;
        display: inline-block !important;
        /* Side by side */
        text-align: right !important;
        font-size: 1rem !important;
        color: #d97706 !important;
        font-weight: 700 !important;
    }

    table.mini-odds-table tr td:nth-child(3)::before {
        content: "EuroJackpot";
        display: block;
        font-size: 0.75rem;
        color: #64748b;
        text-transform: uppercase;
        font-weight: 600;
        margin-bottom: 4px;
    }
}

/* =========================================
   MOBILE NAV FIX (Ported from index.html)
   ========================================= */
@media (max-width: 768px) {
    .nav {
        display: block !important;
        position: fixed !important;
        top: 80px !important;
        left: -100% !important;
        width: 100% !important;
        height: 100vh !important;
        background: #ffffff !important;
        z-index: 999999 !important;
        transition: left 0.3s ease !important;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .nav.active {
        left: 0 !important;
    }

    .nav ul {
        flex-direction: column !important;
        padding: 2rem 0 !important;
        background: #ffffff !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .nav a {
        color: #005fcc !important;
        font-size: 1.25rem !important;
        font-weight: 600 !important;
        padding: 1rem 2rem !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.03) !important;
        display: flex !important;
        align-items: center !important;
        text-decoration: none !important;
        transition: background 0.2s ease !important;
    }

    .nav a:active {
        background-color: #f1f8ff !important;
    }

    .nav a:hover {
        background-color: #f8fafc !important;
        color: #004799 !important;
    }

    .nav-icon {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 32px !important;
        height: 32px !important;
        margin-right: 12px !important;
        color: #005fcc !important;
        background: rgba(0, 95, 204, 0.05) !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
    }

    .nav-icon svg {
        width: 20px !important;
        height: 20px !important;
        stroke-width: 2 !important;
    }
}

/* =========================================
   SUB-HERO MOBILE ALIGNMENT FIX
   ========================================= */
@media (max-width: 900px) {
    .sub-hero-content {
        flex-direction: column !important;
        text-align: center !important;
        justify-content: center !important;
    }

    .sub-hero-text {
        text-align: center !important;
        margin-bottom: 2rem !important;
        align-items: center !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .sub-hero-cta {
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
    }

    .hero-benefits {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .hero-benefits li {
        justify-content: center !important;
    }
}

/* =========================================
   STATS TABLE RESPONSIVE (Generic Card View)
   ========================================= */
@media (max-width: 768px) {
    .stats-table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        border: none !important;
    }

    .stats-table thead {
        display: none !important;
    }

    .stats-table tbody,
    .stats-table tr {
        display: block !important;
        width: 100% !important;
    }

    .stats-table tr {
        background: #ffffff !important;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        margin-bottom: 1.5rem;
        padding: 1.25rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
        position: relative;
    }

    /* Add a subtle striping or hover effect if desired, generally whitespace is better on mobile */
    .stats-table tr:nth-child(even) {
        background: #fcfcfc !important;
    }

    .stats-table td {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        text-align: right !important;
        padding: 0.75rem 0 !important;
        border-bottom: 1px dashed #e2e8f0;
        font-size: 0.95rem;
        color: #1e293b;
        overflow-wrap: break-word;
        /* Allow wrapping */
        word-break: break-word;
    }

    .stats-table td:last-child {
        border-bottom: none;
    }

    .stats-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #64748b;
        text-transform: uppercase;
        font-size: 0.8rem;
        letter-spacing: 0.5px;
        text-align: left;
        margin-right: 1rem;
        /* flex: 1; Removed to prevent pushing content off-screen */
        max-width: 50%;
        /* Cap label width */
    }
}

/* Info Section Grid Mobile Override */
@media (max-width: 768px) {
    .info-section-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
}

/* Analyzer Balls Mobile Override */
@media (max-width: 480px) {
    .analyzer-ball {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        font-size: 1rem !important;
        line-height: 34px !important;
    }

    .analyzer-container {
        gap: 0.25rem !important;
    }

    .analyzer-plus {
        font-size: 1.5rem !important;
        margin: 0 0.25rem !important;
    }
}

/* Superdraw Card Mobile Override */
@media (max-width: 768px) {
    .superdraw-tracker-card {
        padding: 1.25rem !important;
        gap: 1.5rem !important;
        flex-direction: column;
        align-items: stretch !important;
    }

    .superdraw-info {
        width: 100%;
        gap: 1rem !important;
        justify-content: center;
    }

    .superdraw-progress {
        min-width: unset !important;
        width: 100% !important;
    }
}

/* Patterns Section Mobile Fix */
@media (max-width: 768px) {
    .patterns-wrapper {
        flex-direction: column;
        gap: 1.5rem !important;
        text-align: center;
    }

    .patterns-text {
        width: 100%;
        min-width: unset;
        padding: 0 1rem;
        /* Ensure centered text feels balanced */
    }

    .patterns-widget-container {
        width: 100%;
        justify-content: center;
    }
}

/* News Articles Mobile Optimization */
@media (max-width: 768px) {
    .article-container {
        padding: 1.5rem !important;
        margin: 0 1rem !important;
        width: auto !important;
    }

    .article-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 2rem !important;
    }

    .article-sidebar,
    .cta-sidebar {
        position: static !important;
        width: 100% !important;
        max-width: none !important;
    }

    .article-title {
        font-size: 1.8rem !important;
        line-height: 1.3 !important;
        margin-bottom: 1rem !important;
        word-wrap: break-word !important;
    }

    .article-featured-image {
        min-height: 200px !important;
        height: auto !important;
        margin: 1.5rem 0 !important;
    }

    .article-content {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }

    .article-content h2 {
        font-size: 1.4rem !important;
        margin-top: 1.5rem !important;
    }

    .article-meta {
        font-size: 0.85rem !important;
        gap: 1rem !important;
    }

    /* Fix breadcrumb overflow */
    .container nav {
        white-space: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        display: flex;
        /* Ensure items stay in a row */
        align-items: center;
    }

    .container nav a,
    .container nav span {
        flex-shrink: 0;
        /* Prevent shrinking */
    }
}

/* Draw Simulation Mobile Fixes */
@media (max-width: 480px) {
    .ball-tray {
        gap: 6px !important;
        /* Reduce gap */
        padding: 0.5rem !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
    }

    .tray-slot {
        width: 32px !important;
        height: 32px !important;
        flex-shrink: 0 !important;
        /* Prevent squashing */
    }

    .sim-ball {
        font-size: 0.85rem !important;
    }
}