/* Base Responsive Styles */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* Fluid Typography */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Responsive Grid System */
.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.grid-item {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Media Queries */
@media (max-width: 991.98px) {
    .navbar-collapse {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        padding: 1rem;
        -webkit-overflow-scrolling: touch;
        z-index: 1000;
    }
    
    .navbar-nav {
        padding-top: 1rem;
    }
    
    .nav-item {
        margin-bottom: 0.5rem;
    }
    
    .dropdown-menu {
        position: static !important;
        transform: none !important;
    }
}

@media (max-width: 767.98px) {
    .main-navbar .navbar-collapse {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: white;
        z-index: 1000;
        padding: 1rem;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }

    .responsive-grid {
        grid-template-columns: 1fr;
    }

    .card {
        margin-top: 2rem !important;
    }
    
    .col-md-8 {
        padding: 0 15px;
    }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    .grid-item {
        padding: 1rem;
    }
    
    .main-navbar .nav-link {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

@media (min-width: 1200px) {
    .container-fluid {
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* Touch Optimization */
@media (pointer: coarse) {
    .btn, .nav-link, .dropdown-item {
        min-width: 48px;
        min-height: 48px;
        padding: 12px !important;
    }
}

/* Responsive Images */
img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Flexible Iframes */
iframe, object, embed {
    max-width: 100%;
}

/* Fallback for CSS Grid */
@supports not (display: grid) {
    .responsive-grid {
        display: flex;
        flex-wrap: wrap;
    }
    .grid-item {
        flex: 1 1 300px;
        margin: 1rem;
    }
}

/* Footer Positioning */
.min-vh-100 {
    min-height: 100vh;
}
