/* ============================================================
   COURBEN.CO — MOBILE RESPONSIVE
   Breakpoint: max-width 768px
   Selectors match exact class names from theme files.
   ============================================================ */

/* ── MOBILE BOTTOM NAV — hidden on desktop ── */
.mobile-bottom-nav { display: none; }
.mobile-view-categories-btn { display: none; }
.mobile-books-categories-btn { display: none; }
.mobile-category-modal { display: none; }

@media ( max-width: 768px ) {

    /* ── BODY ── */
    body { overflow-x: hidden; }

    /* ── NAVBAR ── */
    .navbar {
        padding: 12px 16px !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100;
    }

    .navbar .get-started-btn {
        padding: 6px 12px !important;
        font-size: 11px !important;
        border-radius: 7px !important;
    }

    .nav-user-name{
        display: none;
    }

    /* ── PAGE WRAPPER — single column, hide sidebars ── */
    .page-wrapper {
        grid-template-columns: 1fr !important;
        padding: 16px 16px 80px !important;
        gap: 0 !important;
    }

    .sidebar-left,
    .sidebar-right {
        display: none !important;
    }

    /* ── BOTTOM NAV ── */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(15, 20, 25, 0.98);
        border-top: 1px solid rgba(99, 102, 241, 0.2);
        z-index: 200;
        padding: 0 10px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 7px 6px;
        font-size: 7.5px;
        color: #64748b;
        cursor: pointer;
        border-bottom: 2px solid transparent;
        white-space: nowrap;
        transition: color 0.2s, border-color 0.2s;
        text-decoration: none;
    }

    .mobile-nav-item.active {
        color: #8b5cf6;
        border-bottom-color: #8b5cf6;
    }

    .mobile-nav-item svg {
        width: 16px;
        height: 16px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    /* ── HOME PAGE ── */
    .hero-section {
        padding: 24px 0 20px;
        grid-template-columns: 1fr;
    }

    .hero-content h1 {
        font-size: 24px;
        line-height: 1.2;
        margin-bottom: 12px;
    }

    .hero-description {
        font-size: 12px;
        line-height: 1.7;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 0 0 20px;
    }

    .stat-box { padding: 14px; border-radius: 14px; }
    .stat-number { font-size: 20px; }
    .stat-label { font-size: 10px; line-height: 1.4; }

    .methodology-grid { grid-template-columns: 1fr; gap: 8px; }
    .method-card { padding: 14px; border-radius: 12px; }
    .method-title { font-size: 13px; }
    .method-description { font-size: 11px; }

    .why-facts { grid-template-columns: 1fr; gap: 10px; }
    .fact-card { padding: 16px; border-radius: 12px; }
    .fact-title { font-size: 13px; }
    .fact-description { font-size: 11px; }
    .founder-card { padding: 16px; border-radius: 12px; }

    .skyline-divider { height: 80px; margin-bottom: 20px; }
    .section-divider { margin: 20px 0; }
    .section-title { font-size: 18px; }
    .section-subtitle { font-size: 11px; }

    .footer {
        padding: 24px 0 0 10px;
        margin-bottom: 70px;
    }

    .footer-inner {
        grid-template-columns: 1fr 1fr !important;
        gap: 20px;
    }

    .footer-logo { font-size: 16px; }
    .footer-tagline { font-size: 12px; }
    .footer-link { font-size: 12px; }
    .footer-col-title { font-size: 10px; }
    .footer-bottom { font-size: 11px; }

    /* ── ARTICLES PAGE ── */
    .articles-main { padding: 0 !important; }

    .page-header {
        padding: 20px 0 12px;
        text-align: center;
        margin-bottom: 20px !important;
    }

    .page-title {
        font-size: 24px !important;
        margin-bottom: 4px;
    }

    .page-subtitle { font-size: 11px !important; }

    /* Hide desktop category buttons */
    .category-buttons-container { display: none !important; }

    /* Show mobile view categories button */
    .mobile-view-categories-btn {
        display: flex !important;
        align-items: center;
        gap: 6px;
        background: rgba(15, 20, 25, 0.6);
        border: 1px solid rgba(99, 102, 241, 0.3);
        border-radius: 8px;
        padding: 9px 14px;
        color: #cbd5e1;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        font-family: inherit;
        margin-bottom: 12px;
        margin-top: 10px;
    }

    /* Articles grid — stacked */
    .article-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .article-card-large {
        padding: 14px !important;
        border-radius: 12px !important;
        transform: none !important;
    }

    .article-card-large .article-card-title {
        font-size: 14px !important;
        margin-bottom: 8px;
        line-height: 1.35;
    }

    .article-card-large .article-card-description {
        font-size: 11px !important;
        margin-bottom: 10px;
    }

    .article-card-large .article-card-meta { gap: 12px; }
    .meta-stat { font-size: 10px !important; }

    .article-card-small {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .small-card {
        padding: 14px !important;
        border-radius: 12px !important;
        transform: none !important;
    }

    .small-card-title {
        font-size: 13px !important;
        margin-bottom: 6px;
        line-height: 1.35;
    }

    .small-card-description {
        font-size: 11px !important;
        margin-bottom: 8px;
    }

    .small-card-meta { font-size: 10px !important; }

    /* ── SINGLE ARTICLE ── */
    .container {
        grid-template-columns: 1fr !important;
        padding: 16px 16px 80px !important;
        gap: 0 !important;
    }

    .article-content {
        padding: 0 !important;
        max-width: 100% !important;
    }

    .article-title { font-size: 22px !important; line-height: 1.25; }
    .article-subtitle { font-size: 13px !important; line-height: 1.6; margin-bottom: 20px !important; }

    .article-meta {
        gap: 10px;
        margin-bottom: 20px !important;
        padding-bottom: 16px !important;
        flex-wrap: wrap;
    }

    .badge-container {
        gap: 8px;
        margin-bottom: 16px !important;
        flex-wrap: wrap;
    }

    .focus-mode-badge,
    .text-size-badge,
    .save-article-badge {
        padding: 6px 10px !important;
        font-size: 10px !important;
    }

    /* Font picker — 3 columns */
    .font-picker-section {
        padding: 10px 14px !important;
        margin-bottom: 20px !important;
    }

    .font-list {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .font-picker-section:hover .font-list {
        max-height: 600px;
    }

    .font-option {
        padding: 8px 10px !important;
        font-size: 11px !important;
    }

    /* Readstamps — 2 columns */
    .readstamps-panel {
        padding: 14px !important;
        margin-bottom: 20px !important;
    }

    .timestamp-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
    }

    .timestamp-btn {
        padding: 8px 10px !important;
        font-size: 10px !important;
    }

    .readstamp-label { font-size: 12px !important; }

    /* Summary panel — 2 columns */
    .summary-section { padding: 14px !important; }

    .section-summaries-panel .timestamp-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
    }

    .summary-btn {
        padding: 8px 10px !important;
        font-size: 10px !important;
    }

    /* Article body */
    .article-body {
        font-size: 14px !important;
        line-height: 1.75;
    }

    .article-body h2 {
        font-size: 18px !important;
        margin-top: 28px !important;
        margin-bottom: 12px !important;
    }

    .article-body p { margin-bottom: 14px !important; }

    /* Hide scroll progress and side tools on mobile */
    .scroll-progress-container,
    .highlight-tool-btn,
    .text-saver-btn { display: none !important; }

    /* Survey */
    .survey-title { font-size: 20px !important; }
    .survey-subtitle { font-size: 13px !important; }
    .survey-form { padding: 16px !important; }

    /* ── BOOKS PAGE ── */
    .books-page-wrapper {
        grid-template-columns: 1fr !important;
        padding: 16px 0 80px !important;
    }

    .books-main { padding: 0 !important; }

    .mobile-books-categories-btn {
        display: flex !important;
        align-items: center;
        gap: 6px;
        background: rgba(15, 20, 25, 0.6);
        border: 1px solid rgba(99, 102, 241, 0.3);
        border-radius: 8px;
        padding: 9px 14px;
        color: #cbd5e1;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        font-family: inherit;
        margin-bottom: 12px;
    }

    .book-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px;
    }

    .book-card {
        grid-template-columns: 68px 1fr !important;
        gap: 0 !important;
        padding: 0 !important;
        border-radius: 12px;
        overflow: hidden;
    }

    .book-spine {
        width: 68px !important;
        min-width: 68px !important;
        height: auto !important;
        min-height: 100px;
        border-radius: 0 !important;
        box-shadow: none !important;
        align-self: stretch;
    }

    .book-content {
        padding: 9px 11px 7px !important;
        gap: 4px !important;
    }

    .book-number { font-size: 9px !important; }
    .book-title { font-size: 12px !important; line-height: 1.3; }
    .book-author { font-size: 10px !important; }
    .book-why { font-size: 10px !important; line-height: 1.5; }

    .book-article-link { padding: 6px 8px !important; }
    .book-article-title { font-size: 10px !important; }
    .book-article-label { font-size: 9px !important; }

    .book-footer { margin-top: 4px !important; }

    .book-buy-btn {
        font-size: 10px !important;
        padding: 5px 10px !important;
    }

    .book-save-btn {
        width: 28px !important;
        height: 28px !important;
    }

    /* ── PROFILE PAGE ── */
    .profile-hero {
        padding: 13px !important;
        gap: 11px !important;
        border-radius: 14px !important;
        margin-bottom: 14px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .avatar {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        font-size: 17px !important;
        margin-inline: auto;
    }

    .profile-info{
        width: 100%;
        text-align: center;
    }
    .profile-name { font-size: 14px !important; }
    .profile-username { font-size: 10px !important; }

    .profile-stats {
        flex-wrap: wrap;
        gap: 0 !important;
        padding-top: 9px;
        border-top: 1px solid rgba(99, 102, 241, 0.15);
        width: 100%;
    }

    .profile-stat {
        flex: 1;
        min-width: 80px;
        text-align: center;
        padding: 0 2px;
        border-right: 1px solid rgba(99, 102, 241, 0.15);
    }

    .profile-stat:last-child { border-right: none; }
    .profile-stat-number { font-size: 12px !important; }
    .profile-stat-label { font-size: 8px !important; }

    .profile-options{
        justify-content: space-around;
    }
    .edit-profile-btn,
    .delete-account-btn {
        font-size: 8px !important;
        padding: 3px 7px !important;
        border-radius: 5px !important;
    }

    /* Saved books grid on profile — 4 columns */
    .saved-books-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 10px !important;
    }

    .saved-book-name { font-size: 9px !important; }
    .saved-book-author { font-size: 8px !important; }

    /* ── LEGAL PAGES ── */
    .legal-page-wrapper {
        grid-template-columns: 1fr !important;
        padding: 16px 0 80px !important;
    }

    .tos-main { padding: 16px 0 40px !important; }
    .tos-main .page-title { font-size: 20px !important; }
    .section-title { font-size: 13px !important; }
    .section-body { font-size: 11px !important; }

    /* ── BOOKS PAGE WRAPPER (alternate class) ── */
    .books-page-wrapper {
        grid-template-columns: 1fr !important;
        padding: 16px 0 80px !important;
    }

    /* ── CATEGORY MODAL ── */
    .mobile-category-modal {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(10, 12, 20, 0.75);
        z-index: 500;
    }

    .mobile-category-modal.open { display: block; }

    .mobile-category-modal-inner {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 290px;
        background: linear-gradient(135deg, #0f1419, #1a1d29 60%, #2d1b69);
        border: 1px solid rgba(99, 102, 241, 0.4);
        border-radius: 14px;
        padding: 16px;
        max-height: 420px;
        overflow-y: auto;
        scrollbar-width: none;
    }

    .mobile-category-modal-inner::-webkit-scrollbar { display: none; }

    .mobile-category-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
    }

    .mobile-category-modal-title {
        font-size: 13px;
        font-weight: 700;
        color: #fff;
    }

    .mobile-category-modal-close {
        background: rgba(99, 102, 241, 0.15);
        border: 1px solid rgba(99, 102, 241, 0.3);
        border-radius: 5px;
        color: #94a3b8;
        font-size: 14px;
        cursor: pointer;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-category-modal-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .mobile-category-pill {
        background: linear-gradient(135deg, rgba(20,15,50,0.8), rgba(30,20,70,0.7));
        border: 1px solid rgba(102, 126, 234, 0.3);
        border-radius: 6px;
        padding: 6px 11px;
        color: #fff;
        font-size: 10px;
        font-weight: 500;
        cursor: pointer;
        font-family: inherit;
    }

    .mobile-category-pill.active {
        background: linear-gradient(135deg, rgba(102,126,234,0.3), rgba(124,58,237,0.3));
        border-color: rgba(102, 126, 234, 0.6);
    }

}