/*
 * TMA Business Opportunities
 * Mobile styles
 */

@media screen and (max-width: 767px) {
    body .tma-single-tender,
    body .tma-public-business-profile,
    body .tma-public-tender-list,
    body .tma-member-dashboard,
    body .tma-add-tender-form,
    body .tma-edit-tender-form {
        max-width: 100% !important;
        width: 100% !important;
    }

    .tma-single-tender,
    .tma-public-business-profile {
        padding-left: 16px;
        padding-right: 16px;
    }

    .tma-single-tender > div[style*="display:flex"],
    .tma-public-business-profile > div[style*="display:flex"],
    .tma-business-profile-layout,
    .tma-opportunity-detail-layout {
        display: block !important;
    }

    .tma-single-tender main,
    .tma-single-tender aside,
    .tma-public-business-profile main,
    .tma-public-business-profile aside,
    .tma-business-profile-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
    }

    .tma-single-tender aside,
    .tma-business-profile-sidebar {
        margin-top: 24px !important;
        padding: 18px !important;
    }

    .tma-single-tender h1,
    .tma-public-business-profile h1,
    .tma-member-dashboard h1,
    .tma-page-title-wrap h1 {
        font-size: 38px !important;
        line-height: 1.12 !important;
        word-break: normal;
        overflow-wrap: anywhere;
    }

    .tma-single-tender h2,
    .tma-public-business-profile h2,
    .tma-member-dashboard h2 {
        font-size: 28px !important;
        line-height: 1.2 !important;
    }

    .tma-member-navigation {
        margin-bottom: 22px !important;
    }

    .tma-member-navigation > div {
        display: block !important;
    }

    .tma-member-navigation .tma-member-nav-button {
        display: block !important;
        width: 100% !important;
        margin: 0 0 10px 0 !important;
        text-align: center;
    }

    .tma-member-navigation .tma-member-logout-link {
        display: block !important;
        margin-top: 8px !important;
        text-align: center;
    }

    .tma-member-navigation div[style*="margin-left:auto"] {
        margin-left: 0 !important;
        margin-top: 12px !important;
        display: block !important;
        width: 100% !important;
        text-align: center;
    }

    .tma-single-tender div[style*="display:flex"][style*="gap:12px"] {
        display: block !important;
    }

    .tma-single-tender div[style*="display:flex"][style*="gap:12px"] a {
        display: block !important;
        width: 100% !important;
        margin: 0 0 10px 0 !important;
        text-align: center;
    }

    .tma-public-tender-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .tma-public-tenders-table {
        min-width: 720px;
    }

    .tma-public-tender-list::after {
        content: "Swipe sideways to view more";
        display: block;
        font-size: 13px;
        color: #666;
        margin-top: 8px;
    }

    .tma-add-tender-form input,
    .tma-add-tender-form select,
    .tma-add-tender-form textarea,
    .tma-edit-tender-form input,
    .tma-edit-tender-form select,
    .tma-edit-tender-form textarea,
    .tma-business-profile-form input,
    .tma-business-profile-form select,
    .tma-business-profile-form textarea {
        width: 100% !important;
        max-width: 100% !important;
    }

    .tma-industry-categories-selector,
    .tma-swpm-industry-wrapper,
    .tma-swpm-industry-wrapper .tma-industry-categories-selector {
        max-width: 100% !important;
        width: 100% !important;
    }

    .tma-industry-categories-selector [style*="grid-template-columns"],
    .tma-swpm-industry-wrapper [style*="grid-template-columns"] {
        display: block !important;
    }

    .tma-industry-categories-selector label,
    .tma-swpm-industry-wrapper label {
        display: block;
        margin-bottom: 8px;
    }

    .tma-public-business-profile img,
    .tma-single-tender aside img,
    .tma-business-profile-sidebar img,
    .tma-business-profile-card img {
        max-width: 100% !important;
        max-height: 160px;
    }
}


