/**
 * SAP-Algo Theme — Mobile Responsiveness Fix
 * Version: 2.0.0
 */

/* ============================================================
   0. GLOBAL OVERFLOW GUARD
   ============================================================ */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

*, *::before, *::after {
    box-sizing: border-box !important;
}

/* ============================================================
   1. LOGO & NAVBAR — FIX LOGO TERPOTONG ("SAP-ALGO")
   ============================================================ */

/* Logo teks TIDAK BOLEH word-break */
nav a .font-display.font-bold.text-2xl,
.logo-container ~ div .font-display {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    display: block !important;
    max-width: none !important;
}

@media (max-width: 1023px) {
    nav .flex.items-center.justify-between.h-20 {
        height: 64px !important;
        padding: 0 12px !important;
    }

    .logo-container {
        width: 36px !important;
        height: 36px !important;
        flex-shrink: 0 !important;
    }

    nav a .font-display.font-bold.text-2xl {
        font-size: 1.05rem !important;
        white-space: nowrap !important;
        word-break: keep-all !important;
        letter-spacing: 0.04em !important;
    }

    nav a .font-mono.text-xs {
        font-size: 0.52rem !important;
        white-space: nowrap !important;
    }

    nav a.flex.items-center.gap-4 {
        gap: 8px !important;
    }

    .theme-toggle,
    .lang-toggle {
        padding: 6px 10px !important;
        gap: 4px !important;
    }

    .dropdown-menu {
        right: 0 !important;
        left: auto !important;
        max-width: min(92vw, 240px) !important;
    }
}

@media (max-width: 400px) {
    .logo-container {
        width: 28px !important;
        height: 28px !important;
    }

    nav a .font-display.font-bold.text-2xl {
        font-size: 0.88rem !important;
    }

    nav a .font-mono.text-xs.tracking-widest {
        display: none !important;
    }

    .theme-toggle,
    .lang-toggle {
        padding: 5px 8px !important;
    }

    .theme-toggle .chevron-icon,
    .lang-toggle .chevron-icon {
        display: none !important;
    }
}

/* ============================================================
   2. INSTALLATION GUIDE — HEADING TERPOTONG FIX
   ============================================================ */

/* Semua heading besar: izinkan word-wrap */
#guide h2,
section#guide .font-display {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    hyphens: none !important;
    line-height: 1.15 !important;
}

@media (max-width: 768px) {
    #guide h2.font-display,
    section#guide h2 {
        font-size: clamp(1.9rem, 9vw, 3rem) !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* Step card: stack vertikal di mobile */
    #guide .flex.items-start.gap-6 {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    #guide .glass-panel.rounded-2xl.p-8 {
        padding: 1.25rem !important;
    }

    #guide .grid.grid-cols-2.gap-4 {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================================
   3. CODE BLOCK / FILE PATH — TERPOTONG FIX
   ============================================================ */

/* Code block: bisa scroll horizontal ATAU wrap */
.bg-black\/50.rounded-xl,
#guide div[class*="bg-black"],
#guide .font-mono {
    overflow-x: auto !important;
    word-break: break-all !important;
    overflow-wrap: break-word !important;
    white-space: pre-wrap !important;
    max-width: 100% !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Teks path di dalam code block */
#guide div[style*="#00f2ff"],
#guide div[style*="#00ff88"],
#guide div[style*="#00f2"],
#guide div[style*="#00ff"] {
    word-break: break-all !important;
    overflow-wrap: break-word !important;
    white-space: pre-wrap !important;
}

/* Global code/pre elements */
pre, code {
    overflow-x: auto !important;
    max-width: 100% !important;
    white-space: pre-wrap !important;
    word-break: break-all !important;
}

@media (max-width: 768px) {
    #guide .font-mono,
    #guide .text-sm.font-mono,
    #guide code,
    #guide pre {
        font-size: 0.72rem !important;
        line-height: 1.6 !important;
    }
}

/* ============================================================
   4. SMC ARCHITECT — NAV MENU TIDAK TERLIHAT FIX
   ============================================================ */

/* Semua tombol nav SMC: paksa teks kontras tinggi */
.smc-nav-btn {
    color: #c8d6e8 !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    white-space: nowrap !important;
}

.smc-nav-btn:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.smc-nav-btn.active {
    color: #00f2ff !important;
    background: rgba(0, 242, 255, 0.12) !important;
    border-color: rgba(0, 242, 255, 0.35) !important;
}

