/* Mobile Enhancements for Footer, Tutorial, Docs, and Blog */

/* ============================================================================
   FOOTER MOBILE IMPROVEMENTS
   ============================================================================ */

@media (max-width: 768px) {
    .site-footer {
        padding: 2rem 0 1.5rem;
    }
    
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        text-align: center;
    }
    
    .footer-brand {
        align-items: center;
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .footer-brand strong {
        font-size: 1.5rem !important;
    }
    
    .footer-brand p {
        text-align: center !important;
        margin: 0 auto !important;
        max-width: 100% !important;
    }
    
    /* Modern Mobile Footer */
    .footer-brand {
        text-align: center;
        margin-bottom: 2rem;
        padding-bottom: 2rem;
        border-bottom: 1px solid rgba(139, 92, 246, 0.15);
    }
    
    .footer-brand strong {
        display: block;
        font-size: 1.5rem !important;
        background: linear-gradient(135deg, #8b5cf6, #ec4899);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        margin-bottom: 0.75rem;
    }
    
    .footer-brand p {
        font-size: 0.95rem;
        line-height: 1.6;
        margin: 0 auto !important;
        max-width: 100% !important;
        opacity: 0.85;
    }
    
    /* Clean Card-Style Footer Links */
    .footer-links {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.03), rgba(139, 92, 246, 0.01));
        border: 1px solid rgba(139, 92, 246, 0.15);
        border-radius: 16px;
        padding: 0;
        overflow: hidden;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        margin-bottom: 1rem;
    }
    
    .footer-links strong {
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 1rem 1.25rem;
        cursor: pointer;
        position: relative;
        margin: 0;
        color: var(--text-primary);
        background: rgba(139, 92, 246, 0.08);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        user-select: none;
    }
    
    .footer-links strong:hover {
        background: rgba(139, 92, 246, 0.15);
        padding-left: 1.5rem;
    }
    
    .footer-links strong::after {
        content: '›';
        font-size: 1.25rem;
        font-weight: 400;
        transition: transform 0.3s ease;
        opacity: 0.7;
    }
    
    .footer-links.expanded strong::after {
        transform: rotate(90deg);
    }
    
    .footer-links-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        background: rgba(15, 23, 42, 0.4);
    }
    
    .footer-links.expanded .footer-links-content {
        max-height: 500px;
        padding: 0.5rem 0 0.75rem;
    }
    
    .footer-links a {
        padding: 0.875rem 1.25rem;
        font-size: 0.9rem;
        font-weight: 500;
        display: flex;
        align-items: center;
        width: 100%;
        text-align: left;
        color: var(--text-secondary);
        transition: all 0.2s ease;
        position: relative;
        border-left: 3px solid transparent;
    }
    
    .footer-links a::before {
        content: '·';
        margin-right: 0.75rem;
        color: var(--primary);
        font-weight: 700;
        font-size: 1.25rem;
        opacity: 0;
        transition: opacity 0.2s ease;
    }
    
    .footer-links a:hover {
        background: rgba(139, 92, 246, 0.08);
        color: var(--text-primary);
        padding-left: 1.5rem;
        border-left-color: var(--primary);
    }
    
    .footer-links a:hover::before {
        opacity: 1;
    }
    
    .footer-bottom {
        text-align: center;
        font-size: 0.8rem;
        padding-top: 2rem;
        margin-top: 1rem;
        border-top: 1px solid rgba(139, 92, 246, 0.1);
    }
    
    .footer-bottom p {
        line-height: 1.7;
        opacity: 0.75;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        gap: 1.5rem !important;
    }
    
    .footer-brand strong {
        font-size: 1.25rem !important;
    }
    
    .footer-brand p {
        font-size: 0.9rem;
    }
    
    .footer-links a {
        font-size: 0.875rem;
    }
    
    .footer-bottom {
        font-size: 0.75rem;
    }
}

