/* ===== CRITICAL LAYOUT FIXES ===== */

/* Force proper centering and prevent overflow */
body {
    position: relative;
    width: 100vw;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Ensure all content stays within container */
.container {
    width: 100% !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    box-sizing: border-box !important;
}

/* Fix all sections */
section {
    width: 100% !important;
    max-width: 100vw !important;
    overflow: hidden !important;
    position: relative;
}

/* Center all headings and text */
.hero-title,
.section-title,
.hero-description,
.section-subtitle {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Fix hero section */
.hero-content {
    text-align: center !important;
    margin: 0 auto !important;
    max-width: 900px !important;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem) !important;
    line-height: 1.2 !important;
    padding: 0 10px !important;
}

.hero-description {
    max-width: 700px !important;
    padding: 0 20px !important;
}

.hero-buttons {
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 15px !important;
}

/* Fix grids */
.services-grid,
.solutions-grid,
.team-grid,
.talks-grid,
.footer-content {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)) !important;
    gap: 30px !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Fix cards */
.tech-card,
.service-card,
.solution-card,
.team-card,
.talk-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

/* Fix images */
img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

/* Fix navbar */
.navbar-container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    width: 100% !important;
}

.nav-links {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 15px !important;
}

/* Fix footer */
.footer {
    width: 100% !important;
    max-width: 100vw !important;
}

.footer-content {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
    gap: 30px !important;
}

/* Fix contact form */
.contact-content {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 40px !important;
    width: 100% !important;
}

.contact-form-wrapper {
    max-width: 100% !important;
    padding: 30px !important;
}

/* Prevent text overflow */
p, li, span:not(.logo-primary):not(.logo-secondary) {
    max-width: 100% !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Fix mobile menu */
@media (max-width: 992px) {
    .nav-links {
        position: fixed !important;
        right: -100% !important;
        transition: right 0.3s ease !important;
    }
    
    .nav-links.active {
        right: 0 !important;
    }
}

/* Fix very small screens */
@media (max-width: 400px) {
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    .tech-card {
        padding: 20px !important;
    }
    
    .btn {
        width: 100% !important;
        max-width: 300px !important;
        margin: 5px auto !important;
    }
}

/* Add visual grid for debugging */
.debug-grid {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(90deg, rgba(0, 180, 216, 0.1) 1px, transparent 1px),
        linear-gradient(0deg, rgba(0, 180, 216, 0.1) 1px, transparent 1px);
    background-size: 100px 100px;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
}

.debug-grid.active {
    opacity: 0.5;
}

/* Professional IT pattern overlay */
.it-pattern-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(0, 180, 216, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(46, 139, 87, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Terminal/Code inspired elements */
.terminal-style {
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--secondary-main);
    border-radius: 8px;
    padding: 20px;
    position: relative;
}

.terminal-style::before {
    content: '> ';
    color: var(--secondary-main);
    font-weight: bold;
}

/* Responsive text sizing */
.responsive-text {
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: clamp(1.5, 2vw, 1.8);
}

/* Center utility class */
.center-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

/* Grid safety */
.grid-safe {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 20px;
    width: 100%;
}

/* Prevent horizontal scroll */
.no-horizontal-scroll {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

/* Fix for Safari */
@supports (-webkit-touch-callout: none) {
    .hero {
        min-height: -webkit-fill-available;
    }
}