/* ====================
   RESPONSIVE DESIGN FIXES
   ==================== */

/* Prevent horizontal scrollbars across all devices */
html, body {
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

@media (max-width: 768px) {
    /* Text sizing for mobile */
    h1 {
        font-size: 1.875rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    h4 {
        font-size: 1.125rem !important;
    }
    
    /* Container padding - reduce on very small screens */
    .container, [class*="max-w-"] {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Hero sections - responsive */
    section[class*="hero"], 
    .relative.bg-cover {
        padding-left: 0 !important;
        padding-right: 0 !important;
        height: auto !important;
        min-height: 250px !important;
    }
    
    section[class*="hero"] h1 {
        font-size: 1.875rem !important;
    }
    
    section[class*="hero"] p {
        font-size: 0.875rem !important;
    }
    
    /* Responsive iframes and embedded content */
    iframe {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 300px !important;
    }
    
    .map-container {
        height: 300px !important;
    }
    
    /* Responsive grid items */
    [class*="grid-cols-"] {
        gap: 1.5rem !important;
    }
    
    .grid {
        gap: 1rem !important;
    }
    
    /* Responsive forms */
    .form-input {
        width: 100% !important;
    }
    
    /* Contact info responsive */
    .contact-info {
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    /* Navigation menu fix */
    #mobile-menu {
        width: 100vw;
        max-width: 100vw;
    }
    
    /* Images responsive */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Table responsive */
    table {
        width: 100%;
        overflow-x: auto;
        display: block;
    }
    
    /* Blog post content responsive */
    .blog-content, .post-content {
        width: 100%;
        padding: 0 1rem;
    }
    
    /* Course/Service cards responsive */
    .course-card, .service-card {
        margin: 0 auto;
    }
}

/* Tablet devices (768px to 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    h1 {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 1.75rem !important;
    }
    
    /* Adjust grid for tablet */
    .grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Extra small devices (below 480px) */
@media (max-width: 480px) {
    * {
        /* Prevent unwanted zoom on touch devices */
        -webkit-tap-highlight-color: transparent;
    }
    
    html, body {
        width: 100vw;
        overflow-x: hidden;
    }
    
    /* Hero sections on very small screens */
    section[class*="hero"],
    .relative.bg-cover {
        min-height: 200px !important;
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    h1 {
        font-size: 1.5rem !important;
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 1.375rem !important;
    }
    
    /* Container adjustments */
    .px-4, .px-6, .px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Reduce grid gap */
    .gap-8 {
        gap: 1rem !important;
    }
    
    /* Navigation styling for very small screens */
    nav {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .nav-link {
        padding: 0.5rem 0.25rem !important;
    }
    
    /* Full-width buttons */
    .apply-btn, button {
        width: 100% !important;
    }
    
    /* Contact form responsive */
    form input, form textarea {
        width: 100% !important;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Reduce margins and padding */
    .py-16, .py-20, .py-24 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .mb-12, .mb-16 {
        margin-bottom: 1.5rem !important;
    }
}

/* Large screens - optimize spacing */
@media (min-width: 1440px) {
    .container, [class*="max-w"] {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Fix for specific elements causing overflow */
.overflow-x-auto, [class*="overflow-x-"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Remove any transform that might cause scrollbar */
@keyframes slideInLeft {
    from { 
        transform: translateX(-30px);
        opacity: 0;
    }
    to { 
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from { 
        transform: translateX(30px);
        opacity: 0;
    }
    to { 
        transform: translateX(0);
        opacity: 1;
    }
}

/* Ensure all text fits within viewport */
body {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Responsive spacing utilities */
@media (max-width: 768px) {
    [class*="px-"] {
        max-width: 100vw;
    }
    
    [class*="mx-auto"] {
        margin-left: auto;
        margin-right: auto;
    }
}

/* Mobile Menu Centered Display */
@media (max-width: 768px) {
    #mobile-menu {
        position: fixed;
        top: 60px;
        left: 50%;
        transform: translateX(-50%) scaleY(0);
        transform-origin: top center;
        max-width: 90vw;
        width: 90%;
        max-height: 85vh;
        background-color: #1e293b;
        border-radius: 0.5rem;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        z-index: 999;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        padding: 1rem;
    }
    
    #mobile-menu.open {
        max-height: 85vh;
        transform: translateX(-50%) scaleY(1);
        display: flex;
        flex-direction: column;
    }
    
    #mobile-menu ul {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #mobile-menu ul li {
        width: 100%;
    }
    
    #mobile-menu ul li a {
        display: block;
        padding: 0.75rem 1rem !important;
        border-radius: 0.375rem;
        transition: all 0.3s ease;
    }
    
    #mobile-menu ul li a:hover {
        background-color: rgba(241, 90, 36, 0.1);
    }
    
    #mobile-menu .flex.items-center {
        width: 100%;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(148, 163, 184, 0.2);
        flex-direction: column;
        gap: 0.75rem;
    }
    
    #mobile-menu .apply-btn {
        width: 100%;
    }
    
    /* Add overlay effect */
    body.menu-open {
        overflow: hidden;
    }
    
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.4);
        z-index: 998;
    }
}
