/* Final mobile corrections for the JPBD frontend application. */

#root,
#root * {
    box-sizing: border-box;
}

#root img,
#root svg,
#root video,
#root canvas {
    max-width: 100%;
}

#root .header .header-icon .btn-icon,
#root .header .topbar-profile {
    padding: 0;
    border: 0;
}

#root .header .topbar-profile {
    display: block;
    line-height: 1;
}

#root .table-responsive,
#root .dataTables_wrapper,
#root .opportunity-table,
#root .application-table {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Keep procurement filters in the normal page flow instead of using a
   separate, narrow scroll area beside the results. */
#root .procurement-filters.filter-panel {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    scrollbar-width: none;
}

#root .procurement-filters.filter-panel::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* Match the Jobs card interaction and brand treatment. */
#root .procurement-list-card:hover,
#root .procurement-list-card.is-selected {
    border-color: #241907;
    color: #ffffff;
    background-color: #241907;
    box-shadow: 0 10px 30px rgba(36, 25, 7, 0.18);
}

#root .procurement-list-card:hover h3,
#root .procurement-list-card.is-selected h3,
#root .procurement-list-card:hover .procurement-organization,
#root .procurement-list-card.is-selected .procurement-organization,
#root .procurement-list-card:hover .procurement-card-meta strong,
#root .procurement-list-card.is-selected .procurement-card-meta strong,
#root .procurement-list-card:hover .procurement-card-value,
#root .procurement-list-card.is-selected .procurement-card-value,
#root .procurement-list-card:hover .procurement-term,
#root .procurement-list-card.is-selected .procurement-term {
    color: #ffffff;
}

#root .procurement-list-card:hover .procurement-posted,
#root .procurement-list-card.is-selected .procurement-posted,
#root .procurement-list-card:hover .procurement-card-meta span,
#root .procurement-list-card.is-selected .procurement-card-meta span {
    color: rgba(255, 255, 255, 0.68);
}

#root .procurement-list-card:hover .procurement-card-meta > div:first-child::after,
#root .procurement-list-card.is-selected .procurement-card-meta > div:first-child::after {
    background-color: rgba(255, 255, 255, 0.5);
}

#root .procurement-list-card:hover .procurement-term span,
#root .procurement-list-card.is-selected .procurement-term span {
    background-color: rgba(255, 255, 255, 0.7);
}

#root .procurement-list-card:hover .procurement-apply,
#root .procurement-list-card.is-selected .procurement-apply,
#root .procurement-list-card:hover .procurement-apply.is-applied,
#root .procurement-list-card.is-selected .procurement-apply.is-applied {
    border-color: #c88942;
    color: #ffffff;
    background-color: #c88942;
}

#root .procurement-list-card:hover .procurement-save,
#root .procurement-list-card.is-selected .procurement-save {
    border-color: rgba(255, 255, 255, 0.78);
    color: #241907;
    background-color: #ffffff;
}

/* Use the same action-row geometry as Job cards: a flexible primary action
   and one fixed circular save control with matching height. */
#root .procurement-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#root .procurement-card-actions .procurement-apply {
    width: auto !important;
    min-width: 0;
    flex: 1 1 auto;
}

#root .procurement-card-actions .procurement-save.is-compact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    min-width: 56px;
    height: 56px;
    flex: 0 0 56px;
    padding: 0;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
}

#root .procurement-card-actions .procurement-save.is-compact i {
    display: block;
    margin: 0;
    line-height: 1;
}

#root .procurement-list-card .procurement-save:hover,
#root .procurement-list-card:hover .procurement-save:hover,
#root .procurement-list-card.is-selected .procurement-save:hover {
    border-color: #c88942;
    color: #ffffff;
    background-color: #c88942;
}

@media (max-width: 991.98px) {
    #root .procurement-card-actions .procurement-save.is-compact {
        width: 42px;
        min-width: 42px;
        height: 42px;
        flex-basis: 42px;
        font-size: 18px;
    }
}