@media (max-width: 768px) {
    .smc-nav-inner {
        padding: 0 0.75rem !important;
        height: 64px !important;
        flex-wrap: nowrap !important;
        gap: 0.5rem !important;
    }

    .smc-logo-container {
        width: 38px !important;
        height: 38px !important;
        flex-shrink: 0 !important;
    }

    .smc-brand-title {
        font-size: 1rem !important;
        white-space: nowrap !important;
    }

    .smc-brand-subtitle {
        font-size: 0.5rem !important;
        white-space: nowrap !important;
    }

    .smc-status-badge.desktop-menu,
    .smc-home-btn.desktop-menu {
        display: none !important;
    }

    /* Mobile nav SMC — scrollable, teks SELALU terlihat */
    .smc-nav-mobile {
        display: flex !important;
        overflow-x: auto !important;
        padding: 8px 12px 10px !important;
        gap: 6px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        background: rgba(3, 5, 8, 0.97) !important;
        border-top: 1px solid rgba(0, 242, 255, 0.2) !important;
    }

    .smc-nav-mobile::-webkit-scrollbar {
        display: none !important;
    }

    /* SETIAP tombol mobile nav: warna eksplisit */
    .smc-nav-mobile .smc-nav-btn {
        flex-shrink: 0 !important;
        color: #d1dde8 !important;
        background: rgba(255, 255, 255, 0.07) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-radius: 8px !important;
        padding: 7px 14px !important;
        font-size: 0.8rem !important;
        font-weight: 500 !important;
        white-space: nowrap !important;
    }

    .smc-nav-mobile .smc-nav-btn:hover {
        color: #ffffff !important;
        background: rgba(255, 255, 255, 0.12) !important;
        border-color: rgba(255, 255, 255, 0.3) !important;
    }

    .smc-nav-mobile .smc-nav-btn.active {
        color: #00f2ff !important;
        background: rgba(0, 242, 255, 0.14) !important;
        border-color: rgba(0, 242, 255, 0.45) !important;
    }

    .smc-main {
        padding-top: 130px !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* ============================================================
   5. WP ADMIN — SPASI TEKS SAP-ALGO
   ============================================================ */

/* Login page: tambah spasi tracking */
#login h1 a {
    letter-spacing: 0.08em !important;
    word-spacing: 0.1em !important;
}

/* Admin menu SAP-Algo: spasi lebih */
#adminmenu a[href*="sapalgo"] .wp-menu-name,
#adminmenu .wp-submenu a[href*="sapalgo"] {
    letter-spacing: 0.04em !important;
}

/* ============================================================
   6. HERO SECTION
   ============================================================ */

