/**
 * Mobile Responsive Styles for Docs & Resources Pages
 * Ensures all pages display correctly on mobile devices
 * without affecting desktop layout
 */

/* ================================
   MOBILE HAMBURGER MENU
   ================================ */

/* Hamburger button - hidden on desktop */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    z-index: 1002;
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
    stroke: #0f172a;
    stroke-width: 2;
    fill: none;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
}

/* Mobile slide-out menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 360px;
    height: 100%;
    background: #fff;
    z-index: 1001;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.mobile-menu-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.mobile-menu-close svg {
    width: 24px;
    height: 24px;
    stroke: #64748b;
    stroke-width: 2;
}

.mobile-menu-nav {
    padding: 16px 0;
}

.mobile-nav-section {
    border-bottom: 1px solid #f1f5f9;
    padding: 8px 0;
}

.mobile-nav-section:last-child {
    border-bottom: none;
}

.mobile-nav-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mobile-nav-title:hover {
    background: #f8fafc;
}

.mobile-nav-title svg {
    width: 16px;
    height: 16px;
    stroke: #64748b;
    transition: transform 0.2s ease;
}

.mobile-nav-section.open .mobile-nav-title svg {
    transform: rotate(180deg);
}

.mobile-nav-links {
    display: none;
    padding: 0 20px 12px 32px;
}

.mobile-nav-section.open .mobile-nav-links {
    display: block;
}

.mobile-nav-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid #f1f5f9;
    transition: color 0.2s ease;
}

.mobile-nav-links a:last-child {
    border-bottom: none;
}

.mobile-nav-links a:hover,
.mobile-nav-links a:active {
    color: #6366f1;
}

.mobile-nav-links .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.mobile-nav-links .icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.mobile-menu-cta {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-menu-cta .btn {
    display: block;
    text-align: center;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mobile-menu-cta .btn-outline {
    border: 1px solid #e2e8f0;
    color: #0f172a;
    background: #fff;
}

.mobile-menu-cta .btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
}

/* ================================
   TABLET STYLES (max-width: 1024px)
   ================================ */

@media (max-width: 1024px) {
    /* Typography scaling */
    h1 {
        font-size: clamp(1.75rem, 5vw, 2.5rem) !important;
    }
    
    h2 {
        font-size: clamp(1.25rem, 4vw, 1.75rem) !important;
    }
    
    /* Grid layouts - reduce columns */
    .grid,
    .feature-grid,
    .card-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
    
    /* Dropdown adjustments */
    .mega-dropdown {
        min-width: calc(100vw - 48px) !important;
        max-width: calc(100vw - 48px) !important;
    }
    
    .dropdown-grid.cols-3,
    .dropdown-grid.cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Feature blocks */
    .feature-block {
        padding: 80px 0 !important;
    }
    
    /* Sections */
    section {
        padding: 24px !important;
    }
}

/* ================================
   MOBILE STYLES (max-width: 768px)
   ================================ */

