/*
 * ============================================================
 * mobile-responsive.css
 * Konnect System — Global Mobile & Tablet Responsiveness
 * Breakpoints:
 *   - Tablet : max-width: 768px
 *   - Mobile : max-width: 576px
 * ============================================================
 */

/* ─────────────────────────────────────────
   GLOBAL RESETS
───────────────────────────────────────── */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

/* ─────────────────────────────────────────
   🔴 CRITICAL: SCROLL & LAYOUT FIX
   Targets: iPad, iPhone 14 Pro Max, tablets
   Root cause: AdminLTE's `layout-fixed` body
   class sets overflow:hidden + fixed heights.
───────────────────────────────────────── */
@media (max-width: 1024px) {
    /*
      1. UNLOCK BODY SCROLL
         AdminLTE's hold-transition + layout-fixed
         body class forces overflow:hidden.
    */
    html,
    body {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100% !important;
    }

    /*
      2. UNLOCK CONTENT-WRAPPER
         AdminLTE layout-fixed makes the
         wrapper a fixed-height scroll slave.
    */
    .content-wrapper {
        overflow: visible !important;
        height: auto !important;
        min-height: unset !important;
        margin-left: 0 !important;
    }

    /*
      3. UNLOCK MAIN-FOOTER
    */
    .main-footer {
        position: static !important;
        margin-left: 0 !important;
    }

    /*
      4. UNLOCK NAVBAR HEIGHT LOCK
    */
    .main-header.navbar {
        position: sticky !important;
        top: 0;
        z-index: 1000;
    }

    /*
      5. HOME PAGE – RELEASE ONLY THE CENTER COLUMN.
         Only .scrollfunc (center job-post column) gets overflow:visible.
         #user.main-scroll-container (LEFT sticky panel) is intentionally
         left alone so it keeps its own scrollbar.
    */
    .scrollfunc {
        height: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
    }

    /*
      6. WRAPPER DIV CENTERING
    */
    .wrapper {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
}

/* ─────────────────────────────────────────
   LEFT SIDEBAR SCROLL — ALWAYS-ON
   The sticky left panel (#user) must remain
   scrollable on desktop AND tablet.
   This overrides any accidental overflow
   resets from the block above.
───────────────────────────────────────── */
#user.main-scroll-container {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin;
}

/* ─────────────────────────────────────────
   PARTNERED ORG → CAROUSEL SPACING
───────────────────────────────────────── */
/* Bottom spacing on the left sidebar column */
.col-12.col-md-3.mt-4 {
    padding-bottom: 28px;
}

/* Extra breathing room above the endorsed section */
.endorsed-section {
    margin-top: 20px;
}

/* ─────────────────────────────────────────
   NAVBAR / SIDEBAR FIXES
───────────────────────────────────────── */
/* Mobile/tablet: search li not absolutely positioned (desktop uses inline style on li) */
@media (max-width: 991.98px) {
    .main-header .nav-item-global-search {
        position: static !important;
        margin-left: 0 !important;
        left: auto !important;
    }
}

/* Extra-small: show search icon (Bootstrap d-none on li hides it; desktop sm+ unchanged) */
@media (max-width: 575.98px) {
    .main-header .nav-item-global-search {
        display: inline-block !important;
    }
}

@media (max-width: 768px) {
    /* Prevent sidebar from pushing content off-screen */
    .sidebar-mini.sidebar-open .content-wrapper,
    .sidebar-mini.sidebar-open .main-footer {
        margin-left: 0 !important;
    }

    /* Top bar: single row — no wrapping (icons + logo stay on one line) */
    .main-header.navbar {
        flex-wrap: nowrap !important;
        padding-left: 0.35rem !important;
        padding-right: 0.35rem !important;
    }

    .main-header .navbar-nav {
        flex-direction: row;
        flex-wrap: nowrap !important;
        align-items: center;
        flex-shrink: 0;
    }

    .main-header .navbar-nav .nav-item {
        flex-shrink: 0;
    }

    .main-header .nav-link {
        padding-left: 0.35rem !important;
        padding-right: 0.35rem !important;
    }

    /* Avatar in top-right navbar */
    .main-header .nav-item .nav-link img {
        width: 28px;
        height: 28px;
    }

    /* ── Logo / Brand fix ──────────────────
       The logo li uses d-none d-sm-inline-block
       which hides it below 576px.
       Force it visible on ALL mobile sizes. */
    .navbar-nav .nav-item:has(.brand-image) {
        display: inline-block !important;
    }

    /* Fallback for browsers without :has() support */
    .main-header .brand-image {
        display: inline-block !important;
        width: 100px !important;
        height: auto !important;
    }

    /* Ensure the parent li is not hidden */
    .main-header .navbar-nav > li:first-child {
        display: inline-flex !important;
        align-items: center !important;
    }

    /* Members Post (employer): ensure icon font renders solid in nav */
    .main-header .navbar-nav .nav-link[href*="members_post"] i.fa-solid {
        font-weight: 900 !important;
    }

    /* Navbar search expand icon (FA solid) */
    .main-header .nav-item-global-search .nav-link[data-widget="navbar-search"] i.fas {
        font-weight: 900 !important;
    }
}