@media (max-width: 768px) {
    .grid.lg\\:grid-cols-2.gap-16.items-center {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    .hero-title {
        font-size: clamp(1.8rem, 7vw, 2.8rem) !important;
    }

    .grid.grid-cols-4.gap-4.pt-8 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .btn-get-started,
    .btn-watch-demo {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* ============================================================
   7. CHART
   ============================================================ */

@media (max-width: 768px) {
    .tv-chart-container {
        height: 260px !important;
        max-width: 100% !important;
        border-radius: 8px !important;
    }

    .auto-trade-overlay { padding: 6px 12px !important; }
    .auto-trade-title { font-size: 0.9rem !important; letter-spacing: 2px !important; }
    .auto-trade-subtitle { font-size: 0.55rem !important; letter-spacing: 3px !important; }
    .chart-labels { display: none !important; }
    .candlestick { min-width: 10px !important; }
    .tv-price-scale { width: 55px !important; font-size: 9px !important; }
    .status-row { font-size: 9px !important; padding: 4px 8px !important; }
}

/* ============================================================
   8. PRICING
   ============================================================ */

@media (max-width: 768px) {
    .grid.grid-cols-1.md\\:grid-cols-2.lg\\:grid-cols-4.gap-6 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    .pricing-card.featured { transform: scale(1) !important; }
}

@media (min-width: 769px) and (max-width: 1023px) {
    .grid.grid-cols-1.md\\:grid-cols-2.lg\\:grid-cols-4.gap-6 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ============================================================
   9. CALCULATOR
   ============================================================ */

@media (max-width: 1023px) {
    #profit-calculator { padding: 1.5rem !important; }
    #profit-calculator .grid.lg\\:grid-cols-2.gap-12 { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
    .w-full.h-64 { height: 180px !important; }
    .calculator-result { font-size: 2rem !important; }
}

@media (max-width: 480px) {
    #profit-calculator .grid.grid-cols-2.gap-4 { grid-template-columns: 1fr !important; }
}

/* ============================================================
   10. FEATURES & FAQ
   ============================================================ */

@media (max-width: 1023px) {
    .grid.lg\\:grid-cols-2.gap-12.items-center { grid-template-columns: 1fr !important; gap: 2rem !important; }
}

@media (max-width: 640px) {
    .faq-button { padding: 14px 16px !important; font-size: 0.9rem !important; }
    .faq-content { padding: 0 16px 14px !important; }
}

/* ============================================================
   11. SECTION PADDING & CONTAINER
   ============================================================ */

@media (max-width: 768px) {
    .py-24 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
    .container { padding-left: 1rem !important; padding-right: 1rem !important; }
    .glass-panel.rounded-2xl.p-8,
    .glass-panel.rounded-3xl.p-8 { padding: 1.25rem !important; }
}

/* ============================================================
   12. SMC LAYOUT GRIDS
   ============================================================ */

@media (max-width: 1200px) { .smc-builder-layout { grid-template-columns: 1fr !important; } }

@media (max-width: 640px) {
    .smc-summary-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .smc-metrics-grid { grid-template-columns: 1fr !important; }
    .smc-two-columns { grid-template-columns: 1fr !important; }
    .smc-options-row { grid-template-columns: repeat(2, 1fr) !important; }
    .smc-presets-grid { grid-template-columns: 1fr !important; }
    .smc-arsenal-grid { grid-template-columns: 1fr !important; }
    .smc-pairs-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .smc-section-title { font-size: 1.5rem !important; }
    .smc-card { padding: 1rem !important; }
    .smc-modal-content { max-height: 95vh !important; }
    .smc-notif-dropdown { right: -50px !important; width: calc(100vw - 2rem) !important; max-width: 320px !important; }
}

/* ============================================================
   13. GLOW + FOOTER + SCROLL TOP
   ============================================================ */

@media (max-width: 768px) {
    .animated-bg .glow-1 { width: 300px !important; height: 300px !important; }
    .animated-bg .glow-2 { width: 250px !important; height: 250px !important; }
    .animated-bg .glow-3, .animated-bg .glow-4, .animated-bg .glow-5 { display: none !important; }
    footer .grid { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
    .payment-badge { min-width: 58px !important; padding: 8px 10px !important; }
}

@media (max-width: 480px) {
    .scroll-to-top { bottom: 16px !important; right: 16px !important; width: 40px !important; height: 40px !important; }
}

/* ============================================================
   14. MOBILE MENU HOMEPAGE
   ============================================================ */

@media (max-width: 1023px) {
    .mobile-menu { padding: 12px 16px !important; }
    .mobile-menu .nav-link { display: block !important; padding: 10px 16px !important; text-align: center; border-radius: 8px; }
}

/* ============================================================
   15. HEADING GLOBAL OVERFLOW PREVENTION
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word !important;
}

/* ============================================================
   16. CODE BLOCK — OVERFLOW FIX (ENHANCED)
   ============================================================ */

/* All installation guide code blocks: prevent text cutoff */
#guide .bg-black\/50,
#guide [class*="bg-black"],
.bg-black\/50.rounded-xl {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    max-width: 100% !important;
}

/* Text inside code blocks: wrap long paths */
#guide .bg-black\/50 div[style*="color"],
.bg-black\/50.rounded-xl div[style*="color"] {
    word-break: break-all !important;
    overflow-wrap: break-word !important;
    white-space: pre-wrap !important;
    max-width: 100% !important;
}

@media (max-width: 768px) {
    /* Step cards: allow full width */
    #guide .glass-panel.rounded-2xl.p-8 {
        padding: 1rem !important;
    }

    /* Fix overflow-hidden on step card parent cutting off code */
    #guide .glass-panel.rounded-2xl.p-8.relative.overflow-hidden {
        overflow: visible !important;
    }

    /* Code block font size on mobile */
    #guide .font-mono.text-sm,
    .bg-black\/50.rounded-xl.p-4.font-mono {
        font-size: 0.72rem !important;
        line-height: 1.65 !important;
    }

    /* Step number + content layout on mobile */
    #guide .flex.items-start.gap-6 {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    #guide .step-number {
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 1rem !important;
        flex-shrink: 0 !important;
    }
}

/* ============================================================
   17. SMC ARCHITECT — MOBILE NAV ENHANCED FIX
   ============================================================ */

@media (max-width: 768px) {
    /* Ensure nav doesn't clip mobile menu */
    .smc-nav {
        overflow: visible !important;
    }

    /* smc-nav-inner: vertical stack on mobile */
    .smc-nav-inner {
        flex-wrap: wrap !important;
        height: auto !important;
        min-height: 60px !important;
        padding: 8px 12px !important;
        gap: 0 !important;
    }

    /* Main content: push down enough for stacked nav */
    .smc-main {
        padding-top: 140px !important;
    }

    /* Mobile nav row inside nav */
    .smc-nav-mobile {
        width: 100% !important;
        order: 10 !important;
    }
}


/* ============================================================
   18. SMC NAV MOBILE — CRITICAL FINAL FIX
   ============================================================ */

@media (max-width: 768px) {
    /* Override any conflicting display:block from .mobile-menu class */
    nav.smc-nav .smc-nav-mobile,
    .smc-nav-mobile.mobile-menu {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        gap: 6px !important;
        padding: 8px 12px 12px !important;
        width: 100% !important;
        background: rgba(3, 5, 8, 0.98) !important;
        border-top: 1px solid rgba(0, 242, 255, 0.25) !important;
    }

    nav.smc-nav .smc-nav-mobile button,
    nav.smc-nav .smc-nav-mobile a,
    .smc-nav-mobile.mobile-menu .smc-nav-btn,
    .smc-nav-mobile.mobile-menu button,
    .smc-nav-mobile.mobile-menu a {
        color: #e0ecff !important;
        background: rgba(30, 60, 100, 0.35) !important;
        border: 1.5px solid rgba(100, 160, 255, 0.3) !important;
        border-radius: 10px !important;
        padding: 8px 16px !important;
        font-size: 0.82rem !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        text-decoration: none !important;
    }
}
