/* ══════════════════════════════════════════
   RESPONSIVE — All @media queries
   ══════════════════════════════════════════ */

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

    /* ── Prevent horizontal overflow ── */
    html, body {
        overflow-x: hidden;
        max-width: 100%;
    }

    /* ── Typography ── */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.375rem; }
    h3 { font-size: 1.125rem; }

    /* ── Navigation ── */
    .cg-nav-desktop,
    .cg-nav-actions {
        display: none;
    }

    .cg-hamburger {
        display: flex;
    }

    .cg-header-inner {
        justify-content: space-between;
    }

    .cg-logo img {
        max-height: 32px;
    }

    /* ── Hero ── */
    .cg-hero {
        padding: 40px 0 32px;
    }

    .cg-hero-title {
        font-size: 1.75rem;
    }

    .cg-hero-subtitle {
        font-size: 1rem;
    }

    .cg-hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .cg-hero-btn,
    .cg-hero-btn-secondary {
        width: 100%;
        max-width: 320px;
        justify-content: center;
    }

    /* ── Layout ── */
    .cg-container {
        padding: 0 16px;
    }

    .cg-page-content {
        padding-top: 24px;
    }

    .cg-page-title {
        font-size: 1.5rem;
    }

    /* ── Posts grid ── */
    .cg-posts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* ── Single post ── */
    .cg-post-title {
        font-size: 1.5rem;
    }

    .cg-post-nav {
        flex-direction: column;
    }

    .cg-post-nav a {
        max-width: 100%;
    }

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

    /* ── LearnDash Focus Mode ── */
    .learndash-wrapper .ld-focus {
        flex-direction: column;
    }

    .learndash-wrapper .ld-focus .ld-focus-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 50vh;
        position: relative;
    }

    .learndash-wrapper .ld-focus .ld-focus-main {
        width: 100%;
    }

    .learndash-wrapper .ld-focus .ld-focus-content {
        padding: 20px 16px;
    }

    .learndash-wrapper .ld-focus .ld-focus-header {
        flex-wrap: wrap;
        padding: 10px 16px;
        gap: 8px;
    }

    .learndash-wrapper .ld-focus .ld-focus-header .ld-focus-header-main {
        width: 100%;
    }

    /* ── LearnDash Content ── */
    .learndash-wrapper .ld-content-body {
        padding: 16px;
    }

    .learndash-wrapper .ld-content-body h1 {
        font-size: 22px;
        line-height: 1.3;
    }

    /* Course status — stack */
    .learndash-wrapper .ld-course-status {
        flex-direction: column;
        padding: 16px;
    }

    .learndash-wrapper .ld-course-status .ld-course-status-segment {
        border-right: none;
        border-bottom: 1px solid var(--cg-border);
        padding: 12px 0;
    }

    .learndash-wrapper .ld-course-status .ld-course-status-segment:last-child {
        border-bottom: none;
    }

    /* Bigger tap targets */
    .learndash-wrapper .ld-item-list .ld-item-list-item,
    .learndash-wrapper .ld-lesson-item,
    .learndash-wrapper .ld-topic-item {
        padding: 16px;
        min-height: 48px;
    }

    .learndash-wrapper .ld-item-list .ld-item-list-item a,
    .learndash-wrapper .ld-lesson-item a {
        font-size: 15px;
    }

    /* Video responsive */
    .learndash-wrapper .ld-video .ld-video-player,
    .learndash-wrapper .ld-video iframe,
    .learndash-wrapper video,
    .learndash-wrapper iframe[src*="youtube"],
    .learndash-wrapper iframe[src*="vimeo"] {
        max-width: 100%;
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }

    /* Mark Complete — full width */
    .learndash-wrapper .ld-button,
    .learndash-wrapper input[type="submit"],
    .learndash-wrapper .sfwd-mark-complete,
    .learndash-wrapper .sfwd-mark-complete input {
        width: 100%;
        text-align: center;
    }

    .learndash-wrapper .sfwd-mark-complete {
        display: block;
        margin: 16px 0;
    }

    /* Quiz — mobile */
    .learndash-wrapper .wpProQuiz_content {
        padding: 16px;
    }

    .learndash-wrapper .wpProQuiz_content .wpProQuiz_question {
        padding: 16px;
    }

    .learndash-wrapper .wpProQuiz_content input[type="button"],
    .learndash-wrapper .wpProQuiz_content .wpProQuiz_button {
        width: 100%;
        min-height: 48px;
    }

    /* BuddyBoss course cards — stack */
    .buddyboss-lms .bb-card-course-wrap {
        flex-direction: column;
    }

    .buddyboss-lms .bb-card-course-details {
        width: 100%;
        padding: 16px;
    }

    .buddyboss-lms .bb-course-image-wrap {
        width: 100%;
        height: 180px;
    }

    /* BuddyBoss dashboard — full width columns */
    .bb-grid .medium-up-2 > .column,
    .bb-grid .medium-up-3 > .column {
        width: 100%;
        flex: 0 0 100%;
    }

    /* BuddyBoss navs — scrollable */
    .bp-navs ul {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .bp-navs ul li a {
        white-space: nowrap;
        padding: 10px 14px;
        font-size: 13px;
    }

    /* ── Footer ── */
    .cg-footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .cg-footer-brand {
        text-align: center;
    }

    .cg-footer-social {
        justify-content: center;
    }

    .cg-footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    /* ── Enrollment strip ── */
    .cg-enroll-strip {
        padding: 24px 16px;
        margin: 24px 16px;
    }

    .cg-price-tag {
        font-size: 26px;
    }

    .cg-enroll-btn {
        max-width: 100%;
    }

    /* ── Trust badges ── */
    .cg-trust-badges {
        gap: 12px;
    }

    .cg-trust-badge {
        font-size: 12px;
        flex: 0 0 calc(50% - 8px);
        justify-content: center;
    }

    /* ── 404 ── */
    .cg-404 h1 {
        font-size: 4rem;
    }

    .cg-404-actions {
        flex-direction: column;
    }

    /* ── Login ── */
    .cg-login-wrap {
        margin: 40px auto;
    }

    /* ── Dashboard ── */
    .cg-dashboard-wrap {
        padding: 16px;
    }

    /* Dashboard injection (CG-UI Overhaul) */
    #cg-hero-banner .cg-hero-inner {
        padding: 20px 16px;
    }
    #cg-hero-banner h2 {
        font-size: 20px !important;
    }
    #cg-hero-banner p {
        font-size: 13px !important;
    }
    #cg-stats-bar {
        padding: 0 12px;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    .cg-stat-card {
        padding: 12px !important;
    }
    .cg-stat-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }
    .cg-stat-value {
        font-size: 16px !important;
    }
    .cg-stat-label {
        font-size: 11px !important;
    }
    #cg-quick-actions {
        padding: 0 12px;
        overflow-x: auto;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        -webkit-overflow-scrolling: touch;
    }
    .cg-quick-btn {
        white-space: nowrap;
        padding: 10px 14px !important;
        font-size: 13px !important;
        min-width: max-content;
    }
    #cg-gamification-row {
        padding: 0 12px;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    #cg-performance {
        padding: 0 12px;
    }
    .cg-perf-bar-label {
        width: 65px !important;
        font-size: 11px !important;
    }
    #cg-continue-learning {
        padding: 0 12px;
    }
    .cg-continue-card {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .cg-continue-thumb {
        width: 100% !important;
        height: 120px !important;
    }

    /* BuddyBoss community — mobile */
    .buddypress .dir-search input[type="search"],
    .buddypress .dir-search input[type="text"] {
        width: 100%;
        font-size: 14px;
    }
    .buddypress .item-list .list-wrap {
        flex-direction: column;
    }
    .buddypress .bp-list .list-wrap .item-block,
    .buddypress .bp-list .list-wrap .item {
        width: 100%;
    }
    .buddypress .bp-list .list-wrap .item-avatar {
        margin-right: 0;
        margin-bottom: 8px;
    }
    #buddypress .activity-list .activity-content {
        margin-left: 0 !important;
    }
    #buddypress .activity-list .activity-avatar {
        float: none !important;
        margin-right: 0 !important;
    }
    #buddypress .activity-list .activity-item {
        padding: 12px !important;
    }
    .buddypress .group-list .list-wrap,
    .buddypress .members-list .list-wrap {
        padding: 12px !important;
    }

    /* Course page shortcode — mobile */
    .cg-course-hero-stats {
        flex-wrap: wrap;
        gap: 8px;
    }
    .cg-course-hero-stat {
        flex: 0 0 calc(50% - 4px);
    }
    .cg-course-curriculum-item {
        padding: 12px;
    }
    .cg-course-features-grid {
        grid-template-columns: 1fr !important;
    }

    /* Sticky enrollment bar — mobile */
    .cg-course-sticky-bar {
        padding: 10px 16px !important;
    }
    .cg-course-sticky-bar .cg-price-tag {
        font-size: 20px !important;
    }

    /* ── Tables ── */
    table {
        display: block;
        overflow-x: auto;
        font-size: 13px;
    }

    table th, table td {
        padding: 6px 8px;
        font-size: 11px;
        white-space: nowrap;
    }
}

/* ══════ Tablet (768px - 1024px) ══════ */
@media (min-width: 768px) and (max-width: 1024px) {

    /* Nav — hide desktop, show hamburger */
    .cg-nav-desktop {
        display: none;
    }

    .cg-hamburger {
        display: flex;
    }

    .cg-nav-actions {
        display: none;
    }

    /* LearnDash focus sidebar — narrower */
    .learndash-wrapper .ld-focus .ld-focus-sidebar {
        width: 260px;
        min-width: 260px;
    }

    .learndash-wrapper .ld-focus .ld-focus-content {
        padding: 24px 20px;
    }

    /* Posts grid — 2 columns */
    .cg-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Footer — 2 columns */
    .cg-footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ══════ Large Desktop (1025px+) ══════ */
@media (min-width: 1025px) {
    /* Ensure hamburger is hidden on desktop */
    .cg-hamburger {
        display: none;
    }

    .cg-mobile-nav {
        display: none !important;
    }
}

/* ══════ Print ══════ */
@media print {
    .cg-header,
    .cg-footer,
    .cg-nav-spacer,
    .cg-sticky-cta,
    .cg-mobile-nav {
        display: none;
    }

    .cg-main {
        padding: 0;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }
}