@media (max-width: 991.98px) {
    body.full-width-app,
    body.full-width-app #root {
        width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    #root .main-content {
        width: 100%;
        min-width: 0;
        height: auto;
        min-height: calc(100dvh - 70px);
        max-height: none;
        overflow: visible;
    }

    #root .header {
        width: 100%;
        min-width: 0;
    }

    #root .sidebar {
        width: min(300px, 86vw);
        max-width: 100%;
        height: 100dvh;
        padding-left: 18px;
        padding-right: 18px;
        overflow: hidden;
        background-color: var(--site-bg, #ebe9e4);
        box-shadow: 12px 0 30px rgba(36, 25, 7, 0.16);
        z-index: 10002 !important;
        isolation: isolate;
    }

    #root .sidebar .sidebar-menu-container {
        height: calc(100dvh - 82px);
        max-height: calc(100dvh - 82px);
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
    }

    #root .overlay-bg {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100dvh;
        background: rgba(36, 25, 7, 0.36);
        z-index: 10001 !important;
    }

    #root[data-sidebar="close"] .sidebar,
    #root [data-sidebar="close"] .sidebar {
        box-shadow: none;
    }

    #root .row > *,
    #root [class*="col-"] {
        min-width: 0;
    }

    /* Form labels must remain visible when the desktop columns stack. */
    #root .multiFormContainer .form-section .row > .d-lg-block.d-none {
        display: block !important;
        margin-bottom: 7px;
    }

    #root .multiFormContainer .form-section .row > .d-lg-block.d-none .form-label {
        margin: 0;
        color: var(--text-primary, #241907);
        font-size: 14px;
        font-weight: 600;
        line-height: 1.35;
    }

    #root .multiFormContainer .form-section .form-control,
    #root .multiFormContainer .form-section .form-select,
    #root .multiFormContainer .form-section .rich-text-editor {
        width: 100%;
        max-width: 100%;
    }

    #root .card,
    #root .bordered-card,
    #root .filter-panel,
    #root .details-panel {
        max-width: 100%;
    }

    #root .top-filter,
    #root .top-filter-wrapper,
    #root .top-filter-area {
        flex-wrap: wrap;
        height: auto;
    }

    #root .top-filter-item {
        min-width: 0;
    }

    /* Procurement list and detail panels become a single readable flow. */
    #root .procurement-page {
        position: relative;
        overflow: visible;
        z-index: 0;
    }

    #root .procurement-workspace,
    #root .procurement-columns {
        grid-template-columns: minmax(0, 1fr);
        min-width: 0;
    }

    #root .procurement-filters.filter-panel,
    #root .procurement-list {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    #root .procurement-filters.filter-panel {
        padding-right: 0;
    }

    #root .procurement-details-panel,
    #root .procurement-details-panel.procurement-empty {
        min-height: 0;
    }

    #root .procurement-search-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #root .procurement-search-button {
        grid-column: 1 / -1;
    }

    #root .procurement-multi-form,
    #root .procurement-two-step-page,
    #root .procurement-two-step-section {
        min-width: 0;
        max-width: 100%;
    }
}

