/* ⚡ PA33 Iframe Layout Management - Header/Footer Control */

/* Hide only TOP parts of Header when in iframe, keep navbar with burger button */
body.is-iframe .it-header-slim-wrapper,
body.is-iframe .it-header-center-wrapper {
    display: none !important;
}

/* Keep the navbar wrapper with burger button VISIBLE in iframe */
body.is-iframe .it-header-navbar-wrapper {
    display: block !important;
}

/* For custom templates (PROTEZIONECIVILEREGIONEABRUZZO, REGIONECALABRIA) - keep burger button */
body.is-iframe .custom-template .simplified-header .it-nav-wrapper {
    display: block !important;
}

/* Hide only unnecessary parts of simplified header in iframe */
body.is-iframe .custom-template .simplified-header .navbar-nav.ms-auto {
    display: none !important; /* Hide title/breadcrumb part */
}

/* Hide Footer completely when in iframe */
body.is-iframe .it-footer-wrapper {
    display: none !important;
}

/* Adjust main content spacing when header is hidden */
body.is-iframe .container-fluid,
body.is-iframe .gdlr-core-container {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Keep sidebar/menu always visible in iframe */
body.is-iframe .pa-sidebar {
    display: block !important;
}

/* Expand main content area when header/footer are hidden */
body.is-iframe .pa-content {
    min-height: 100vh;
    padding-top: 1rem;
}

/* When in iframe, expand sidebar to fill available space better */
body.is-iframe .pa-sidebar {
    min-height: 100vh;
    background-color: var(--bs-light, #f8f9fa);
    border-right: 1px solid var(--bs-border-color, #dee2e6);
}

/* Enhance burger button visibility and styling in iframe mode */
body.is-iframe .custom-navbar-toggler {
    background: var(--bs-primary, #0066cc) !important;
    color: var(--bs-white) !important;
    border: 2px solid var(--bs-primary, #0066cc) !important;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.25) !important;
    transition: all 0.25s ease !important;
}

body.is-iframe .custom-navbar-toggler:hover {
    background: var(--bs-primary-600, #0056b3) !important;
    border-color: var(--bs-primary-600, #0056b3) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.35) !important;
}

/* Make navbar wrapper more prominent in iframe */
body.is-iframe .it-header-navbar-wrapper {
    background: var(--bs-light, #f8f9fa) !important;
    border-bottom: 2px solid var(--bs-primary-100, #e6f3ff) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

/* Optional: Add subtle border when in iframe for visual clarity */
body.is-iframe {
    border: 2px solid var(--bs-primary-100, #e6f3ff);
    border-radius: var(--bs-border-radius-lg, 0.5rem);
}

/* Responsive adjustments for iframe mode */
@media (max-width: 991.98px) {
    body.is-iframe .pa-content {
        padding-top: 0.5rem;
    }
    
    /* Ensure mobile menu toggle is still accessible in iframe */
    body.is-iframe .custom-navbar-toggler {
        position: fixed;
        top: 0.5rem;
        left: 0.5rem;
        z-index: 1050;
        background: var(--bs-white);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

/* Debug info for development (remove in production) */
body.is-iframe::before {
    content: "🪟 Modalità Iframe Attiva";
    position: fixed;
    top: 0;
    right: 0;
    background: var(--bs-info);
    color: var(--bs-white);
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    z-index: 9999;
    border-radius: 0 0 0 var(--bs-border-radius);
    display: none; /* Nascosto di default, attiva per debug */
}

/* Show debug info only in development */
body.is-iframe.debug-mode::before {
    display: block;
}