/* =========================================
   COMPREHENSIVE RESPONSIVE DESIGN
   Mobile First Approach
   ========================================= */

/* =========================================
   LARGE DESKTOP (1400px+)
   ========================================= */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }

    .hero-container {
        gap: 4rem;
    }

    .section-header h2 {
        font-size: 4rem;
    }
}

/* =========================================
   DESKTOP TO TABLET (1024px - 1400px)
   ========================================= */
@media (max-width: 1400px) and (min-width: 1024px) {
    .container {
        max-width: 1200px;
        padding: 0 2rem;
    }

    .hero-container {
        gap: 3rem;
    }

    .section-header h2 {
        font-size: 3rem;
    }
}

/* =========================================
   TABLET (768px - 1024px)
   ========================================= */
@media (max-width: 1024px) {

    /* Container & Layout */
    .container {
        padding: 0 1.5rem;
    }

    /* Navigation */
    .nav-container {
        padding: 0 1.5rem;
    }

    .nav-logo span:last-child {
        font-size: 0.875rem;
    }

    /* Hero Section */
    .hero {
        padding: 6rem 0 4rem;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }

    .hero-visual {
        height: 400px;
        max-height: 500px;
    }

    .hero-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .hero-stats {
        justify-content: center;
        gap: 1.5rem;
    }

    .stat {
        min-width: 140px;
    }

    /* Services Section */
    .services-timeline-section {
        padding: 3rem 0 6rem;
    }

    .section-header {
        margin-bottom: 5rem;
    }

    .section-header h2 {
        font-size: clamp(2rem, 4vw, 3rem);
    }

    /* Technologies Section */
    .technologies {
        padding: 6rem 0;
    }

    .tech-grid {
        padding: 2rem 3%;
        gap: 1.5rem;
    }

    .tech-item {
        width: 280px;
        min-width: 280px;
    }

    /* Contact Section */
    .contact {
        padding: 6rem 0;
    }

    .contact-content {
        gap: 3rem;
    }

    /* Digital Twin Visualizations */
    .digital-twin-container {
        height: 400px;
    }

    .data-dashboard {
        width: 200px;
        top: 15px;
        right: 15px;
        padding: 0.875rem;
    }

    .metrics-grid {
        gap: 0.5rem;
    }

    .metric-value {
        font-size: 1.125rem;
    }

    .data-point {
        padding: 0.375rem;
    }

    .data-icon {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.625rem;
    }

    .data-value {
        font-size: 0.75rem;
    }

    .data-label {
        font-size: 0.5rem;
    }

    /* Modal */
    .modal-content {
        width: 90%;
        max-width: 800px;
        margin: 5% auto;
        padding: 2.5rem;
    }

    .modal-content-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* =========================================
   MOBILE (320px - 768px)
   ========================================= */
@media (max-width: 768px) {

    /* Container & Layout */
    .container {
        padding: 0 1rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }

    * {
        max-width: 100%;
        word-wrap: break-word;
    }

    /* Navigation */
    .navbar {
        padding: 0.75rem 0;
    }

    .nav-container {
        padding: 0 1rem;
        max-width: 100%;
    }

    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 4rem;
        flex-direction: column;
        background: var(--nav-background);
        width: 100%;
        text-align: center;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
        padding: 2rem 0;
        gap: 1rem;
        z-index: 1000;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        display: block;
        padding: 1rem;
        font-size: 1.125rem;
    }

    .nav-logo {
        gap: 0.5rem;
        flex-shrink: 0;
    }

    .nav-logo .logo-text {
        font-size: 1.25rem;
        white-space: nowrap;
    }

    .nav-logo span:last-child {
        display: none;
    }

    /* Hero Section */
    .hero {
        padding: 5rem 0 3rem;
        min-height: auto;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
        padding: 0 1rem;
    }

    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1.25rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .hero-description {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 1.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .hero-description strong {
        display: block;
        margin-bottom: 0.5rem;
    }

    .hero-badge {
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
        margin-bottom: 1.25rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }

    .hero-actions {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        justify-content: center;
        margin-bottom: 2rem;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        max-width: 320px;
        padding: 1rem 1.5rem;
        font-size: 0.9375rem;
        justify-content: center;
        white-space: nowrap;
    }

    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        justify-content: center;
        max-width: 100%;
    }

    .stat {
        min-width: auto;
        padding: 0.75rem 0.5rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .stat-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }

    .stat-number {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.625rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .hero-visual {
        height: 280px;
        max-height: 350px;
        width: 100%;
    }

    /* Services Section */
    .services-timeline-section {
        padding: 2.5rem 0 4rem;
    }

    .section-header {
        margin-bottom: 3rem;
        padding-top: 0;
    }

    .section-header h2 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .section-header p {
        font-size: 1rem;
    }

    /* Technologies Section */
    .technologies {
        padding: 4rem 0;
    }

    .tech-grid {
        padding: 2rem 1rem;
        gap: 1.25rem;
    }

    .tech-item {
        width: 280px;
        min-width: 280px;
    }

    .tech-item h3 {
        font-size: 0.9375rem;
    }

    .tech-item p {
        font-size: 0.8125rem;
        padding: 0 1.25rem 1.5rem;
    }

    /* Contact Section */
    .contact {
        padding: 4rem 0;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .contact-info h2 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .contact-info p {
        font-size: 1rem;
    }

    .contact-features {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .contact-form {
        padding: 2rem 1.5rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    input,
    select,
    textarea {
        font-size: 1rem;
        padding: 0.875rem;
    }

    /* Footer */
    .footer {
        padding: 3rem 0 2rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
        align-items: center;
    }

    .footer-logo {
        gap: 0.5rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }

    .footer-bottom {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }

    /* Digital Twin Visualizations */
    .digital-twin-container {
        height: 300px;
    }

    .data-dashboard {
        width: 180px;
        top: 10px;
        right: 10px;
        padding: 0.75rem;
    }

    .dashboard-header h4 {
        font-size: 0.75rem;
    }

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

    .metric-card {
        padding: 0.375rem;
    }

    .metric-value {
        font-size: 1rem;
    }

    .metric-label {
        font-size: 0.625rem;
    }

    .data-point {
        padding: 0.25rem;
    }

    .data-icon {
        width: 1.25rem;
        height: 1.25rem;
        font-size: 0.5rem;
    }

    .data-value {
        font-size: 0.625rem;
    }

    .data-label {
        font-size: 0.5rem;
    }

    .control-panel {
        gap: 0.25rem;
        padding: 0.375rem;
    }

    .control-btn {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }

    /* Modal */
    .modal-content {
        margin: 5% auto;
        padding: 1.5rem;
        width: 95%;
        max-width: 100%;
        border-radius: 16px;
    }

    .modal-header {
        margin-bottom: 1.5rem;
    }

    .modal-hero {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }

    .modal-icon {
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.5rem;
    }

    .modal-title-section h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .modal-title-section h3 {
        font-size: 1rem;
    }

    .modal-content-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

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

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

    /* BI Modal */
    .bi-modal-content {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        max-width: 100%;
    }

    .modal-iframe-container {
        height: calc(100vh - 60px);
    }
}

/* =========================================
   SMALL MOBILE (320px - 480px)
   ========================================= */
@media (max-width: 480px) {

    /* Typography */
    .hero h1 {
        font-size: 1.75rem;
        line-height: 1.25;
    }

    .section-header h2 {
        font-size: 1.75rem;
    }

    /* Buttons */
    .btn-primary,
    .btn-secondary {
        padding: 0.875rem 1.25rem;
        font-size: 0.875rem;
    }

    /* Hero Stats - Single Column on Very Small Screens */
    .hero-stats {
        grid-template-columns: 1fr;
        max-width: 250px;
        margin: 0 auto;
    }

    /* Technologies */
    .tech-item {
        width: 260px;
        min-width: 260px;
    }

    /* Contact Form */
    .contact-form {
        padding: 1.5rem 1rem;
    }

    /* Modal */
    .modal-content {
        padding: 1.25rem;
    }

    .modal-title-section h2 {
        font-size: 1.25rem;
    }

    /* Reduce spacing for very small screens */
    .services-timeline-section,
    .technologies,
    .contact {
        padding: 3rem 0;
    }
}

/* =========================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================= */
@media (hover: none) and (pointer: coarse) {

    /* Ensure minimum tap target size of 44px */
    .btn-primary,
    .btn-secondary,
    .service-btn,
    .feature-toggle-btn,
    .control-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .tech-item:hover,
    .service-card:hover,
    .node-card:hover {
        transform: none;
    }

    /* Make scrollable areas more obvious */
    .tech-grid {
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
}

/* =========================================
   PRINT STYLES
   ========================================= */
@media print {

    .navbar,
    .hamburger,
    .hero-actions,
    .contact-form,
    .modal,
    .control-panel {
        display: none;
    }

    .hero-container,
    .contact-content {
        grid-template-columns: 1fr;
    }

    body {
        background: white;
        color: black;
    }
}