@media (max-width: 768px) {
    /* Show mobile menu elements */
    .mobile-menu-btn {
        display: flex;
    }
    
    .mobile-menu,
    .mobile-menu-overlay {
        display: block;
    }
    
    /* Hide desktop nav elements */
    .nav-modern {
        display: none !important;
    }
    
    .header-right .btn-text {
        display: none !important;
    }
    
    .header-right .btn-primary {
        padding: 8px 14px !important;
        font-size: 13px !important;
    }
    
    /* Adjust header height */
    .landing-header {
        height: 64px !important;
    }
    
    .landing-header .container {
        padding: 0 16px !important;
    }
    
    /* Body padding for fixed header */
    body {
        padding-top: 64px;
    }
    
    /* Page containers */
    .page,
    .container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    
    /* Typography */
    h1 {
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
        line-height: 1.25 !important;
    }
    
    h2 {
        font-size: clamp(1.15rem, 5vw, 1.5rem) !important;
        line-height: 1.3 !important;
    }
    
    h3 {
        font-size: 1.1rem !important;
    }
    
    p, li {
        font-size: 15px !important;
        line-height: 1.7 !important;
    }
    
    .lead, .hero p, p.lead {
        font-size: 16px !important;
    }
    
    /* Hero sections */
    .hero,
    .features-hero,
    [class*="hero"] {
        padding: 100px 16px 48px !important;
        text-align: center !important;
    }
    
    .hero-badge {
        font-size: 12px !important;
        padding: 8px 14px !important;
    }
    
    /* Grids become single column */
    .grid,
    .feature-grid,
    .card-grid,
    .dropdown-grid,
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .feature-grid {
        gap: 32px !important;
    }
    
    .feature-grid.reverse {
        direction: ltr !important;
    }
    
    /* Cards */
    .card {
        padding: 16px !important;
    }
    
    .card h3 {
        font-size: 1.05rem !important;
    }
    
    /* Buttons - ensure tapability */
    .btn,
    a.btn,
    button.btn,
    .cta-row a {
        padding: 14px 20px !important;
        font-size: 14px !important;
        min-height: 48px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .cta-row {
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
    }
    
    .cta-row a,
    .cta-row .btn {
        width: 100% !important;
    }
    
    /* Pills */
    .pill-list {
        gap: 8px !important;
    }
    
    .pill {
        font-size: 13px !important;
        padding: 8px 12px !important;
    }
    
    /* Sections */
    section {
        padding: 20px !important;
        margin-top: 24px !important;
        border-radius: 12px !important;
    }
    
    /* Feature blocks */
    .feature-block {
        padding: 48px 0 !important;
    }
    
    .feature-content {
        text-align: center !important;
    }
    
    .feature-content .tag {
        margin-bottom: 16px !important;
    }
    
    /* Feature navigation */
    .feature-nav {
        top: 64px !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .feature-nav .container {
        justify-content: flex-start !important;
        padding: 12px 16px !important;
        gap: 6px !important;
        flex-wrap: nowrap;
    }
    
    .feature-nav-link {
        flex-shrink: 0;
        padding: 8px 14px !important;
        font-size: 13px !important;
        white-space: nowrap;
    }
    
    /* Tables - make scrollable */
    table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    
    /* Code blocks - scrollable */
    pre, code {
        overflow-x: auto !important;
        font-size: 13px !important;
        max-width: 100% !important;
    }
    
    /* Images */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    .feature-visual,
    .feature-image {
        margin-top: 24px !important;
    }
    
    /* Callouts */
    .callout {
        padding: 14px 16px !important;
        font-size: 14px !important;
        border-radius: 10px !important;
    }
    
    /* Lists */
    ul, ol {
        padding-left: 20px !important;
    }
    
    li {
        margin-bottom: 8px !important;
    }
    
    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden !important;
    }
    
    .page,
    main,
    article {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
}

/* ================================
   SMALL MOBILE (max-width: 480px)
   ================================ */

@media (max-width: 480px) {
    /* Even smaller typography */
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.2rem !important;
    }
    
    p, li {
        font-size: 14px !important;
    }
    
    /* Smaller padding */
    .page,
    .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    section {
        padding: 16px !important;
        margin-top: 20px !important;
    }
    
    /* Cards */
    .card {
        padding: 14px !important;
    }
    
    /* Hero */
    .hero,
    .features-hero,
    [class*="hero"] {
        padding: 90px 12px 36px !important;
    }
    
    /* Mobile menu */
    .mobile-menu {
        width: 100%;
        max-width: 100%;
    }
    
    /* Buttons */
    .btn {
        padding: 12px 16px !important;
        font-size: 13px !important;
    }
    
    /* Footer */
    .landing-footer {
        padding: 32px 0 24px !important;
    }
    
    .footer-column h4 {
        margin-bottom: 12px !important;
    }
    
    .footer-column li {
        margin-bottom: 10px !important;
    }
}

/* ================================
   RESOURCE PAGE SPECIFIC
   ================================ */

@media (max-width: 768px) {
    /* Resource cards */
    .resource-card,
    .blog-card,
    .template-card {
        padding: 16px !important;
    }
    
    /* Resource grids */
    .resource-grid,
    .blog-grid,
    .template-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    /* Resource headers */
    .resource-header,
    .page-header {
        padding: 90px 16px 32px !important;
        text-align: center !important;
    }
    
    /* Filters and search */
    .filter-bar,
    .search-bar {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .filter-btn,
    .search-input {
        width: 100% !important;
    }
    
    /* Blog post content */
    .blog-content,
    .article-content {
        padding: 0 !important;
    }
    
    /* Blog meta */
    .meta,
    .blog-meta {
        font-size: 13px !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
}

/* ================================
   DOCS PAGE SPECIFIC
   ================================ */

@media (max-width: 768px) {
    /* Docs sidebar - hide on mobile or make collapsible */
    .docs-sidebar {
        display: none !important;
    }
    
    /* Docs content full width */
    .docs-main,
    .docs-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 16px !important;
    }
    
    /* TOC on mobile */
    .table-of-contents {
        background: #f8fafc;
        padding: 16px;
        border-radius: 12px;
        margin-bottom: 24px;
    }
    
    /* Pricing table */
    .pricing-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .pricing-card {
        padding: 20px !important;
    }
    
    /* Comparison tables */
    .comparison-table {
        display: block !important;
        overflow-x: auto !important;
    }
    
    /* FAQ */
    .faq-item {
        padding: 16px !important;
    }
    
    .faq-question {
        font-size: 15px !important;
        padding-right: 32px !important;
    }
    
    .faq-answer {
        font-size: 14px !important;
    }
    
    /* Contact form */
    .contact-form input,
    .contact-form textarea,
    .contact-form select {
        font-size: 16px !important; /* Prevents iOS zoom */
        padding: 14px !important;
    }
    
    .contact-form button {
        width: 100% !important;
        padding: 16px !important;
    }
}

/* ================================
   ACCESSIBILITY IMPROVEMENTS
   ================================ */

@media (max-width: 768px) {
    /* Increase tap targets */
    a, button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Focus states */
    a:focus,
    button:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 2px solid #6366f1 !important;
        outline-offset: 2px !important;
    }
    
    /* Reduce motion for users who prefer it */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}

/* ================================
   RESOURCE PAGE GRID FIXES
   ================================ */

@media (max-width: 768px) {
    /* Resource jump links - horizontal scroll */
    .jump-nav {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px !important;
        justify-content: flex-start !important;
        gap: 8px !important;
    }
    
    .jump-link {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }
    
    /* Resource section grids */
    .resources-grid,
    .tools-grid,
    .planners-grid,
    .guides-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    /* Resource cards consistent sizing */
    .resource-item,
    .tool-card,
    .planner-card,
    .guide-card {
        padding: 16px !important;
    }
    
    /* Category headers */
    .category-header,
    .section-header {
        padding: 24px 16px !important;
    }
    
    /* Blog article styles */
    article {
        padding: 0 16px !important;
    }
    
    article h1 {
        font-size: 1.6rem !important;
        line-height: 1.3 !important;
    }
    
    article h2 {
        font-size: 1.25rem !important;
        margin-top: 2rem !important;
    }
    
    article p,
    article li {
        font-size: 15px !important;
        line-height: 1.75 !important;
    }
    
    /* Study planner cards */
    .planner-preview,
    .template-preview {
        padding: 12px !important;
    }
    
    /* Tool icons */
    .tool-icon {
        width: 40px !important;
        height: 40px !important;
    }
}

/* ================================
   HEADER FIXES FOR RESOURCES
   ================================ */

@media (max-width: 768px) {
    /* Resource page custom headers */
    .header {
        height: 64px !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
    }
    
    .header-inner {
        height: 64px !important;
        padding: 0 16px !important;
    }
    
    .header-title {
        font-size: 1.1rem !important;
    }
    
    /* Header brand logo */
    .header-brand {
        gap: 8px !important;
    }
    
    .header-logo {
        width: 32px !important;
        height: 32px !important;
    }
}

/* ================================
   PRINT STYLES (optional)
   ================================ */

@media print {
    .landing-header,
    .landing-footer,
    .mobile-menu,
    .mobile-menu-overlay,
    .mobile-menu-btn,
    .simple-mobile-btn,
    .simple-mobile-nav,
    nav {
        display: none !important;
    }
    
    body {
        padding-top: 0 !important;
    }
    
    .page {
        max-width: 100% !important;
        padding: 0 !important;
    }
}
