/* ===================================
   Mobile Responsive Enhancements
   =================================== */

/* Large tablets and small laptops */
@media (max-width: 1024px) {
    .container {
        max-width: 95%;
    }
    
    .hero-text h1 {
        font-size: 2.5rem;
    }
    
    .skills-grid,
    .achievements-grid,
    .featured-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablets */
@media (max-width: 768px) {
    /* Navigation */
    .navbar {
        padding: 0.75rem 0;
    }
    
    .navbar .container {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .nav-brand a {
        font-size: 1.1rem;
    }
    
    .nav-menu {
        gap: 0.75rem;
        font-size: 0.875rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    
    .nav-menu li {
        flex-shrink: 0;
    }
    
    .theme-toggle {
        width: 36px;
        height: 36px;
        margin-left: 0.5rem;
    }
    
    /* Hero Section */
    .hero {
        padding: 2rem 0;
        min-height: auto;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .hero-text h1 {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .hero-buttons .btn {
        width: 100%;
        text-align: center;
    }
    
    .profile-picture {
        max-width: 250px;
        height: 250px;
        margin: 0 auto;
    }
    
    /* Sections */
    .section-title {
        font-size: 1.75rem;
        margin-bottom: 2rem;
    }
    
    section {
        padding: 2.5rem 0;
    }
    
    /* Skills */
    .skills-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Experience & Education */
    .experience-timeline::before,
    .education-timeline::before {
        left: 10px;
    }
    
    .experience-item,
    .education-item {
        padding-left: 40px;
    }
    
    .experience-marker,
    .education-marker {
        left: 3px;
        width: 14px;
        height: 14px;
    }
    
    .experience-header {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    /* Achievements */
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    
    /* Blog */
    .blog-header {
        padding: 2rem 0;
    }
    
    .blog-header h1 {
        font-size: 1.75rem;
    }
    
    .category-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }
    
    .category-tab {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    .blog-post-card {
        margin-bottom: 1.5rem;
    }
    
    .blog-post-card .post-header,
    .blog-post-card .post-excerpt,
    .blog-post-card .read-more-link {
        padding: 0 1.25rem;
    }
    
    .blog-post-card .post-header {
        padding-top: 1.25rem;
    }
    
    .blog-post-card .read-more-link {
        padding-bottom: 1.25rem;
    }
    
    .post-cover-image img {
        height: 200px;
    }
    
    /* Blog Post */
    .blog-post {
        padding: 2rem 0;
    }
    
    .post-header-full {
        padding: 0 15px;
    }
    
    .post-header-full h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .post-meta-full {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        font-size: 0.8rem;
    }
    
    .post-content {
        padding: 0 15px;
        font-size: 1rem;
    }
    
    .post-content h2 {
        font-size: 1.35rem;
    }
    
    .post-content h3 {
        font-size: 1.15rem;
    }
    
    .post-content pre {
        font-size: 0.8rem;
        padding: 1rem;
    }
    
    .toc-container {
        margin: 0 15px 1.5rem;
        padding: 1rem;
    }
    
    .toc-title {
        font-size: 1rem;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
    }
    
    .footer-section {
        margin-bottom: 0;
    }
    
    .footer-section ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1rem;
    }
    
    .newsletter-section {
        max-width: 100%;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .newsletter-btn {
        width: 100%;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .pagination-numbers {
        order: -1;
        width: 100%;
        justify-content: center;
    }
    
    /* Social Share */
    .social-share {
        margin: 2rem 15px;
        padding: 1.25rem;
    }
    
    .share-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .share-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Search */
    .search-form {
        flex-direction: column;
    }
    
    .search-btn {
        width: 100%;
    }
    
    /* Admin */
    .admin-header .container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .admin-posts-table {
        font-size: 0.8rem;
    }
    
    .admin-form {
        padding: 1.25rem;
        margin: 0 15px;
    }
    
    .form-group-inline {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        text-align: center;
    }
    
    /* Tables */
    .post-content table {
        font-size: 0.85rem;
    }
    
    .post-content table th,
    .post-content table td {
        padding: 0.5rem;
    }
    
    /* Copy code button - always visible on mobile */
    .copy-code-btn {
        opacity: 1;
        top: 0.25rem;
        right: 0.25rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .nav-brand a {
        font-size: 1rem;
    }
    
    .nav-menu {
        gap: 0.5rem;
        font-size: 0.8rem;
    }
    
    .theme-toggle {
        width: 32px;
        height: 32px;
    }
    
    .theme-toggle svg {
        width: 16px;
        height: 16px;
    }
    
    .hero-text h1 {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .post-header-full h1 {
        font-size: 1.35rem;
    }
    
    .category-tab {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .skill-category,
    .about-card,
    .achievement-card {
        padding: 1.25rem;
    }
    
    .share-btn {
        padding: 0.6rem 1rem;
        font-size: 0.875rem;
    }
    
    .btn {
        padding: 0.6rem 1.25rem;
        font-size: 0.9rem;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .container {
        padding: 0 12px;
    }
    
    .nav-brand a {
        font-size: 0.9rem;
    }
    
    .nav-menu {
        font-size: 0.75rem;
        gap: 0.4rem;
    }
    
    .hero-text h1 {
        font-size: 1.35rem;
    }
    
    .profile-picture {
        max-width: 200px;
        height: 200px;
    }
}

/* Dark mode mobile fixes */
@media (max-width: 768px) {
    [data-theme="dark"] .category-tabs-section {
        border-bottom: 1px solid var(--border);
    }
    
    [data-theme="dark"] .nav-menu::-webkit-scrollbar {
        height: 3px;
    }
    
    [data-theme="dark"] .nav-menu::-webkit-scrollbar-track {
        background: var(--bg-secondary);
    }
    
    [data-theme="dark"] .nav-menu::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 3px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .copy-code-btn {
        opacity: 1;
    }
    
    .btn:hover,
    .nav-menu a:hover {
        transform: none;
    }
    
    .achievement-card:hover,
    .blog-post-card:hover,
    .featured-post-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 1.5rem 0;
    }
    
    .profile-picture {
        max-width: 150px;
        height: 150px;
    }
    
    .navbar {
        position: relative;
    }
    
    .reading-progress-container {
        display: none;
    }
}

/* Print styles */
@media print {
    .navbar,
    .theme-toggle,
    .reading-progress-container,
    .flash-messages,
    footer,
    .social-share,
    .related-posts,
    .post-footer .back-to-blog {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .blog-post {
        padding: 1rem 0;
    }
    
    .post-content {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    .post-content a {
        text-decoration: underline;
        color: black;
        border-bottom: none;
    }
    
    .post-content pre {
        background: #f5f5f5 !important;
        border: 1px solid #ddd;
    }
}
