/* Mobile Responsiveness Fixes */

/* Global Adjustments */
@media (max-width: 768px) {
    :root {
        --section-padding: 60px 1.5rem;
    }

    body {
        overflow-x: hidden;
        /* Prevent horizontal scroll */
        font-size: 16px;
        /* Base font size */
    }

    /* Typography */
    .section-title {
        font-size: 2.2rem !important;
        /* Force override */
    }

    /* Hero Section */
    .hero {
        padding: 120px 1.5rem 60px !important;
        height: auto !important;
        /* Allow content to dictate height */
        min-height: 100vh;
        text-align: center;
        flex-direction: column;
        gap: 3rem;
    }

    .hero h1 {
        font-size: 2.5rem !important;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1rem !important;
        margin-bottom: 2rem;
    }

    .hero-btns {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        text-align: center;
        margin: 0 !important;
        padding: 0.8rem 1.5rem;
    }

    .hero-visual {
        width: 100%;
        transform: none !important;
        /* Disable complex transforms causing overflow */
        margin-top: 2rem;
    }

    .hero-image-container {
        border-radius: 15px;
    }

    /* Stats Section */
    .stats-section {
        padding: 40px 1.5rem !important;
    }

    .stats-container {
        grid-template-columns: 1fr 1fr !important;
        /* Force 2 columns */
        gap: 1rem !important;
    }

    .stat-item {
        padding: 1rem !important;
    }

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

    /* Services & Projects */
    .services,
    .projects,
    .tech-stack,
    .iot-showcase,
    .contact {
        padding: 60px 1.5rem !important;
    }

    .service-card,
    .project-card {
        padding: 2rem 1.5rem !important;
    }

    /* Tech Stack Grid */
    .tech-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    .tech-item {
        padding: 1.5rem 1rem !important;
    }

    /* Contact Form */
    .contact-container {
        padding: 2rem 1.5rem !important;
        flex-direction: column;
        gap: 3rem;
    }

    .contact-info h2 {
        font-size: 2rem !important;
    }

    /* Footer */
    .footer {
        padding: 3rem 1.5rem 2rem !important;
        text-align: center;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1.5rem;
    }

    /* Navbar Mobile */
    .nav-container {
        padding: 0 1.5rem !important;
    }

    .nav-links {
        width: 100% !important;
        /* Full width menu */
        border-left: none !important;
        background: rgba(0, 0, 0, 0.95);
        padding-top: 80px;
        justify-content: flex-start !important;
        gap: 2rem !important;
    }

    .nav-links a {
        font-size: 1.5rem !important;
        /* Larger text for better clicking */
    }

    /* Modal Fixes */
    .modal-content {
        width: 95% !important;
        height: 90vh !important;
        margin-top: 20px;
    }

    .modal-header {
        padding: 1rem 1.5rem !important;
    }

    .modal-tabs {
        padding: 0 1rem !important;
        overflow-x: auto;
        /* Allow scrolling tabs */
        justify-content: flex-start;
    }

    .tab-btn {
        padding: 1rem !important;
        font-size: 0.9rem !important;
        white-space: nowrap;
    }

    .tab-content {
        padding: 1rem !important;
    }

    /* Back Button on Projects Page */
    .back-btn-container {
        position: fixed !important;
        top: 120px !important;
        left: 20px !important;
        margin: 0 !important;
        display: block;
        z-index: 2000 !important;
    }

    .back-btn {
        background: rgba(0, 0, 0, 0.8) !important;
        width: fit-content;
    }

    /* Project Page Header */
    .projects-page-header {
        padding-top: 100px !important;
        padding-bottom: 30px !important;
    }

    .projects-page-header h1 {
        font-size: 2.2rem !important;
    }
}

/* Small Phones (iPhone SE, etc) */
@media (max-width: 380px) {
    .hero h1 {
        font-size: 2rem !important;
    }

    .stats-container,
    .tech-grid {
        grid-template-columns: 1fr !important;
        /* 1 column for very small screens */
    }
}