/* OnlyTopic - Mobile Responsive Stylesheet */

/* Hamburger button */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: 1.5px solid var(--border);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    flex-shrink: 0;
}
.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: all .25s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav drawer */
.mobile-nav {
    display: none;
    position: fixed;
    top: 64px;
    left: 0; right: 0;
    background: var(--white);
    border-bottom: 2px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 9500;
    padding: 8px 0 16px;
    flex-direction: column;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
    display: block;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: background .15s;
}
.mobile-nav a:hover { background: var(--bg); color: var(--primary); }
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav .btn-primary {
    margin: 12px 24px 0;
    display: block;
    text-align: center;
    padding: 12px;
    border-radius: var(--radius);
    border-bottom: none;
}

/* Sale item layout */
.si-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 32px;
    align-items: start;
}

/* Tablet: 900px */
@media (max-width: 900px) {
    .single-post-layout { grid-template-columns: 1fr; }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
    .single-post-attribution { flex-direction: column; align-items: flex-start; }
    .cat-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
    .biz-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .biz-profile-cover { height: 220px; }
    .biz-profile-body { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr 1fr; gap: 32px; }
}

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

    /* Header */
    .header-nav { display: none !important; }
    .nav-toggle  { display: flex !important; }
    .container    { padding: 0 16px !important; }
    .container-sm { padding: 0 16px !important; }

    /* Hero */
    .hero { padding: 44px 0 36px; }
    .hero h1 { font-size: 1.85rem; letter-spacing: -0.3px; }
    .hero p  { font-size: 0.92rem; margin-bottom: 22px; }
    .hero-search { max-width: 100%; }
    .hero-search input  { padding: 12px 14px; font-size: 0.9rem; }
    .hero-search button { padding: 12px 18px; font-size: 0.875rem; }

    /* Categories */
    .cat-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .cat-card { padding: 14px 8px; }
    .cat-icon { font-size: 1.6rem; margin-bottom: 6px; }
    .cat-name { font-size: 0.73rem; }
    .cat-count { font-size: 0.66rem; }

    /* Business grid */
    .biz-grid { grid-template-columns: 1fr !important; gap: 14px; }

    /* Sections */
    .section { padding: 36px 0; }
    .section-sm { padding: 22px 0; }
    .section-title { font-size: 1.2rem; }
    .section-header { flex-wrap: wrap; gap: 10px; }

    /* Sale item page - stack vertically */
    .si-layout {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    /* Move contact form to top on mobile (order swap) */
    .si-layout > div:first-child { order: 2; }
    .si-layout > div:last-child  { order: 1; }

    /* Sale item gallery */
    .si-layout img#item-main-img { max-height: 320px; }

    /* Item details card padding */
    .si-layout .sidebar-card,
    .si-layout > div > div[style*="padding:28px"] {
        padding: 18px !important;
    }

    /* Sale item detail page padding */
    .si-layout h1 { font-size: 1.4rem !important; }
    .si-layout [style*="font-size:2rem"] { font-size: 1.6rem !important; }

    /* Business profile body */
    .biz-profile-body {
        grid-template-columns: 1fr !important;
        padding: 20px 16px;
        gap: 20px;
    }
    .biz-profile-header-inner {
        flex-direction: column;
        align-items: flex-start;
        margin-top: -24px;
        padding: 0 16px;
        gap: 10px;
    }
    .biz-profile-logo { width: 68px; height: 68px; border-radius: 12px; }
    .biz-profile-info { padding-top: 0; }
    .biz-profile-name { font-size: 1.3rem; }
    .biz-profile-actions { padding-top: 0; flex-wrap: wrap; gap: 8px; }
    .biz-profile-body { grid-template-columns: 1fr !important; padding: 20px 16px; gap: 20px; }

    /* Dashboard header */
    .ot-dash-header {
        flex-wrap: wrap !important;
        padding: 20px 16px !important;
        gap: 12px !important;
    }
    .ot-dash-header-btns {
        margin-left: 0 !important;
        width: 100%;
        justify-content: flex-start;
    }
    .ot-dash-header-btns .btn { font-size: 0.8rem; padding: 7px 12px; }
    .ot-dash-avatar {
        width: 56px !important;
        height: 56px !important;
        font-size: 1.4rem !important;
    }
    .ot-dash-header-email { font-size: 0.8rem !important; }

    /* Dashboard layout - sidebar becomes horizontal scroll tabs */
    .ot-dashboard-layout { display: block !important; }
    .ot-dashboard-sidebar {
        position: static !important;
        height: auto !important;
        max-height: none !important;
        border-right: none !important;
        border-bottom: 2px solid var(--border) !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        display: flex !important;
        flex-direction: row !important;
        white-space: nowrap !important;
        scrollbar-width: none !important;
        padding: 0 !important;
        background: var(--white) !important;
        width: 100% !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
    .ot-dashboard-sidebar::-webkit-scrollbar { display: none !important; }
    .ot-dashboard-sidebar > a {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        border-left: none !important;
        border-bottom: 3px solid transparent !important;
        border-right: 1px solid var(--border) !important;
        border-top: none !important;
        border-radius: 0 !important;
        padding: 10px 14px !important;
        font-size: 0.67rem !important;
        white-space: nowrap !important;
        min-width: max-content !important;
        gap: 3px !important;
        line-height: 1.2 !important;
        background: transparent !important;
    }

    /* Item slide-in panel - full width on mobile */
    #item-panel { width: 100% !important; right: -100% !important; border-radius: 0 !important; }
    #item-panel.open { right: 0 !important; }

    /* Google setup form */
    #google-setup-form { grid-template-columns: 1fr !important; }

    /* Sidebar cards */
    .sidebar-card { padding: 14px !important; border-radius: 8px !important; }

    /* Forms */
    .form-control { font-size: 0.9rem; padding: 9px 12px; }
    .form-group { margin-bottom: 14px; }

    /* Buttons */
    .btn    { padding: 9px 16px; min-height: 40px; }
    .btn-sm { padding: 7px 12px; font-size: 0.78rem; }

    /* Footer */
    .footer-inner { grid-template-columns: 1fr !important; gap: 24px; }
    .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
    #site-footer { margin-top: 40px; padding: 32px 0 16px; }

    /* Single post */
    .single-post-title { font-size: 1.35rem; }
    .single-post-layout { grid-template-columns: 1fr !important; }
    .single-post-thumb img { width: 100% !important; height: 220px !important; object-fit: cover; border-radius: 12px; }
    .single-post-content img { max-width: 100% !important; height: auto !important; }
    .single-post-article { min-width: 0; overflow: hidden; }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Homepage hero fixes ── */
@media (max-width: 768px) {
    /* Hero map section — keep visible, just reduce height */
    #ot-hero-map { min-height: 480px !important; }

    /* Category pills — 2 per row grid */
    .ot-hero-pills {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        justify-items: stretch !important;
    }
    .ot-hero-pills a {
        justify-content: center !important;
        text-align: center !important;
    }

    /* Stats bar — 2x2 */
    .ot-stats-bar {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .ot-stats-bar > div {
        border-right: 1px solid var(--border) !important;
        border-bottom: 1px solid var(--border) !important;
    }

    /* Featured listings — single column */
    .ot-featured-grid {
        grid-template-columns: 1fr !important;
    }

    /* Category grid on homepage — 3 columns */
    .ot-home-cat-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
    }

    /* For sale grid — 2 columns */
    .ot-sale-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* Community posts — single column */
    .ot-posts-grid {
        grid-template-columns: 1fr !important;
    }

    /* Geo banner — stack vertically */
    #ot-geo-banner > div {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    #ot-geo-banner .ot-geo-btns {
        width: 100% !important;
        justify-content: space-between !important;
    }
}

/* Small phones: 480px */
@media (max-width: 480px) {
    .cat-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
    .cat-card  { padding: 12px 6px; }
    .hero h1   { font-size: 1.5rem; }
    .biz-profile-cover { height: 140px; }
    .related-grid { grid-template-columns: 1fr; }
    .footer-brand .site-logo { font-size: 1.15rem; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .ot-dash-avatar { width: 48px !important; height: 48px !important; font-size: 1.2rem !important; }
    .ot-dash-header-email { display: none; }
    .si-layout { padding: 0 !important; }
    .si-layout > div > div { border-radius: 10px !important; }
}

/* ── Global mobile overflow fix ── */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    .container, .container-sm {
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    /* Post pages */
    .single-post-layout,
    .single-post-article,
    .single-post-content,
    .single-post-header,
    .single-post-title {
        max-width: 100% !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    .single-post-content img,
    .single-post-thumb img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
    }
    /* Business pages */
    .biz-profile-inner,
    .biz-profile-row,
    .biz-name-block {
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
}
