/* =========================================
   4. MOBILE & RESPONSIVE STYLES
   ========================================= */

/* Mobile Menu Styles */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 26px;
    color: var(--primary);
    cursor: pointer;
    padding: 0 10px 0 0;
}

.mobile-side-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    background: #ffffff;
    z-index: 2000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.mobile-side-menu.open {
    left: 0;
}

.mobile-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
    backdrop-filter: blur(3px);
}

.mobile-nav-link {
    padding: 14px 0;
    border-bottom: 1px solid #f1f1f1;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-main);
    display: block;
}

.mobile-nav-link:hover {
    color: var(--primary);
}

.mobile-auth-btn {
    margin-top: 15px;
    width: 100%;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
}

/* Tablet/Desktop Breakpoint */
@media (max-width: 900px) {
    .hamburger-btn {
        display: block;
    }

    .nav-links,
    .nav-actions {
        display: none !important;
    }

    .nav {
        justify-content: space-between;
        padding: 12px 18px;
    }

    .hero,
    .two-col,
    .dash-layout,
    .report-layout-container {
        grid-template-columns: minmax(0, 1fr);
        flex-direction: column;
    }

    .left-panel {
        width: 100%;
        margin-bottom: 20px;
    }

    /* Report Mobile Fixes */
    #full-report-tool .input-area {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100% !important;
    }

    #full-report-tool .input-area input {
        grid-column: 1 / -1;
        width: 100% !important;
    }

    #full-report-tool .input-area button {
        width: 100%;
        margin: 0 !important;
        font-size: 13px;
        justify-content: center;
    }

    #full-report-tool .input-area:has(#pdfBtn[style*="none"]) button {
        grid-column: 1 / -1;
    }

    /* Tabs */
    #normalTabGroup:not([style*="none"]) {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100% !important;
    }

    #normalTabGroup .tab-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
        border-radius: 30px;
        margin: 0;
    }

    #normalTabGroup .range-btn {
        grid-column: 1 / -1;
        width: 100%;
        margin-top: 5px;
        background-color: #f1f2f6;
    }

    #normalTabGroup>div[style*="width:1px"] {
        display: none !important;
    }

    #freeTabGroup:not([style*="none"]) {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100% !important;
        margin-top: 10px;
    }

    #freeTabGroup .tab-btn,
    #freeTabGroup .range-btn {
        width: 100%;
        justify-content: center;
        border-radius: 30px;
        margin: 0;
    }

    #freeTabGroup>div[style*="width:1px"] {
        display: none !important;
    }

    /* Force Dasha Cards Full Width */
    #full-report-tool #gridContainer,
    #full-report-tool .dasha-container {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        padding: 0 !important;
        gap: 20px !important;
    }

    #full-report-tool .d-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 15px 0 !important;
        flex: none !important;
    }

    #full-report-tool .mini-grid,
    #full-report-tool .mini-cell {
        width: 100% !important;
    }

    /* Comparison Table Refinements */
    .comparison-table {
        font-size: 11px !important;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 8px 4px !important;
        text-align: center;
    }

    .comparison-table .col-feature {
        max-width: 80px;
        font-weight: 600;
        text-align: left;
    }

    /* WhatsApp Float Fix */
    .whatsapp-float {
        width: 45px !important;
        height: 45px !important;
        bottom: 15px !important;
        right: 15px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .whatsapp-float svg {
        width: 24px !important;
        height: 24px !important;
    }

    #full-report-tool .right-panel {
        width: 100% !important;
        flex: none !important;
    }

    /* Trust Grid */
    .trust-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Admin Layout */
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        display: flex;
        overflow-x: auto;
        padding: 10px;
        border-bottom: 1px solid #ccc;
        border-right: none;
    }

    .admin-menu-item {
        white-space: nowrap;
        margin-right: 10px;
    }

    /* Table Horizontal Scroll */
    .admin-content table,
    .dash-card table,
    #dash-reports table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Blog Spacing Fix */
    #blog .section-title {
        margin-bottom: 10px !important;
    }

    #blog .section-subtitle {
        margin-bottom: 20px !important;
    }
}

/* Mobile Phone Breakpoint */
@media (max-width: 768px) {
    #services .card-grid {
        grid-template-columns: 1fr;
    }

    /* Visibility Rules */
    #normalTabGroup[style*="none"],
    #freeTabGroup[style*="none"],
    #pdfBtn[style*="none"] {
        display: none !important;
    }

    .pdf-view .labeled-grid {
        width: 100%;
        max-width: 340px;
    }
}

