/* ========================================
   COMPREHENSIVE RESPONSIVE FIXES
   MIB IT Solutions - All Device Support
   ======================================== */

/* ========================================
   1. BASE RESET & OVERFLOW FIXES
   ======================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
    max-width: 100vw;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    max-width: 100%;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, video, iframe, embed {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   2. CONTAINER & SPACING FIXES
   ======================================== */
.container-fluid {
    max-width: 100%;
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    width: 100%;
}

/* Desktop - using Bootstrap defaults */

/* Tablet */
@media (min-width: 768px) and (max-width: 1199px) {
    .container {
        padding-left: 30px !important;
        padding-right: 30px !important;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .container {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
}

/* Small Mobile */
@media (max-width: 576px) {
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

/* Footer - Keep Tight */
.bg-dark .container,
footer .container,
.modern-footer .container {
    padding-left: 15px !important;
    padding-right: 15px !important;
}

/* ========================================
   3. TYPOGRAPHY RESPONSIVE SCALING
   ======================================== */
/* Desktop (Default) */
body {
    font-size: 16px;
    line-height: 1.6;
}

/* Tablet */
@media (max-width: 991px) {
    body { font-size: 15px; }
    h1, .h1 { font-size: 2rem !important; }
    h2, .h2 { font-size: 1.75rem !important; }
    h3, .h3 { font-size: 1.5rem !important; }
    h4, .h4 { font-size: 1.25rem !important; }
    h5, .h5 { font-size: 1.1rem !important; }
    h6, .h6 { font-size: 1rem !important; }
}

/* Mobile */
@media (max-width: 767px) {
    body { font-size: 15px; }
    h1, .h1 { font-size: 1.75rem !important; }
    h2, .h2 { font-size: 1.5rem !important; }
    h3, .h3 { font-size: 1.3rem !important; }
    h4, .h4 { font-size: 1.15rem !important; }
    h5, .h5 { font-size: 1rem !important; }
    h6, .h6 { font-size: 0.95rem !important; }
    
    p, li, a {
        font-size: 15px;
        line-height: 1.6;
    }
    
    .lead {
        font-size: 16px !important;
    }
}

/* Small Mobile */
@media (max-width: 576px) {
    body { font-size: 14px; }
    h1, .h1 { font-size: 1.5rem !important; }
    h2, .h2 { font-size: 1.35rem !important; }
    h3, .h3 { font-size: 1.2rem !important; }
    h4, .h4 { font-size: 1.1rem !important; }
    h5, .h5 { font-size: 1rem !important; }
    h6, .h6 { font-size: 0.9rem !important; }
    
    p, li, a {
        font-size: 14px;
    }
}

/* ========================================
   4. NAVIGATION RESPONSIVE FIXES
   ======================================== */
/* Topbar */
@media (max-width: 991px) {
    #topbar {
        display: none !important;
    }
}

/* Navbar */
#mainNavbar {
    position: relative;
    z-index: 1000;
}

@media (max-width: 991px) {
    #mainNavbar {
        padding: 15px 20px !important;
    }
    
    .navbar-brand img {
        width: 75px !important;
    }
    
    .mobile-menu-toggle {
        display: block !important;
    }
    
    .navbar-collapse {
        display: none !important;
    }
}

@media (max-width: 576px) {
    #mainNavbar {
        padding: 12px 15px !important;
    }
    
    .navbar-brand img {
        width: 65px !important;
    }
}

/* Mobile Sidebar */
.mobile-sidebar {
    z-index: 10000 !important;
}

.sidebar-overlay {
    z-index: 9999 !important;
}

/* ========================================
   5. SLIDER FIXES
   ======================================== */

/* About Page Banner - Mobile */
@media (max-width: 991px) {
    .about-hero {
        height: 350px !important;
    }
}

@media (max-width: 767px) {
    .about-hero {
        height: 250px !important;
        background-position: center center !important;
    }
}

@media (max-width: 576px) {
    .about-hero {
        height: 200px !important;
    }
}

