/* Mobile-First Responsive Styles for AkunIndo Website */

/* ===================================
   RESET & BASE STYLES
   =================================== */

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    padding-top: 80px !important;
    margin: 0; 
}

@media (max-width: 767px) {
    body {
        padding-top: 0 !important;
    }
}

@media (max-width: 1024px) {
    /* Hide desktop nav and language switcher only */
    #global-header nav,
    .lang-switcher-desktop {
        display: none !important;
    }

    #mobile-menu-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    #global-header > div {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
    }

    /* Right side container - keep items inline */
    #global-header > div > div:last-child {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        flex-wrap: nowrap !important;
    }

    /* Compact CTA button in HEADER only - 2-line text, header stays 1 row */
    #global-header > div > div > a[href*="early-access"] {
        display: inline-block !important;
        padding: 0.35rem 0.6rem !important;
        font-size: 0.7rem !important;
        border-radius: 0.3rem !important;
        white-space: normal !important;
        word-spacing: 100vw !important;
        line-height: 1.2 !important;
        text-align: center !important;
        max-width: 5rem !important;
        margin-right: 0.5rem !important;
    }

    /* Mobile nav panel - compact to fit above fold */
    #mobile-nav {
        width: 80% !important;
        max-width: 280px !important;
        padding: 1rem 1rem !important;
    }

    #mobile-nav nav {
        margin-top: 1.5rem !important;
        gap: 0.25rem !important;
    }

    #mobile-nav nav a {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.9rem !important;
    }

    #mobile-nav .mobile-lang-switcher {
        margin-top: 1rem !important;
        margin-bottom: 0.75rem !important;
        padding-top: 1rem !important;
    }

    #mobile-nav .mobile-cta {
        margin-top: 0 !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
    }
}

@media (max-width: 640px) {
    #global-header a[href="/"] {
        font-size: 1rem !important;
    }

    #global-header a[href="/"] img {
        height: 32px !important;
        width: auto !important;
    }

    /* Keep the slogan visible but compact */
    #global-header a[href="/"] span:last-child {
        display: inline !important;
        font-size: 0.75rem !important;
        line-height: 1.0 !important;
    }

    /* Tighten vertical spacing between brand and tagline */
    #global-header a[href="/"] span:first-child {
        line-height: 1.0 !important;
    }
    #global-header a[href="/"] > div {
        gap: 0 !important;
    }

    #global-header {
        padding: 0.5rem 0 !important;
        margin-top: 0 !important;
        top: 0 !important;
    }
}

/* ===================================
   MOBILE HEADER STYLES
   =================================== */

#mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: white;
    font-size: 1.75rem;
    line-height: 1;
}

#mobile-nav {
    display: block;
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 2000;
    padding: 2rem 1.5rem;
    overflow-y: auto;
}

#mobile-nav.active {
    right: 0;
}

#mobile-nav-overlay {
    display: block; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
    opacity: 0;
    pointer-events: none; 
    transition: opacity 0.3s ease;
}

#mobile-nav-overlay.active {
    opacity: 1;
    pointer-events: auto; 
}

#mobile-nav-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: #4B5563;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    width: 2.5rem; 
    height: 2.5rem; 
    display: flex;
    align-items: center; 
    justify-content: center; 
}

#mobile-nav nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 2rem;
}

#mobile-nav nav a {
    color: #1F2937;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

#mobile-nav nav a:hover {
    background: #F3F4F6;
}

#mobile-nav .mobile-lang-switcher {
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    padding-top: 2rem;
    border-top: 1px solid #E5E7EB;
}

#mobile-nav .mobile-cta {
    margin-top: 0; 
    display: block;
    text-align: center;
    background: #2563EB;
    color: white;
    padding: 1rem 1.5rem; 
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 700;
    transition: background 0.2s; 
}

#mobile-nav .mobile-cta:hover {
    background: #1D4ED8; 
}

/* ===================================
   RESPONSIVE BREAKPOINTS
   =================================== */