@media (max-width: 600px) {
    .trust-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Global Mobile Fixes --- */
@media (max-width: 768px) {

    /* Safe Area for phones */
    body {
        overflow-x: hidden;
        /* Prevent side scroll */
        width: 100%;
    }

    main {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Typography Scaling */
    h1,
    .hero-title {
        font-size: 24px !important;
    }

    h2,
    .section-title {
        font-size: 24px !important;
    }

    p,
    .hero-subtitle {
        font-size: 14px !important;
    }

    /* General Layout */
    .container,
    .nav,
    .footer-content {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Images */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Buttons */
    .btn {
        width: 100%;
        /* Full width buttons on mobile usually look better */
        justify-content: center;
        margin-bottom: 10px;
    }

    /* Form Inputs */
    input,
    select,
    textarea {
        font-size: 16px !important;
        /* Prevent iOS zoom */
    }
}

/* --- Section Specific Mobile Fixes --- */
@media (max-width: 768px) {

    /* Hero Section */
    .hero {
        padding: 40px 5px !important;
        text-align: center;
    }

    .hero-content {
        max-width: 100%;
        margin-bottom: 30px;
    }

    /* Services Grid */
    #services .card-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: 30px;
    }

    /* CENTER THE LOGO AND DESCRIPTION */
    /* CENTER THE LOGO AND DESCRIPTION */
    .nav-left {
        width: auto;
        justify-content: flex-start;
        padding-left: 0 !important;
        margin-bottom: 0px !important;
    }

    /* HEADER SPECIFIC FIXES (Mobile) */
    .nav {
        position: relative;
        justify-content: flex-start !important;
    }

    .hamburger-btn {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        z-index: 10;
        margin-right: 10px;
    }

    /* Footer Specific Overrides */
    .site-footer .nav-left {
        margin-bottom: 20px !important;
    }

    .logo-text-wrap {
        align-items: flex-start;
        text-align: left;
    }

    .footer-desc {
        margin: 0 auto 20px auto !important;
        text-align: center;
    }

    .footer-col h4::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .social-links {
        justify-content: center;
    }

    /* Report Grid (Natal) */
    .natal-grid {
        transform: scale(0.9);
        /* Slight shrink to fit */
    }

    /* Modals */
    .modal-box {
        width: 90% !important;
        max-width: 90% !important;
        margin: 10% auto;
    }
}

/* --- FLUID MOBILE TYPOGRAPHY (360px to 430px) --- */
@media (max-width: 430px) {
    .nav {
        padding: 5px 10px !important;
    }

    .nav-logo-img,
    .logo-circle {
        height: 32px !important;
        width: 32px !important;
        min-width: 32px !important;
        margin-right: 8px !important;
    }

    .logo-text-main {
        font-size: clamp(14px, 4vw + 2px, 16px) !important;
    }

    .logo-text-sub {
        font-size: clamp(7px, 2vw + 1px, 9px) !important;
        letter-spacing: 0.3px !important;
    }

    .hero-title {
        font-size: clamp(22px, 8vw, 24px) !important;
    }

    .hero-subtitle {
        font-size: clamp(12px, 3.5vw, 14px) !important;
    }

    /* Section Titles: High-impact, bold, and airy */
    .section-title {
        font-size: clamp(20px, 8.5vw - 10.6px, 24px) !important;
        font-weight: 700 !important;
        line-height: 1.2 !important;
        margin-bottom: clamp(10px, 4vw, 15px) !important;
    }

    /* Card Headers: Strong and professional */
    .card h1,
    .card h2,
    .card h3,
    .astro-plan-card h1,
    .astro-plan-card h2,
    .hero-card h3 {
        font-size: clamp(18px, 7vw - 7.2px, 22px) !important;
        font-weight: 600 !important;
        line-height: 1.3 !important;
    }

    /* Main Body/Details/Bullets: Optimized for high-end readability */
    .card p,
    .card li,
    .card strong,
    .card .tagline,
    .astro-plan-card .tagline,
    .hero-card small,
    .hero-card-list li {
        font-size: clamp(14px, 2.8vw + 3.9px, 16px) !important;
        line-height: 1.5 !important;
        color: #444 !important;
    }

    /* Secondary/Muted/Price info */
    .price-tag,
    .blog-meta,
    small {
        font-size: clamp(12px, 2.8vw + 1.9px, 14px) !important;
    }

    .btn {
        padding: clamp(10px, 2.5vw + 1px, 14px) clamp(16px, 4vw + 1.6px, 22px) !important;
        font-size: clamp(13px, 2.8vw + 2.9px, 15px) !important;
        border-radius: 10px !important;
    }

    /* Detailed Section Overrides: Strictly cap titles at 24px */
    #details-report .section-title,
    #details-free .section-title,
    #details-report h1,
    #details-free h1 {
        font-size: clamp(20px, 8.5vw - 10.6px, 24px) !important;
    }
}