@media (max-width: 767.98px) {
    #root .main-content {
        padding: 12px 10px 20px;
    }

    #root .page-title {
        font-size: clamp(21px, 7vw, 26px);
        line-height: 1.25;
    }

    #root .card-body,
    #root .bordered-card,
    #root .details-panel,
    #root .procurement-page > .card-body,
    #root .procurement-details-panel,
    #root .procurement-list-card {
        padding: 16px;
    }

    #root .header {
        padding-left: 10px;
        padding-right: 10px;
    }

    #root .header > div:first-child {
        min-width: 0;
        flex: 1 1 auto;
    }

    #root .header .page-title {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #root .header .notification-dropdown .dropdown-menu {
        position: fixed !important;
        top: 64px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto;
        max-width: none;
        max-height: calc(100dvh - 76px);
        overflow: hidden;
        transform: none !important;
        inset: 64px 10px auto 10px !important;
    }

    #root .header .notification-dropdown .notification-items {
        max-height: calc(100dvh - 190px);
        overscroll-behavior: contain;
    }

    #root .multiFormContainer {
        padding-top: 20px !important;
        padding-bottom: 20px !important;
    }

    #root .multiFormContainer .stepper {
        margin-bottom: 24px;
    }

    #root .multiFormContainer .stepper .circle {
        width: 40px;
        height: 40px;
        margin-bottom: 7px;
        font-size: 13px;
    }

    #root .multiFormContainer .stepper .line {
        top: 20px;
    }

    #root .multiFormContainer .stepper h6 {
        max-width: 110px;
        font-size: 12px;
        line-height: 1.3;
    }

    #root .multiFormContainer .form-section > h4 {
        margin-bottom: 24px !important;
        font-size: 20px;
    }

    #root .multiFormContainer .form-section > .d-flex.justify-content-end {
        flex-direction: column-reverse;
    }

    #root .multiFormContainer .form-section > .d-flex.justify-content-end .i-btn {
        width: 100%;
        min-height: 46px;
        justify-content: center;
    }

    #root .header .header-icon {
        gap: 8px;
    }

    #root .header .header-icon .topbar-search,
    #root .header .post-opportunity-btn {
        max-width: 100%;
    }

    #root .nav-tabs {
        display: flex;
        width: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    #root .nav-tabs .nav-item {
        width: auto;
        flex: 0 0 auto;
    }

    #root .nav-tabs .nav-link {
        white-space: nowrap;
    }

    #root .form-wrapper,
    #root .auth-wrapper,
    #root .auth-form,
    #root .modal-dialog,
    #root .modal-content {
        width: 100%;
        max-width: 100%;
    }

    #root .form-title {
        font-size: 24px;
        line-height: 1.2;
    }

    #root .form-inner,
    #root input,
    #root textarea,
    #root select,
    #root .nice-select,
    #root .select2-container {
        max-width: 100%;
    }

    #root input,
    #root textarea,
    #root select {
        font-size: 16px;
    }

    #root .otp-input {
        width: clamp(48px, 17vw, 64px) !important;
        height: clamp(48px, 17vw, 64px) !important;
    }

    #root .signup-role-selector,
    #root .procurement-search-bar,
    #root .procurement-list,
    #root .procurement-summary-grid,
    #root .procurement-form-row,
    #root .procurement-budget-fields,
    #root .procurement-term-fields,
    #root .procurement-contract-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    #root .procurement-search-button {
        grid-column: auto;
        width: 100%;
    }

    #root .procurement-results-toolbar,
    #root .procurement-toolbar-actions,
    #root .procurement-management-bar,
    #root .procurement-value-row,
    #root .procurement-notice {
        align-items: stretch;
        flex-direction: column;
    }

    #root .procurement-tabs {
        width: 100%;
        padding-bottom: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #root .procurement-tabs button,
    #root .procurement-range {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    #root .procurement-create-button,
    #root .procurement-toolbar-actions > *,
    #root .procurement-notice-action {
        width: 100%;
    }

    #root .procurement-details-heading {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 12px;
    }

    #root .procurement-details-heading > .procurement-save {
        grid-column: 1 / -1;
        width: 100%;
        border-radius: 999px;
    }

    #root .procurement-card-meta {
        flex-wrap: wrap;
        gap: 12px;
    }

    #root .procurement-card-meta > div {
        flex: 1 1 120px;
    }

    #root .procurement-management-bar > div,
    #root .procurement-notice-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    #root .procurement-management-bar button {
        justify-content: center;
        min-width: 0;
    }

    #root .procurement-review-modal {
        padding: 12px;
        overflow-y: auto;
    }

    #root .procurement-review-modal-card {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - 24px);
        padding: 24px 18px;
        overflow-y: auto;
    }

    #root .leaflet-container,
    #root .map-wrapper {
        width: 100%;
        min-height: 280px;
    }

    #root .chat-wrapper,
    #root .chat-container {
        max-width: 100%;
        min-width: 0;
    }

    #root .event-card-actions {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 479.98px) {
    #root .header .page-title {
        font-size: 18px;
    }

    #root .salary-fields {
        flex-direction: column !important;
        gap: 8px !important;
    }

    #root .salary-fields > *,
    #root .salary-fields .small-select,
    #root .salary-fields .form-control,
    #root .salary-fields .form-select {
        width: 100%;
        max-width: 100%;
        border-radius: 25px !important;
    }

    #root .procurement-details-heading {
        grid-template-columns: 1fr;
    }

    #root .procurement-title-icon {
        width: 48px;
        height: 48px;
    }

    #root .procurement-details-heading > .procurement-save {
        grid-column: auto;
    }

    #root .procurement-management-bar > div,
    #root .procurement-notice-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    #root .procurement-card-actions {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    #root .category-slider-wrapper {
        padding: 0 30px;
    }
}

@media (hover: none) and (pointer: coarse) {
    #root button,
    #root a,
    #root input,
    #root select,
    #root .form-check-input {
        touch-action: manipulation;
    }

    #root .event-card-actions {
        opacity: 1;
        transform: none;
    }

    #root .multiFormContainer input,
    #root .multiFormContainer select,
    #root .multiFormContainer .i-btn,
    #root .procurement-search-bar input,
    #root .procurement-search-bar select,
    #root .procurement-search-button,
    #root .procurement-filters .accordion-button {
        min-height: 44px;
    }
}