/* Mobile and smaller tablet devices (up to 950px) - Use hamburger menu */
@media (max-width: 950px) {
    /* Show mobile menu toggle */
    #mobile-menu-toggle {
        display: flex !important;
    }

    /* Hide desktop navigation, language switcher, and CTA */
    #global-header nav,
    #global-header .lang-switcher-desktop,
    #global-header > div > div > div:last-child > a {
        display: none !important;
    }

    /* Show mobile nav elements */
    #mobile-nav,
    #mobile-nav-overlay {
        display: block;
    }

    /* Header adjustments - make compact and sticky */
    #global-header {
        padding: 0.5rem 0 !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
    }

    #global-header .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Logo - keep reasonable size */
    #global-header a[href="/"] {
        font-size: 1.25rem !important;
    }

    #global-header a[href="/"] img {
        width: auto !important;
        height: 36px !important;
    }

    /* Right-side container - minimal gap */
    #global-header > div > div > div:last-child {
        gap: 0 !important;
    }

    /* Container adjustments */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Typography */
    h1 {
        font-size: 1.875rem !important;
        line-height: 2.25rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
        line-height: 2rem !important;
    }

    h3 {
        font-size: 1.25rem !important;
        line-height: 1.75rem !important;
    }

    /* Hero sections */
    section[class*="hero"],
    section[class*="bg-gradient"] {
        padding: 3rem 0 !important;
    }

    /* Grid layouts - force single column */
    .grid,
    [style*="display: grid"],
    [class*="grid-cols"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    /* Flex layouts - allow wrapping */
    [style*="display: flex"] {
        flex-wrap: wrap !important;
    }

    /* Buttons - full width on mobile */
    .btn,
    a[style*="background"],
    button[style*="background"] {
        width: 100%;
        text-align: center;
        padding: 0.875rem 1.5rem !important;
    }

    /* Images */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Padding adjustments - consistent section spacing */
    section {
        padding: 2.5rem 0 !important;
    }

    /* Section titles - consistent spacing */
    .section-title,
    section h2 {
        margin-bottom: 1rem !important;
    }

    /* Section subtitles - consistent spacing */
    .section-subtitle,
    section h2 + p {
        margin-bottom: 1.5rem !important;
    }

    /* Cards and content blocks - consistent internal spacing */
    .feature-card,
    .founder-card,
    .team-card,
    [style*="border-radius"][style*="padding"] {
        padding: 1.25rem !important;
    }

    /* Fix partnerships commission grid on mobile */
    #partnerships-commission-grid {
        grid-template-columns: 1fr !important;
    }

    /* Consistent gap between grid items */
    .grid,
    [style*="display: grid"] {
        gap: 1.25rem !important;
    }
}

/* Larger tablets and small desktops (951px - 1200px) */
@media (min-width: 951px) and (max-width: 1200px) {
    /* Container adjustments */
    .container {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }

    /* Typography */
    h1 {
        font-size: 2.5rem !important;
        line-height: 3rem !important;
    }

    h2 {
        font-size: 2rem !important;
        line-height: 2.5rem !important;
    }

    /* Grid layouts - 2 columns on tablet */
    .grid-auto,
    [class*="grid-cols-3"],
    [class*="grid-cols-4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Hero sections */
    section[class*="hero"] {
        padding: 4rem 0 !important;
    }

    /* Smaller navigation gaps for desktop nav */
    #global-header nav {
        gap: 1rem !important;
    }

    #global-header nav a {
        font-size: 0.875rem !important;
    }
}

/* Desktop devices (951px and up) */
@media (min-width: 951px) {
    /* Ensure mobile menu is hidden */
    #mobile-menu-toggle,
    #mobile-nav,
    #mobile-nav-overlay {
        display: none !important;
    }
}

/* ===================================
   TOUCH-FRIENDLY ELEMENTS
   =================================== */

@media (hover: none) and (pointer: coarse) {
    /* Minimum touch target size */
    button,
    a,
    input,
    select,
    textarea {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    a:hover,
    button:hover {
        opacity: 0.8;
    }
}

/* ===================================
   SPECIFIC PAGE FIXES
   =================================== */

/* Landing Page */
@media (max-width: 767px) {
    /* Hero section */
    #hero-section {
        padding: 3rem 1rem !important;
    }

    #hero-section h1 {
        font-size: 2rem !important;
    }

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

    /* Feature cards */
    .feature-card {
        padding: 1.5rem !important;
    }

    /* Pricing cards */
    .pricing-card {
        margin-bottom: 1.5rem;
    }

    /* Roadmap timeline */
    .roadmap-item {
        padding-left: 2rem !important;
    }
}