/* On small mobile screens, swap the full PNG logo for the compact ICO icon */
@media (max-width: 576px) {
    .main-header .brand-image {
        /* CSS content swap — works on WebKit (iOS Safari, Android Chrome) */
        content: url('../images/Logo/Konnect2.ico');
        width: 32px !important;
        height: 32px !important;
    }
}

/* ─────────────────────────────────────────
   LOGIN / AUTH PAGES
───────────────────────────────────────── */
@media (max-width: 768px) {
    .login-image-side {
        display: none !important;
    }

    .login-form-side {
        width: 100% !important;
        min-height: 100vh;
        padding: 20px 16px;
    }

    .modern-card {
        max-width: 100% !important;
        padding: 1.75rem 1.25rem;
        border-radius: 16px;
    }

    .login-split {
        flex-direction: column !important;
        height: auto !important;
        min-height: unset !important;
    }

    .endorsed-track {
        gap: 18px;
    }
}

/* ─────────────────────────────────────────
   HOME PAGE — 3 COLUMN LAYOUT (MOBILE)
───────────────────────────────────────── */
@media (max-width: 768px) {
    .row.pl-3.pr-3 {
        flex-direction: column;
    }

    .main-scroll-container,
    .scrollfunc {
        height: auto !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
    }

    .col-12.col-md-3,
    .col-12.col-md-3.mt-4 {
        width: 100% !important;
        max-width: 100% !important;
    }

    .col-md-3.d-none.d-md-block {
        display: none !important;
    }

    .card.card-widget.widget-user-2.d-none.d-md-block.mt-3 {
        display: block !important;
        margin-top: 0 !important;
    }

    /* Members Only card: no d-none/d-md-block — ensure full width & spacing when sidebar stacks */
    .home-members-only-card {
        display: block !important;
        width: 100%;
    }
}

/* ─────────────────────────────────────────
   IPAD / TABLET — JOB POST COLUMN EXPAND
   Range: 577px – 1024px
───────────────────────────────────────── */
@media (min-width: 577px) and (max-width: 1024px) {
    .col-12.col-md-6.mt-4.main-scroll-container.scrollfunc {
        flex: 1 1 auto !important;
        max-width: calc(100% - 260px) !important;
        width: auto !important;
    }

    .col-12.col-md-3.mt-4 {
        flex: 0 0 240px !important;
        max-width: 240px !important;
        width: 240px !important;
    }

    .col-md-3.d-none.d-md-block {
        display: none !important;
    }
}

/* ─────────────────────────────────────────
   PROFILE PAGES (EMPLOYEE, EMPLOYER & ORG)
───────────────────────────────────────── */
@media (max-width: 768px) {
    /* Markup uses pl-5 only — kills horizontal centering on phones */
    .page-employer-profile .col-12.col-md-9,
    .page-employee-profile .col-12.col-md-9,
    .page-organization-profile .col-12.col-md-9 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .widget-user-header {
        flex-direction: column;
        text-align: center;
        padding-bottom: 10px;
    }

    /* Employee / other profiles — employer, employee & organization profile pages use modifiers below */
    .widget-user-image:not(.widget-user-image--employer):not(.widget-user-image--employer-follower):not(.widget-user-image--employee-hero):not(.widget-user-image--employee-aux):not(.widget-user-image--org-hero) {
        margin: 0 auto auto -45px !important;
    }

    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
        font-size: 0.82rem;
        padding: 8px 14px;
    }

    .card {
        width: 100% !important;
    }

    .follower-card,
    .following-card {
        flex-wrap: wrap;
    }

    .resume-file-card {
        flex-direction: column;
        align-items: flex-start !important;
    }
}

/* Employer / employee / organization profile — avatars (separate from generic rules) */
@media (max-width: 768px) {
    .page-employer-profile .widget-user-image--employer {
        /*margin: 0 auto 0 auto !important;*/
        margin-top: 10px !important;
        margin-left: 10px !important;
        margin-right: auto !important;
        left: 0 !important;
        text-align: center;
        display: block;
    }

    .page-employer-profile .widget-user-image--employer-follower {
        margin: 0 auto !important;
        margin-left: auto !important;
        margin-right: auto !important;
        left: auto !important;
        text-align: center;
        display: block;
    }

    .page-employee-profile .widget-user-image--employee-hero {
        margin-top: 10px !important;
        margin-left: 10px !important;
        margin-right: auto !important;
        left: 0 !important;
        text-align: center;
        display: block;
    }

    .page-employee-profile .widget-user-image--employee-aux {
        margin: 0 auto !important;
        margin-left: auto !important;
        margin-right: auto !important;
        left: auto !important;
        text-align: center;
        display: block;
    }

    .page-organization-profile .widget-user-image--org-hero {
        margin-top: 10px !important;
        margin-left: 10px !important;
        margin-right: auto !important;
        left: 0 !important;
        text-align: center;
        display: block;
    }
}