/* ============================================================================
   TUTORIAL PAGE MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    /* Prevent horizontal scrolling */
    body, html {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    .tutorial-section {
        padding: 2rem 0 !important;
        overflow-x: hidden;
        max-width: 100%;
    }
    
    .tutorial-content {
        padding: 0 1rem;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .tutorial-step {
        margin-bottom: 2rem;
        padding: 1.5rem;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .tutorial-step h2 {
        font-size: 1.5rem !important;
        margin-bottom: 1rem;
        word-wrap: break-word;
    }
    
    .tutorial-step h3 {
        font-size: 1.25rem !important;
        margin-bottom: 0.75rem;
        word-wrap: break-word;
    }
    
    .tutorial-step p, .tutorial-step li {
        font-size: 0.95rem;
        line-height: 1.6;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .tutorial-image, .tutorial-step img {
        max-width: 100% !important;
        height: auto !important;
        width: 100% !important;
        object-fit: contain;
    }
    
    .tutorial-note, .tutorial-tip, .tutorial-warning {
        padding: 1rem;
        margin: 1rem 0;
        font-size: 0.9rem;
        border-radius: 8px;
        max-width: 100%;
        overflow-x: hidden;
        word-wrap: break-word;
    }
    
    .tutorial-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .code-block, pre, code {
        font-size: 0.75rem !important;
        padding: 0.75rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        word-wrap: normal;
        white-space: pre-wrap;
    }
    
    .tutorial-timeline {
        margin-left: 0.5rem;
    }
    
    .timeline-item {
        padding-left: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        line-height: 32px;
    }
    
    /* Fix any wide elements */
    * {
        max-width: 100%;
    }
    
    .container {
        max-width: 100%;
        overflow-x: hidden;
    }
}

@media (max-width: 480px) {
    .tutorial-step {
        padding: 1rem;
    }
    
    .tutorial-step h2 {
        font-size: 1.3rem !important;
    }
    
    .tutorial-step h3 {
        font-size: 1.1rem !important;
    }
    
    .tutorial-step p, .tutorial-step li {
        font-size: 0.875rem;
    }
    
    .code-block {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}

/* ============================================================================
   DOCUMENTATION PAGE MOBILE
   ============================================================================ */

@media (max-width: 1024px) {
    .docs-layout {
        display: block !important;
    }
    
    .docs-sidebar {
        position: static !important;
        width: 100% !important;
        max-height: none;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-bottom: 1.5rem;
        margin-bottom: 2rem;
    }
    
    .docs-nav {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    .docs-nav-section {
        margin-bottom: 0.5rem;
    }
    
    .docs-nav-section h3 {
        font-size: 0.95rem !important;
        margin-bottom: 0.5rem;
    }
    
    .docs-nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .docs-content {
        max-width: 100% !important;
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {
    .docs-article h2 {
        font-size: 1.75rem !important;
        margin-bottom: 1rem;
    }
    
    .docs-article h3 {
        font-size: 1.35rem !important;
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    .docs-article h4 {
        font-size: 1.15rem !important;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .docs-article p, .docs-article li {
        font-size: 0.95rem;
        line-height: 1.7;
    }
    
    .docs-callout {
        padding: 1rem;
        margin: 1.5rem 0;
        font-size: 0.9rem;
        border-radius: 8px;
    }
    
    .docs-callout ul, .docs-callout ol {
        margin-left: 1.25rem;
    }
    
    .docs-code-block {
        font-size: 0.8rem;
        padding: 0.75rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .docs-table {
        font-size: 0.85rem;
        overflow-x: auto;
        display: block;
        -webkit-overflow-scrolling: touch;
    }
    
    .docs-table table {
        min-width: 500px;
    }
    
    .docs-image {
        max-width: 100%;
        height: auto;
        margin: 1rem 0;
    }
    
    .docs-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

@media (max-width: 480px) {
    .docs-sidebar {
        padding: 1rem;
    }
    
    .docs-content {
        padding: 0 0.75rem;
    }
    
    .docs-article h2 {
        font-size: 1.5rem !important;
    }
    
    .docs-article h3 {
        font-size: 1.25rem !important;
    }
    
    .docs-article p, .docs-article li {
        font-size: 0.875rem;
    }
    
    .docs-callout {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .docs-code-block {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}

/* ============================================================================
   BLOG PAGE MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    .blog-hero {
        padding: 4rem 0 2rem !important;
    }
    
    .blog-hero h1 {
        font-size: 2.25rem !important;
        margin-bottom: 0.75rem;
    }
    
    .blog-hero p {
        font-size: 1rem !important;
        padding: 0 1rem;
    }
    
    /* Mobile-friendly search section */
    .blog-search {
        padding: 0 1rem;
        margin-bottom: 1.5rem;
    }
    
    .blog-search-wrap {
        position: relative;
        width: 100%;
        max-width: 100%;
    }
    
    .blog-search {
        width: 100% !important;
        font-size: 0.95rem !important;
        padding: 0.875rem 1rem 0.875rem 2.75rem !important;
        border-radius: 8px;
        border: 1px solid var(--border);
        background: var(--bg-secondary);
        color: var(--text-primary);
        box-sizing: border-box;
    }
    
    .blog-search-icon {
        left: 0.875rem !important;
    }
    
    /* Hide desktop categories, show mobile dropdown */
    .blog-categories-desktop {
        display: none !important;
    }
    
    .blog-categories-mobile {
        display: block !important;
        padding: 0 1rem;
        margin-bottom: 1.5rem;
    }
    
    /* Mobile dropdown for categories */
    .blog-filter {
        padding: 0 1rem;
        margin-bottom: 1.5rem;
    }
    
    .blog-category-label {
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text-secondary);
        margin-bottom: 0.5rem;
        display: block;
    }
    
    .blog-category-select {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
        border-radius: 8px;
        border: 1px solid var(--border);
        background: var(--bg-secondary);
        color: var(--text-primary);
        cursor: pointer;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 1rem center;
        padding-right: 2.5rem;
    }
    
    .blog-filter-buttons {
        display: none; /* Hide button-style filters on mobile */
    }
    
    .blog-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        padding: 0 1rem;
    }
    
    .blog-card {
        padding: 1.5rem;
    }
    
    .blog-card h2, .blog-card h3 {
        font-size: 1.35rem !important;
        margin-bottom: 0.75rem;
        line-height: 1.4;
    }
    
    .blog-card p {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 1rem;
    }
    
    .blog-meta {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
    
    .blog-tags {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 1rem;
    }
    
    .blog-tag {
        font-size: 0.75rem;
        padding: 0.35rem 0.75rem;
    }
    
    .blog-read-more {
        font-size: 0.9rem;
        padding: 0.6rem 1.25rem;
    }
    
    .blog-article {
        padding: 0 1rem;
    }
    
    .blog-article h1 {
        font-size: 2rem !important;
        line-height: 1.3;
        margin-bottom: 1rem;
    }
    
    .blog-article h2 {
        font-size: 1.6rem !important;
        margin-top: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .blog-article h3 {
        font-size: 1.3rem !important;
        margin-top: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .blog-article p, .blog-article li {
        font-size: 0.95rem;
        line-height: 1.7;
    }
    
    .blog-article img {
        max-width: 100%;
        height: auto;
        margin: 1.5rem 0;
    }
    
    .blog-article pre {
        font-size: 0.8rem;
        padding: 0.75rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .blog-article blockquote {
        padding: 1rem;
        margin: 1.5rem 0;
        font-size: 0.95rem;
        border-left: 4px solid var(--brand);
    }
    
    .blog-share {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 1.5rem 1rem;
    }
    
    .blog-share-btn {
        flex: 1 0 calc(50% - 0.375rem);
        min-width: 0;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .blog-hero h1 {
        font-size: 1.85rem !important;
    }
    
    .blog-card {
        padding: 1.25rem;
    }
    
    .blog-card h2, .blog-card h3 {
        font-size: 1.2rem !important;
    }
    
    .blog-card p {
        font-size: 0.875rem;
    }
    
    .blog-article h1 {
        font-size: 1.75rem !important;
    }
    
    .blog-article h2 {
        font-size: 1.4rem !important;
    }
    
    .blog-article h3 {
        font-size: 1.2rem !important;
    }
    
    .blog-article p, .blog-article li {
        font-size: 0.875rem;
    }
    
    .blog-article pre {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .blog-share-btn {
        flex: 1 0 100%;
    }
}

/* ============================================================================
   UNIVERSAL MOBILE UTILITIES
   ============================================================================ */

/* Hide mobile-only elements on desktop */
.blog-categories-mobile {
    display: none;
}

@media (max-width: 768px) {
    /* Ensure all containers have proper mobile padding */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Make tables scrollable on mobile */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    
    /* Ensure images don't overflow */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Better touch targets for mobile */
    a, button, .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Improve form inputs on mobile */
    input, textarea, select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Better spacing for sections */
    .section {
        padding: 3rem 0;
    }
    
    /* Card spacing */
    .card {
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 2rem 0;
    }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}
