/**
 * ============================================================================
 * ADEPT TRAINING CENTER — RESPONSIVE & PWA FALLBACKS
 * File: css/responsive-pwa.css
 *
 * Purpose:
 *   A SHARED fallback layer for device features that per-page CSS files
 *   can't easily target: PWA modes, safe areas, touch ergonomics, print,
 *   accessibility preferences, high-DPI displays.
 *
 * IMPORTANT:
 *   This file must NOT override per-page grid/layout rules. Those belong
 *   in home.css, about.css, catalog.css, contact.css, adeptcenters.css,
 *   calendar.css — one source of truth per component.
 *
 * Loaded LAST in <head> on every page.
 * ============================================================================
 */

/* ============================================================================
 * 1. PWA STANDALONE DISPLAY MODES
 * ============================================================================ */
@media all and (display-mode: standalone) {
    body {
        overscroll-behavior-y: none;
        -webkit-user-select: none;
        user-select: none;
    }

    p, h1, h2, h3, h4, span, input, textarea, select {
        -webkit-user-select: text;
        user-select: text;
    }

    .pwa-install-banner,
    .pwa-install-prompt {
        display: none !important;
    }

    .header-main,
    .adt-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .pwa-bottom-bar {
        display: flex !important;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

@media all and (display-mode: browser) {
    .pwa-only-control { display: none !important; }
}

@media all and (display-mode: minimal-ui) {
    .header-main {
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* ============================================================================
 * 2. NOTCH & SAFE AREA INSETS
 * ============================================================================ */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .modal-backdrop,
    .modal-container,
    .mobile-drawer {
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    footer,
    .footer-main,
    .catalog-pagination-wrap {
        padding-bottom: max(32px, calc(16px + env(safe-area-inset-bottom)));
    }
}

/* ============================================================================
 * 3. TOUCH ERGONOMICS
 * ============================================================================ */
@media (pointer: coarse) {
    button,
    .btn,
    .category-tab-btn,
    .pagination-btn,
    .per-page-btn,
    .nav-link,
    input,
    select {
        min-height: 44px;
        min-width: 44px;
    }

    .dropdown-menu a,
    .catalog-category-item {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .hover-tooltip { display: none; }
}

/* ============================================================================
 * 4. DEVICE ORIENTATION
 * ============================================================================ */
@media (orientation: landscape) and (max-height: 500px) {
    .hero {
        min-height: auto !important;
        padding-top: 30px !important;
        padding-bottom: 30px !important;
    }

    .modal-dialog,
    .modal-box {
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
}

@media (orientation: portrait) {
    .hide-on-portrait { display: none !important; }
}

/* ============================================================================
 * 5. RETINA & HIGH-DPI DISPLAYS
 * ============================================================================ */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi),
       (min-resolution: 2dppx) {
    .logo-img,
    .accreditation-badge-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    .retina-border { border-width: 0.5px; }
}

/* ============================================================================
 * 6. ACCESSIBILITY & USER PREFERENCES
 * ============================================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .stat-counter { animation: none !important; }
}

@media (prefers-contrast: more) {
    .btn,
    .course-card,
    .catalog-search-input {
        border-width: 2px !important;
        border-color: #000000 !important;
    }

    .course-summary,
    .catalog-count-badge {
        color: #000000 !important;
        font-weight: 600 !important;
    }
}

/* ============================================================================
 * 7. PRINT STYLESHEET
 * ============================================================================ */
@media print {
    header,
    footer,
    .navbar,
    .catalog-search-form,
    .per-page-selector,
    .catalog-pagination-wrap,
    .pwa-bottom-bar,
    .modal-backdrop,
    .btn-view-outline,
    .btn-enroll-action,
    .adt-floating-enroll,
    .adt-fab,
    .adt-chat-widget {
        display: none !important;
    }

    body {
        background: #FFFFFF !important;
        color: #000000 !important;
        font-size: 11pt !important;
        line-height: 1.4 !important;
    }

    .adt-container {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .courses-grid {
        display: block !important;
    }

    .course-card {
        page-break-inside: avoid;
        margin-bottom: 24pt;
        border: 1pt solid #CCCCCC !important;
        box-shadow: none !important;
    }

    /* Only print URLs for external links — internal nav is noise */
    a[href^="http"]:not([href*="adeptelitesconsulting.com"])::after {
        content: " (" attr(href) ")";
        font-size: 8pt;
        color: #555555;
    }
}