@media (max-width: 576px) {
    .page-employer-profile .widget-user-image--employer img {
        width: 96px !important;
        height: 96px !important;
        min-width: 96px !important;
        max-width: 96px !important;
        min-height: 96px !important;
        max-height: 96px !important;
    }

    .page-employer-profile .widget-user-image--employer-follower img {
        width: 60px !important;
        height: 60px !important;
        min-width: 60px !important;
        max-width: 60px !important;
        min-height: 60px !important;
        max-height: 60px !important;
    }

    .page-employee-profile .widget-user-image--employee-hero img {
        width: 96px !important;
        height: 96px !important;
        min-width: 96px !important;
        max-width: 96px !important;
        min-height: 96px !important;
        max-height: 96px !important;
    }

    .page-employee-profile .widget-user-image--employee-aux img {
        width: 60px !important;
        height: 60px !important;
        min-width: 60px !important;
        max-width: 60px !important;
        min-height: 60px !important;
        max-height: 60px !important;
    }

    .page-organization-profile .widget-user-image--org-hero img {
        width: 96px !important;
        height: 96px !important;
        min-width: 96px !important;
        max-width: 96px !important;
        min-height: 96px !important;
        max-height: 96px !important;
    }

    .widget-user-image:not(.widget-user-image--employer):not(.widget-user-image--employer-follower):not(.widget-user-image--employee-hero):not(.widget-user-image--employee-aux):not(.widget-user-image--org-hero) img {
        width: 70px !important;
        height: 70px !important;
    }

    .training-card .train-title {
        font-size: 0.9rem;
        padding-right: 50px;
    }

    .train-badge {
        font-size: 0.7rem;
    }
}

/* ─────────────────────────────────────────
   SEARCH RESULTS PAGE
───────────────────────────────────────── */
@media (max-width: 768px) {
    .search-result-card,
    .result-card {
        width: 100% !important;
    }

    .search-bar,
    .input-group.search {
        flex-wrap: wrap;
    }

    .search-bar .btn,
    .input-group.search .btn {
        width: 100%;
        margin-top: 8px;
        border-radius: 8px !important;
    }
}

/* ─────────────────────────────────────────
   MODALS — RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 10px !important;
    }

    .modal-content {
        border-radius: 12px !important;
    }

    .modal-body {
        max-height: 70vh;
        overflow-y: auto;
    }

    .modal-lg,
    .modal-xl {
        max-width: calc(100vw - 20px) !important;
    }

    .width-modals,
    .width-modals-edit {
        max-width: 100% !important;
        margin: 8px !important;
    }

    .modal-notif {
        max-width: 100% !important;
        margin: 8px !important;
    }

    #termsModal > div {
        margin: 10px !important;
        width: calc(100% - 20px) !important;
    }
}

/* ─────────────────────────────────────────
   TABLES — HORIZONTAL SCROLL
───────────────────────────────────────── */
@media (max-width: 768px) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    .card-body > table,
    .tab-content > .tab-pane > table {
        overflow-x: auto;
        display: block;
        width: 100%;
    }

    .table td,
    .table th {
        font-size: 13px !important;
        padding: 6px 8px !important;
    }
}

/* ─────────────────────────────────────────
   FORMS & BUTTONS
───────────────────────────────────────── */
@media (max-width: 576px) {
    .btn-block-mobile {
        display: block;
        width: 100%;
    }

    .input-group {
        flex-wrap: wrap;
    }

    .input-group .form-control {
        border-radius: 8px !important;
        margin-bottom: 6px;
    }

    .input-group-append,
    .input-group-prepend {
        width: 100%;
    }

    .input-group-append .btn,
    .input-group-prepend .btn {
        width: 100%;
        border-radius: 8px !important;
    }
}

/* ─────────────────────────────────────────
   NAVIGATION TABS
───────────────────────────────────────── */
@media (max-width: 576px) {
    .nav-tabs .nav-link {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .card-body {
        padding: 12px !important;
    }
}

/* ─────────────────────────────────────────
   GENERAL UTILITY
───────────────────────────────────────── */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    .d-none.d-md-block {
        display: none !important;
    }

    .mt-mobile-3 {
        margin-top: 1rem !important;
    }

    .text-truncate-mobile {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }
}

@media (max-width: 576px) {
    .content-wrapper {
        padding-bottom: 20px !important;
    }

    .footer-developed {
        font-size: 0.75rem !important;
    }
}
