/* IMAPATH frontend stability & consistency layer.
   Kept deliberately conservative so existing PHP/checkout/auth behaviour remains unchanged. */

:root {
    --ima-focus: rgba(65, 111, 203, .18);
    --ima-soft-border: #e2e8f0;
    --ima-soft-bg: #f8fafc;
}

html { scroll-behavior: smooth; }
body:not(.imapath-dashboard) { overflow-x: hidden; }
body:not(.imapath-dashboard) img { max-width: 100%; }
body:not(.imapath-dashboard) .container,
body:not(.imapath-dashboard) .container-fluid { min-width: 0; }
body:not(.imapath-dashboard) .row > * { min-width: 0; }

body:not(.imapath-dashboard) .card {
    border-color: var(--ima-soft-border);
}
body:not(.imapath-dashboard) .card-img-top,
body:not(.imapath-dashboard) .pathway-card-img,
body:not(.imapath-dashboard) .course-card img {
    object-fit: cover;
}

body:not(.imapath-dashboard) .form-control,
body:not(.imapath-dashboard) .form-select {
    min-height: 44px;
}
body:not(.imapath-dashboard) .form-control:focus,
body:not(.imapath-dashboard) .form-select:focus,
body:not(.imapath-dashboard) .btn:focus-visible,
body:not(.imapath-dashboard) a:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 .22rem var(--ima-focus) !important;
}

body:not(.imapath-dashboard) .search-form .form-control { min-width: 0 !important; }
body:not(.imapath-dashboard) .table-responsive {
    border: 1px solid var(--ima-soft-border);
    border-radius: 12px;
}

body:not(.imapath-dashboard) [data-ajax-region] {
    position: relative;
    transition: opacity .16s ease;
}
body:not(.imapath-dashboard) [data-ajax-region].is-ajax-loading {
    opacity: .58;
    pointer-events: none;
}
body:not(.imapath-dashboard) [data-ajax-region].is-ajax-loading::after {
    content: '';
    position: absolute;
    top: 18px;
    right: 18px;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(65,111,203,.2);
    border-top-color: #416fcb;
    border-radius: 50%;
    animation: imaAjaxSpin .7s linear infinite;
    z-index: 5;
}
@keyframes imaAjaxSpin { to { transform: rotate(360deg); } }

@media (max-width: 991.98px) {
    body:not(.imapath-dashboard) .navbar .container { padding-left: 18px !important; padding-right: 18px !important; }
    body:not(.imapath-dashboard) .navbar-collapse {
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
    body:not(.imapath-dashboard) .mega-dropdown .dropdown-menu,
    body:not(.imapath-dashboard) .mega-menu .dropdown-menu.mega-dropdown {
        max-width: 100vw !important;
        overflow-x: hidden;
    }
}

@media (max-width: 767.98px) {
    body:not(.imapath-dashboard) .search-form {
        flex-wrap: wrap;
        width: 100%;
    }
    body:not(.imapath-dashboard) .search-form .form-control {
        flex: 1 1 100%;
        width: 100%;
    }
    body:not(.imapath-dashboard) .search-form .btn,
    body:not(.imapath-dashboard) .search-form a.btn {
        flex: 1 1 auto;
    }
    body:not(.imapath-dashboard) .breadcrumb { overflow-wrap: anywhere; }
    body:not(.imapath-dashboard) .modal-dialog { margin: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    body:not(.imapath-dashboard) [data-ajax-region] { transition: none; }
}