/* ========================================
   6. GRID & ROW FIXES
   ======================================== */
.row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Desktop */
@media (min-width: 992px) {
    [class*="col-"] {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991px) {
    [class*="col-"] {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

/* Mobile */
@media (max-width: 767px) {
    [class*="col-"] {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    .row.g-4,
    .row.g-5 {
        --bs-gutter-y: 1.5rem;
        --bs-gutter-x: 0;
    }
}

/* Small Mobile */
@media (max-width: 576px) {
    [class*="col-"] {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

/* ========================================
   7. SECTION SPACING FIXES
   ======================================== */
/* Desktop */
.py-5 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
}

/* Tablet */
@media (max-width: 991px) {
    .py-5 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
    
    .my-5 {
        margin-top: 2.5rem !important;
        margin-bottom: 2.5rem !important;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .my-5 {
        margin-top: 2rem !important;
        margin-bottom: 2rem !important;
    }
    
    .mb-5 {
        margin-bottom: 1.5rem !important;
    }
    
    .mt-5 {
        margin-top: 1.5rem !important;
    }
}

/* Small Mobile */
@media (max-width: 576px) {
    .py-5 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    .my-5 {
        margin-top: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
}

/* ========================================
   8. BUTTON RESPONSIVE FIXES
   ======================================== */
.btn {
    white-space: nowrap;
    transition: all 0.3s ease;
}

/* Tablet */
@media (max-width: 991px) {
    .btn {
        padding: 10px 20px !important;
        font-size: 14px !important;
    }
    
    .btn-lg {
        padding: 12px 24px !important;
        font-size: 15px !important;
    }
    
    .btn-sm {
        padding: 6px 12px !important;
        font-size: 13px !important;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .btn {
        padding: 10px 18px !important;
        font-size: 14px !important;
    }
    
    .btn-lg {
        padding: 11px 20px !important;
        font-size: 14px !important;
    }
}

/* Small Mobile */
@media (max-width: 576px) {
    .btn {
        padding: 8px 16px !important;
        font-size: 13px !important;
    }
}

/* ========================================
   9. CARD COMPONENT FIXES
   ======================================== */
.card,
.service-item,
.blog-card,
.job-card,
.team-item {
    margin-bottom: 1.5rem;
    width: 100%;
}

/* Mobile */
@media (max-width: 767px) {
    .card,
    .service-item,
    .blog-card,
    .job-card,
    .team-item {
        margin-bottom: 1.25rem;
    }
    
    .card-body {
        padding: 1.25rem !important;
    }
    
    .service-item {
        padding: 20px 15px !important;
        height: auto !important;
    }
}

/* Small Mobile */
@media (max-width: 576px) {
    .card-body {
        padding: 1rem !important;
    }
    
    .service-item {
        padding: 15px 12px !important;
    }
}

/* ========================================
   10. FORM ELEMENT FIXES
   ======================================== */
/* Prevent iOS zoom on input focus */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
textarea,
select {
    font-size: 16px !important;
}

@media (max-width: 767px) {
    .form-control,
    .form-select {
        font-size: 16px !important;
        padding: 12px !important;
        height: auto !important;
    }
    
    .form-label {
        font-size: 14px !important;
        margin-bottom: 0.5rem !important;
    }
    
    textarea.form-control {
        min-height: 100px !important;
    }
}

/* ========================================
   11. MODAL RESPONSIVE FIXES
   ======================================== */
@media (max-width: 767px) {
    .modal-dialog {
        margin: 0.5rem !important;
        max-width: calc(100% - 1rem) !important;
    }
    
    .modal-content {
        border-radius: 10px !important;
    }
    
    .modal-header {
        padding: 1rem !important;
    }
    
    .modal-body {
        padding: 1rem !important;
        max-height: calc(100vh - 150px) !important;
        overflow-y: auto !important;
    }
    
    .modal-footer {
        padding: 0.75rem !important;
    }
}

/* ========================================
   12. TABLE RESPONSIVE FIXES
   ======================================== */
@media (max-width: 767px) {
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    table {
        font-size: 14px !important;
    }
    
    table th,
    table td {
        padding: 0.5rem !important;
        white-space: nowrap;
    }
}

/* ========================================
   13. IMAGE & MEDIA FIXES
   ======================================== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-fluid {
    width: 100%;
    height: auto;
}

/* Portfolio Images */
.portfolio-image,
.blog-img-wrapper,
.team-img {
    overflow: hidden;
    position: relative;
}

@media (max-width: 767px) {
    .portfolio-image {
        height: 220px !important;
    }
    
    .blog-img-wrapper {
        height: 200px !important;
    }
    
    .team-img {
        height: auto !important;
    }
}

/* ========================================
   14. FOOTER RESPONSIVE FIXES
   ======================================== */
.modern-footer {
    overflow: visible !important;
}

@media (max-width: 767px) {
    .footer-cta-banner {
        margin: 0 15px !important;
        padding: 25px 20px !important;
        text-align: center;
    }
    
    .footer-cta-title {
        font-size: 1.25rem !important;
    }
    
    .footer-content {
        padding: 80px 0 40px !important;
    }
    
    .footer-section-title {
        font-size: 1.1rem !important;
        margin-top: 1.5rem !important;
    }
    
    .footer-links li {
        margin-bottom: 10px !important;
    }
    
    .footer-links a {
        font-size: 14px !important;
    }
    
    .footer-contact-item {
        font-size: 14px !important;
    }
    
    .newsletter-form {
        flex-direction: column !important;
    }
    
    .newsletter-input,
    .newsletter-btn {
        width: 100% !important;
    }
}

/* ========================================
   15. SECTION TITLE FIXES
   ======================================== */
@media (max-width: 767px) {
    .section-title {
        text-align: center !important;
        padding: 0 10px !important;
    }
    
    .section-title h1,
    .section-title h2,
    .section-title h3,
    .section-title h5 {
        text-align: center !important;
    }
    
    /* Hide underline animation on mobile */
    .section-title::before,
    .section-title::after {
        display: none !important;
    }
}

/* ========================================
   16. UTILITY CLASSES
   ======================================== */
/* Text Alignment */
@media (max-width: 767px) {
    .text-md-start,
    .text-md-end {
        text-align: center !important;
    }
}

/* Display Utilities */
@media (max-width: 767px) {
    .d-md-none {
        display: none !important;
    }
    
    .d-md-block {
        display: block !important;
    }
}

/* Flex Utilities */
@media (max-width: 767px) {
    .flex-md-column {
        flex-direction: column !important;
    }
    
    .justify-content-md-center {
        justify-content: center !important;
    }
}

/* ========================================
   17. ANIMATION PERFORMANCE
   ======================================== */
/* Disable heavy animations on mobile for performance */
@media (max-width: 767px) {
    .wow,
    [data-wow-delay],
    .animate__animated {
        animation-duration: 0.5s !important;
    }
    
    /* Simplify hover effects */
    .service-item:hover,
    .blog-card:hover,
    .portfolio-card:hover {
        transform: none !important;
    }
}

/* ========================================
   18. ACCESSIBILITY IMPROVEMENTS
   ======================================== */
/* Focus states */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #06A3DA !important;
    outline-offset: 2px !important;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #06A3DA;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* ========================================
   19. PRINT STYLES
   ======================================== */
@media print {
    .navbar,
    .footer,
    .btn,
    .mobile-sidebar,
    .sidebar-overlay {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    a {
        text-decoration: underline;
    }
}

/* ========================================
   20. BROWSER-SPECIFIC FIXES
   ======================================== */
/* Safari iOS */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-text-size-adjust: 100%;
    }
}

/* Firefox */
@-moz-document url-prefix() {
    .form-control {
        padding: 0.75rem !important;
    }
}

/* Edge */
@supports (-ms-ime-align: auto) {
    .btn {
        padding: 0.5rem 1rem !important;
    }
}