/* Mobile opportunity listing: stacked cards rather than horizontal table */
@media screen and (max-width: 767px) {
    .tma-public-tender-list {
        overflow-x: visible !important;
        -webkit-overflow-scrolling: auto !important;
    }

    .tma-public-tender-list::after {
        content: none !important;
        display: none !important;
    }

    .tma-public-tenders-table,
    .tma-public-tenders-table thead,
    .tma-public-tenders-table tbody,
    .tma-public-tenders-table tr,
    .tma-public-tenders-table th,
    .tma-public-tenders-table td {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .tma-public-tenders-table {
        border-collapse: separate !important;
        border-spacing: 0 !important;
        min-width: 0 !important;
    }

    .tma-public-tenders-table thead {
        display: none !important;
    }

    .tma-public-tenders-table tr.tma-opportunity-list-row,
    .tma-public-tenders-table tbody tr {
        margin: 0 0 18px 0 !important;
        padding: 18px !important;
        border: 1px solid #e5e5e5 !important;
        border-radius: 10px !important;
        background: #fff !important;
    }

    .tma-public-tenders-table td {
        border-bottom: 0 !important;
        padding: 0 0 10px 0 !important;
        vertical-align: top !important;
    }

    .tma-public-tenders-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 13px;
        font-weight: 700;
        color: #8a4638;
        margin: 0 0 4px 0;
    }

    .tma-public-tenders-table td[data-label=""],
    .tma-public-tenders-table td[data-label="Logo"],
    .tma-public-tenders-table .tma-opportunity-logo-cell,
    .tma-public-tenders-table .tma-opportunity-type-cell {
        display: none !important;
    }

    .tma-public-tenders-table .tma-opportunity-title-cell {
        font-size: 24px !important;
        line-height: 1.25 !important;
        color: #444 !important;
    }

    .tma-public-tenders-table .tma-opportunity-title-cell::before {
        content: none !important;
    }

    .tma-public-tenders-table .tma-opportunity-end-date-cell,
    .tma-public-tenders-table .tma-opportunity-business-cell {
        font-size: 17px !important;
        line-height: 1.45 !important;
    }

    .tma-public-tenders-table .tma-opportunity-action-cell {
        padding-top: 8px !important;
        white-space: normal !important;
    }

    .tma-public-tenders-table .tma-opportunity-action-cell::before {
        content: none !important;
    }

    .tma-opportunity-view-button {
        display: inline-block !important;
        width: auto !important;
        min-width: 110px !important;
        max-width: 100% !important;
        padding: 10px 18px !important;
        white-space: nowrap !important;
        word-break: normal !important;
        overflow-wrap: normal !important;
        text-align: center !important;
    }

    /* Search/filter box */
    .tma-public-tender-list form,
    .tma-public-tender-list .tma-public-tender-filters,
    .tma-opportunity-filter-form {
        max-width: 100% !important;
    }

    .tma-public-tender-list input[type="search"],
    .tma-public-tender-list input[type="text"] {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Category selector mobile reset */
    .tma-industry-categories-selector,
    .tma-swpm-industry-wrapper,
    .tma-swpm-industry-wrapper .tma-industry-categories-selector {
        max-width: 100% !important;
        width: 100% !important;
        overflow: hidden !important;
    }

    .tma-industry-categories-selector * ,
    .tma-swpm-industry-wrapper * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .tma-industry-categories-selector [style*="grid-template-columns"],
    .tma-swpm-industry-wrapper [style*="grid-template-columns"],
    .tma-industry-categories-selector [style*="display:grid"],
    .tma-swpm-industry-wrapper [style*="display:grid"],
    .tma-industry-categories-selector [style*="display: grid"],
    .tma-swpm-industry-wrapper [style*="display: grid"] {
        display: block !important;
        grid-template-columns: none !important;
    }

    .tma-industry-categories-selector label,
    .tma-swpm-industry-wrapper label {
        display: flex !important;
        align-items: flex-start !important;
        gap: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 12px !important;
        margin: 0 0 10px 0 !important;
        overflow: hidden !important;
        white-space: normal !important;
        word-break: normal !important;
        overflow-wrap: anywhere !important;
        line-height: 1.35 !important;
    }

    .tma-industry-categories-selector input[type="checkbox"],
    .tma-swpm-industry-wrapper input[type="checkbox"] {
        flex: 0 0 auto !important;
        width: 22px !important;
        height: 22px !important;
        margin: 2px 0 0 0 !important;
    }

    .tma-industry-categories-selector button,
    .tma-swpm-industry-wrapper button {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
        max-width: none !important;
        margin-left: auto !important;
    }
}