/* About Page */
@media (max-width: 767px) {
    /* Founder cards */
    .founder-card {
        text-align: center;
        padding: 1.5rem !important;
    }

    .founder-card img {
        margin: 0 auto 1rem auto;
    }

    /* Values grid */
    .values-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Partnerships Page */
@media (max-width: 767px) {
    /* Partnership type cards */
    .partnership-type {
        margin-bottom: 2rem;
    }

    /* Commission grid - already handled above */

    /* Benefits grid */
    .benefits-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Referral Page */
@media (max-width: 767px) {
    /* Step cards */
    .step-card {
        margin-bottom: 2rem;
    }

    /* Benefits grid */
    .benefits-grid {
        grid-template-columns: 1fr !important;
    }

    /* FAQ accordion */
    details {
        padding: 1rem !important;
    }
}

/* ===================================
   UTILITY CLASSES
   =================================== */

.mobile-only {
    display: none !important;
}

.desktop-only {
    display: block !important;
}

@media (max-width: 767px) {
    .mobile-only {
        display: block !important;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-hidden {
        display: none !important;
    }

    .mobile-full-width {
        width: 100% !important;
    }

    .mobile-text-center {
        text-align: center !important;
    }
}

/* ===================================
   LANDSCAPE ORIENTATION FIXES
   =================================== */

@media (max-width: 767px) and (orientation: landscape) {
    section[class*="hero"] {
        padding: 2rem 0 !important;
    }

    h1 {
        font-size: 1.5rem !important;
    }
}

/* ===================================
   HIGH DPI DISPLAYS
   =================================== */

@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Ensure images look crisp on retina displays */
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ===================================
   LANDING PAGE MOBILE IMPROVEMENTS
   =================================== */

/* Offset anchor scrolling for fixed header */
section[id] {
    scroll-margin-top: 90px;
}

/* ===================================
   TERMS/PRIVACY PAGE MOBILE TUNING
   =================================== */
@media (max-width: 640px) {
    /* Compact hero spacing and typography */
    #terms-page .hero-section {
        padding: 2rem 0 1.25rem !important;
    }
    #terms-page .hero-section h1 {
        font-size: 1.75rem !important;
        margin-bottom: 0.5rem !important;
    }
    #terms-page .hero-section p {
        font-size: 1rem !important;
    }

    /* Content wrapper spacing */
    #terms-page .content-wrapper {
        padding: 1.25rem !important;
        margin: 1.25rem auto !important;
        border-radius: 1rem !important;
    }

    /* Typography scale and spacing */
    #terms-page .prose h2 {
        font-size: 1.25rem !important;
        margin-top: 1.25rem !important;
        margin-bottom: 0.75rem !important;
        padding-bottom: 0.5rem !important;
    }
    #terms-page .prose h3 {
        font-size: 1.0625rem !important;
        margin-top: 1rem !important;
        margin-bottom: 0.5rem !important;
        padding-left: 0.75rem !important;
    }
    #terms-page .prose p {
        margin-bottom: 0.9rem !important;
        line-height: 1.7 !important;
    }

    /* Lists */
    #terms-page .prose ul {
        margin-bottom: 1.25rem !important;
        padding-left: 1.25rem !important;
    }
    #terms-page .prose li {
        margin-bottom: 0.75rem !important;
        padding-left: 0.25rem !important;
    }

    /* Info boxes */
    #terms-page .info-box {
        padding: 1rem !important;
        margin-bottom: 1.25rem !important;
        border-radius: 0.75rem !important;
    }

    /* TOC compactness */
    #terms-page .toc {
        padding: 1rem !important;
    }
    #terms-page .toc .toc-item {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.9375rem !important;
    }
}

@media (max-width: 767px) {
    section[id] {
        scroll-margin-top: 70px;
    }
}

