/* ========================================
   MOBILE OPTIMIZATIONS
   Enhanced responsive design for all devices
   ======================================== */

/* ========================================
   GLOBAL MOBILE FIXES
   ======================================== */

/* Prevent horizontal scroll on mobile */
html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Better touch targets for mobile */
@media (max-width: 768px) {

    a,
    button,
    .btn,
    .nav-link {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ========================================
   TYPOGRAPHY - MOBILE
   ======================================== */

@media (max-width: 768px) {

    /* Hero Section */
    .hero-name {
        font-size: 2.5rem !important;
        line-height: 1.2;
    }

    .hero-role {
        font-size: 1.25rem !important;
    }

    .hero-tagline {
        font-size: 0.95rem !important;
    }

    /* Section Titles */
    h1 {
        font-size: 2rem !important;
    }

    h2 {
        font-size: 1.75rem !important;
    }

    h3 {
        font-size: 1.35rem !important;
    }

    h4 {
        font-size: 1.1rem !important;
    }

    /* Body Text */
    p,
    li {
        font-size: 0.95rem !important;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    .hero-name {
        font-size: 2rem !important;
    }

    .hero-role {
        font-size: 1.1rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }
}

/* ========================================
   NAVIGATION - MOBILE
   ======================================== */

@media (max-width: 991px) {
    .navbar-modern {
        padding: 0.75rem 1rem;
    }

    .mobile-menu {
        width: 100%;
        max-width: 100vw;
    }

    .mobile-nav-link {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }

    .mobile-menu-toggle {
        z-index: 1001;
    }
}

/* ========================================
   HERO SECTION - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .hero-section-custom {
        min-height: 100vh;
        padding: 80px 1rem 2rem;
    }

    .hero-img-custom {
        width: 150px !important;
        height: 150px !important;
        margin-bottom: 1.5rem !important;
    }

    .hero-social-icons {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero-icon-link {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .scroll-down-arrow {
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    .hero-img-custom {
        width: 120px !important;
        height: 120px !important;
    }

    .hero-icon-link {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
}

/* ========================================
   ABOUT SECTION - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .about-section {
        padding: 3rem 1rem;
    }

    .about-card {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }

    .about-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .about-avatar {
        width: 100px !important;
        height: 100px !important;
    }

    .about-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: 1.75rem !important;
    }

    .skills-container {
        gap: 0.5rem;
    }

    .skill-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Why AI/ML Section */
    .why-aiml-card {
        padding: 1.5rem;
    }

    .why-title {
        font-size: 1.3rem !important;
    }

    /* Expertise Grid */
    .expertise-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }

    .expertise-item {
        padding: 0.75rem;
    }

    .expertise-icon {
        font-size: 1.5rem;
    }

    .expertise-text {
        font-size: 0.85rem;
    }

    /* Featured Projects in About */
    .project-cards-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .project-highlight-card {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .about-stats-grid {
        grid-template-columns: 1fr !important;
    }

    .expertise-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ========================================
   EDUCATION SECTION - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .education-section-redesign {
        padding: 2rem 0.5rem;
    }

    .education-content-card {
        padding: 1.25rem;
        margin-left: 0;
    }

    .timeline-marker {
        display: none;
        /* Hide timeline on very small screens */
    }

    .education-item {
        padding-left: 0;
    }

    .edu-year-badge {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .edu-degree-title {
        font-size: 1.1rem !important;
    }

    .edu-highlights-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .highlight-badge {
        width: 100%;
        justify-content: center;
    }

    .edu-tech-stack {
        gap: 0.4rem;
    }

    .tech-chip {
        padding: 0.35rem 0.7rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .edu-tech-stack {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   SKILLS SECTION - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .skills-section-modern {
        padding: 3rem 1rem;
    }

    .skills-main-title {
        font-size: 2rem !important;
    }

    .skills-filters {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0 0.5rem;
    }

    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        flex: 1 1 auto;
        min-width: calc(50% - 0.25rem);
    }

    .skills-grid-modern {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
        padding: 0 0.5rem;
    }

    .skill-card-modern {
        padding: 1.25rem 0.75rem;
    }

    .skill-icon {
        font-size: 2rem;
    }

    .skill-name {
        font-size: 0.95rem !important;
    }

    .skill-level {
        font-size: 0.75rem;
    }

    /* Skill Modal */
    .skill-modal-content {
        width: 95%;
        margin: 1rem;
        padding: 1.5rem;
    }

    .skill-modal-icon {
        font-size: 2.5rem;
    }

    .skill-modal-title {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 480px) {
    .skills-grid-modern {
        grid-template-columns: 1fr !important;
    }

    .filter-btn {
        min-width: 100%;
    }
}

/* ========================================
   PROJECTS SECTION - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .projects-section-modern {
        padding: 3rem 1rem;
    }

    .projects-main-title {
        font-size: 2rem !important;
    }

    .projects-filters {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0 0.5rem;
    }

    /* Featured Projects */
    .hero-cards-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    .project-hero-card {
        flex-direction: column;
    }

    .project-hero-image {
        width: 100%;
        height: 200px;
    }

    .project-hero-content {
        padding: 1.5rem;
    }

    .hero-project-title {
        font-size: 1.5rem !important;
    }

    .hero-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .hero-tech-stack {
        gap: 0.4rem;
    }

    .hero-tech-tag {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }

    .hero-project-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .hero-btn-primary,
    .hero-btn-secondary {
        width: 100%;
        justify-content: center;
    }

    /* Other Projects Grid */
    .projects-grid-modern {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    .project-card-modern {
        margin: 0 0.5rem;
    }

    .project-card-image {
        height: 180px;
    }

    .project-card-content {
        padding: 1.25rem;
    }

    .project-card-title {
        font-size: 1.2rem !important;
    }

    .project-card-tech {
        gap: 0.4rem;
    }

    .project-tech-badge {
        padding: 0.35rem 0.7rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .project-hero-image {
        height: 160px;
    }

    .hero-metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   RESUME SECTION - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .resume-section {
        padding: 3rem 1rem;
    }

    .resume-card {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }

    .resume-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .resume-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   CONTACT SECTION - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .contact-section {
        padding: 3rem 1rem;
    }

    .contact-container {
        grid-template-columns: 1fr !important;
        gap: 2rem;
    }

    .contact-info-card,
    .contact-form-card {
        padding: 1.5rem;
    }

    .contact-method {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .contact-icon {
        margin: 0 auto;
    }

    .form-group input,
    .form-group textarea {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    .submit-btn {
        width: 100%;
    }
}

/* ========================================
   MODALS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-content {
        padding: 1.5rem;
    }

    .modal-project-img {
        max-height: 200px;
        object-fit: cover;
    }

    .glass-modal {
        backdrop-filter: blur(10px);
    }
}

/* ========================================
   SPACING & PADDING - MOBILE
   ======================================== */

@media (max-width: 768px) {
    section {
        padding: 3rem 1rem;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .col,
    [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {

    /* Reduce animation complexity on mobile */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.3s !important;
    }

    /* Simplify glassmorphism on mobile for better performance */
    .glass-card,
    .about-card,
    .skill-card-modern,
    .project-card-modern {
        backdrop-filter: blur(8px) !important;
    }

    /* Reduce neural network canvas complexity */
    #neural-network-canvas {
        opacity: 0.3;
    }
}

/* ========================================
   ACCESSIBILITY - MOBILE
   ======================================== */

@media (max-width: 768px) {

    /* Larger focus indicators for touch */
    *:focus {
        outline: 3px solid #FFC442;
        outline-offset: 2px;
    }

    /* Better spacing for readability */
    p {
        margin-bottom: 1rem;
    }

    /* Ensure links are easily tappable */
    a {
        padding: 0.25rem;
    }
}

/* ========================================
   LANDSCAPE MOBILE OPTIMIZATION
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
    .hero-section-custom {
        min-height: auto;
        padding: 60px 1rem 2rem;
    }

    .hero-img-custom {
        width: 100px !important;
        height: 100px !important;
    }

    .about-stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ========================================
   SMALL MOBILE (< 375px)
   ======================================== */

@media (max-width: 375px) {
    .hero-name {
        font-size: 1.75rem !important;
    }

    .hero-role {
        font-size: 1rem !important;
    }

    .hero-tagline {
        font-size: 0.85rem !important;
    }

    .skill-card-modern {
        padding: 1rem 0.5rem;
    }

    .project-card-content {
        padding: 1rem;
    }

    .about-card {
        padding: 1rem;
    }
}

/* ========================================
   TABLET OPTIMIZATION (768px - 1024px)
   ======================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .skills-grid-modern {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .projects-grid-modern {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .about-stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .expertise-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ========================================
   SAFE AREA INSETS (iPhone X+)
   ======================================== */

@supports (padding: max(0px)) {

    .navbar-modern,
    .mobile-menu,
    section {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .hero-section-custom {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {

    .navbar-modern,
    .mobile-menu-toggle,
    .scroll-down-arrow,
    .hero-social-icons,
    .contact-form-card {
        display: none !important;
    }

    section {
        page-break-inside: avoid;
    }

    .about-card,
    .project-card-modern,
    .skill-card-modern {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}

/* ========================================
   MOBILE SPACING IMPROVEMENTS
   ======================================== */

@media (max-width: 768px) {

    /* Better breathing room on mobile */
    body {
        padding: 0;
    }

    /* Improve card spacing */
    .about-card,
    .education-content-card,
    .skill-card-modern,
    .project-card-modern,
    .resume-card,
    .contact-info-card,
    .contact-form-card {
        margin-left: 0.75rem !important;
        margin-right: 0.75rem !important;
    }

    /* Better section spacing */
    section {
        padding: 2.5rem 1.25rem !important;
    }

    /* Hero section specific */
    .hero-section-custom {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }
}

/* ========================================
   RESUME SECTION - FIX EMPTY SPACE
   ======================================== */

@media (max-width: 768px) {
    .resume-section {
        padding: 2rem 1.25rem !important;
        min-height: auto !important;
    }

    .resume-card {
        padding: 1.75rem 1.25rem !important;
        min-height: auto !important;
    }

    .resume-card h2 {
        margin-bottom: 0.75rem !important;
    }

    .resume-card p {
        margin-bottom: 1.25rem !important;
    }

    .resume-actions {
        margin-top: 1.5rem !important;
        gap: 0.75rem !important;
    }

    /* Remove excessive padding/margins */
    .resume-section .container {
        padding: 0 !important;
    }

    .resume-section .row {
        margin: 0 !important;
    }
}

/* ========================================
   HERO SECTION - SLOW DOWN BACKGROUND
   ======================================== */

@media (max-width: 768px) {

    /* Reduce neural network opacity and complexity */
    #neural-network-canvas {
        opacity: 0.25 !important;
        filter: blur(1px);
    }

    /* Calm down any background animations */
    .hero-section-custom::before,
    .hero-section-custom::after {
        animation-duration: 20s !important;
    }
}