/*
Theme Name: MEP Details
Theme URI: https://msportfolio.site/
Author: Mohit Sharma
Author URI: https://msportfolio.site/
Description: Production-ready MEP Engineering & Facility Management WordPress Theme featuring Point-to-Point AI Consultations, 6 Interactive MEP Calculators, 50+ SOP Library, Maintenance Checklists, Subscriber Access, and OpenAI GPT-4o Integration.
Version: 2.1.2
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mep-details
Tags: mep, facility-management, engineering, hvac, electrical, fire-safety, calculators, ai, openai
*/

/* Core WordPress Theme Defaults */
body {
    margin: 0;
    padding: 0;
}

/* Primary Header Dropdown Menus */
.primary-nav-menu ul.sub-menu,
.primary-nav-menu ul.children,
header nav ul.sub-menu {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    min-width: 240px !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 1rem !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04) !important;
    padding: 0.5rem !important;
    margin: 0 !important;
    list-style: none !important;
    display: none;
    z-index: 1000 !important;
    backdrop-filter: blur(12px) !important;
}

.primary-nav-menu li:hover > ul.sub-menu,
.primary-nav-menu li:focus-within > ul.sub-menu,
header nav li:hover > ul.sub-menu {
    display: block !important;
}

.primary-nav-menu ul.sub-menu li,
header nav ul.sub-menu li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.primary-nav-menu ul.sub-menu li a,
header nav ul.sub-menu li a {
    display: block !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    color: #334155 !important;
    border-radius: 0.5rem !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}

.primary-nav-menu ul.sub-menu li a:hover,
header nav ul.sub-menu li a:hover {
    background: #f0f9ff !important;
    color: #0077c8 !important;
}

/* ========================================================
   MOBILE & TABLET RESPONSIVE OPTIMIZATIONS
   ======================================================== */
@media (max-width: 639px) {
    /* Modal responsive scrolling & height fixes */
    #facilitypro-auth-modal {
        padding: 0.625rem !important;
        -webkit-overflow-scrolling: touch;
    }
    #facilitypro-auth-modal > div {
        max-height: 92dvh !important;
        max-height: 92vh !important;
    }
    #facilitypro-auth-modal form {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    #modal-register-submit-btn {
        min-height: 46px !important;
    }

    /* Consultation modal responsive drawer */
    #facilitypro-consultation-modal {
        -webkit-overflow-scrolling: touch;
    }
    #facilitypro-consultation-modal > div {
        max-height: 94dvh !important;
        max-height: 94vh !important;
    }

    /* Floating widget safe area */
    #mep-floating-ai-widget {
        bottom: max(1rem, env(safe-area-inset-bottom, 1rem)) !important;
        right: max(1rem, env(safe-area-inset-right, 1rem)) !important;
    }

    /* Touch targets and smooth scrolling */
    button, input, select, textarea {
        touch-action: manipulation;
    }

    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* Mobile Sticky Bottom Action Bar Safe Margins */
.mep-sticky-mobile-bar {
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0.75rem)) !important;
}

/* Prevent Mobile Overlap: When mobile sticky action bar is present (<1024px), hide floating AI widget */
@media (max-width: 1023px) {
    body.single-mep_knowledge #mep-floating-ai-widget,
    body.single #mep-floating-ai-widget,
    body.mep-has-sticky-bar #mep-floating-ai-widget,
    body:has(.mep-sticky-mobile-bar) #mep-floating-ai-widget {
        display: none !important;
        pointer-events: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}

/* Tablet Optimizations (640px to 1024px) */
@media (min-width: 640px) and (max-width: 1024px) {
    #facilitypro-auth-modal > div {
        max-height: 88vh !important;
    }
    #facilitypro-consultation-modal > div {
        max-height: 88vh !important;
    }
}

/* ========================================================
   DYNAMIC BLOG ARCHIVE & SINGLE POST TYPOGRAPHY
   ======================================================== */
.mep-share-bar a,
.mep-share-bar button {
    text-decoration: none !important;
}

.mep-pagination-container .page-numbers {
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#mepArticleBody h2 {
    font-size: 1.5rem !important;
    font-weight: 900 !important;
    color: #0f172a !important;
    margin-top: 2rem !important;
    margin-bottom: 0.75rem !important;
    padding-bottom: 0.5rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
    scroll-margin-top: 100px;
}

#mepArticleBody h3 {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    color: #1e293b !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0.5rem !important;
    scroll-margin-top: 100px;
}

#mepArticleBody p {
    margin-bottom: 1.25rem !important;
    line-height: 1.75 !important;
}

#mepArticleBody ul,
#mepArticleBody ol {
    margin-left: 1.5rem !important;
    margin-bottom: 1.25rem !important;
}

#mepArticleBody li {
    margin-bottom: 0.5rem !important;
}

#mepArticleBody blockquote {
    border-left: 4px solid #0077c8 !important;
    background: #f8fafc !important;
    padding: 1rem 1.25rem !important;
    border-radius: 0 0.75rem 0.75rem 0 !important;
    font-style: italic !important;
    color: #334155 !important;
    margin: 1.5rem 0 !important;
}

#mepArticleBody img {
    border-radius: 1rem !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
    margin: 1.5rem auto !important;
    max-width: 100% !important;
    height: auto !important;
}

#mepArticleBody table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 1.5rem 0 !important;
    font-size: 0.875rem !important;
}

#mepArticleBody table th,
#mepArticleBody table td {
    padding: 0.75rem 1rem !important;
    border: 1px solid #e2e8f0 !important;
}

#mepArticleBody table th {
    background: #f1f5f9 !important;
    font-weight: 700 !important;
    color: #0f172a !important;
}