/* Collapse multi-column inline grids on small screens */
@media (max-width: 768px) {
    /* Any inline grid definitions fall back to single column */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Reduce dense grid gaps */
    div[style*="gap:"] {
        gap: 1rem !important;
    }

    /* Softer vertical rhythm for sections */
    .section {
        padding: 1.5rem 0 !important;
    }

    /* Headings slightly smaller on mobile */
    .section-title {
        font-size: 1.375rem !important;
    }

    /* Ensure hero media and embeds scale nicely */
    video,
    iframe,
    .hero-media,
    .hero-image {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* ===================================
   MOBILE CAROUSEL + HERO TUNING
   =================================== */
@media (max-width: 640px) {
    /* Hero video: cap height on small screens */
    #hero-video {
        max-height: 70vh !important;
        height: auto !important;
        object-fit: contain !important;
        border-radius: 0.75rem !important;
    }

    /* Make outer box sync to video size */
    #hero-video-box {
        width: auto !important;
        max-width: min(360px, 92vw) !important;
    }
    #hero-video-frame {
        display: inline-block !important;
        width: 100% !important;
    }

    /* Mobile app mini-carousel sizing */
    #mobile-carousel {
        max-width: 360px !important;
        margin: 0 auto !important;
        padding: 0.75rem !important;
        border-radius: 1rem !important;
    }
    #mobile-carousel-track {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 0 !important;
    }
    #mobile-carousel .mobile-slide {
        padding: 0.25rem 0 !important;
        min-width: 100% !important;
        flex: 0 0 100% !important;
    }
    #mobile-carousel .mobile-slide img {
        height: min(50vh, 360px) !important;
        width: auto !important;
        max-width: 100% !important;
        object-fit: contain !important;
        display: block !important;
    }
    #mobile-prev,
    #mobile-next {
        width: 2rem !important;
        height: 2rem !important;
        top: 50% !important;
    }
    /* Dots tighter spacing */
    #mobile-carousel .mobile-dot {
        transform: scale(0.9);
    }

    /* Roadmap (Upcoming Features): stack items and hide separators */
    #roadmap .container > div[style*="display: flex"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
        max-width: 100% !important;
    }
    #roadmap .container > div[style*="display: flex"] > div[style*="height: 2px"] {
        display: none !important;
    }
    #roadmap .container > div[style*="display: flex"] > div[style*="flex: 1"] {
        padding: 0.5rem 0 !important;
    }
}

/* ===================================
   ENCODING / COPY FIXES (non-invasive)
   =================================== */

/* Normalize list bullets where encoded glyphs broke */
.prose-content li:before { content: "\2022" !important; }
#terms-page .prose ul li::before { content: "\2022" !important; }

/* Hide stray icon span before Quick Navigation on terms/privacy copies */
#terms-page .toc-title > span:first-child { display: none !important; }

/* Support page: replace garbled icons with a neutral symbol */
.support-icon { position: relative; color: transparent !important; }
.support-icon::before {
    content: "❖";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
}

/* Support page: normalize Quick Help link labels (override broken text) */
a[data-translate="support.quickhelp.card1.link"],
a[data-translate="support.quickhelp.card2.link"],
a[data-translate="support.quickhelp.card3.link"],
a[data-translate="support.quickhelp.card4.link"],
a[data-translate="support.quickhelp.card5.link"],
a[data-translate="support.quickhelp.card6.link"] {
    color: transparent !important;
    position: relative;
}
a[data-translate="support.quickhelp.card1.link"]::before { content: "View Guide \2192"; color: var(--blue-600); }
a[data-translate="support.quickhelp.card2.link"]::before { content: "Learn More \2192"; color: var(--blue-600); }
a[data-translate="support.quickhelp.card3.link"]::before { content: "See How \2192"; color: var(--blue-600); }
a[data-translate="support.quickhelp.card4.link"]::before { content: "Explore \2192"; color: var(--blue-600); }
a[data-translate="support.quickhelp.card5.link"]::before { content: "Learn More \2192"; color: var(--blue-600); }
a[data-translate="support.quickhelp.card6.link"]::before { content: "View Plans \2192"; color: var(--blue-600); }

/* Referral page badge: replace garbled prefix */
[data-translate="referral.hero.badge"] { color: transparent !important; position: relative; }
[data-translate="referral.hero.badge"]::before { content: "🏆 Earn Rewards"; color: inherit; position: absolute; left: 50%; transform: translateX(-50%); }

/* Affiliate page Marketing Hub badge: ensure clean label */
#marketing-hub { color: transparent !important; position: relative; }
#marketing-hub::before { content: "Marketing Hub"; color: inherit; position: absolute; left: 50%; transform: translateX(-50%); }

/* Cookies page: fix Back to Home arrow visually */
body > div.container.max-w-4xl .mt-12.pt-8.border-t a { color: transparent !important; position: relative; }
body > div.container.max-w-4xl .mt-12.pt-8.border-t a::before { content: "\2190 Back to Home"; color: #2563EB; }

/* ===================================
   FOOTER: SOCIAL ICONS (MOBILE FIX)
   Keep footer social icons visible and compact on small screens.
   =================================== */
@media (max-width: 640px) {
    /* Prevent generic mobile rules from expanding these buttons */
    #global-footer a[aria-label][style*="background"] {
        display: inline-flex !important;
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 9999px !important;
    }

    /* Keep the icons in a single row inside the Social section */
    #global-footer h4 + div {
        display: flex !important;
        gap: 0.75rem !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }
}
