/* =====================================================================
   Trang "Tìm mua công nghệ" (Nhucaucongnghe/CateTechNeeds)
   Toàn bộ CSS scope trong .tech-request-page — không ảnh hưởng trang khác.
   ===================================================================== */
.tech-request-page {
    --tech-primary: #008BCB;
    --tech-primary-dark: #0073A8;
    --tech-navy: #004A73;
    --tech-text: #063B60;
    --tech-muted: #5F7483;
    --tech-border: #D5E5ED;
    --tech-bg-soft: #F4F9FC;
    --tech-white: #ffffff;

    background: var(--tech-bg-soft);
    color: var(--tech-text);
    padding-bottom: 48px;
}

.tech-request-page * { box-sizing: border-box; }

.tech-page-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============ HERO ============ */
.tech-search-hero {
    position: relative;
    background:
        radial-gradient(120% 140% at 85% 20%, rgba(0,139,203,.18) 0%, rgba(0,139,203,0) 55%),
        linear-gradient(120deg, #eaf6f7 0%, #F4F9FC 45%, #eef4fa 100%);
    border-bottom: 1px solid var(--tech-border);
    overflow: hidden;
}
.tech-search-hero::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 40px;
    background: radial-gradient(60% 100% at 50% 0%, rgba(0,139,203,.10), transparent 70%);
    pointer-events: none;
}
.tech-request-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--tech-muted);
    padding: 16px 0 0;
}
.tech-request-breadcrumb a { color: var(--tech-primary-dark); text-decoration: none; }
.tech-request-breadcrumb a:hover { text-decoration: underline; }
.tech-request-breadcrumb span { color: var(--tech-border); }
.tech-request-breadcrumb strong { color: var(--tech-navy); font-weight: 600; }

.tech-search-hero__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 170px;
    padding: 20px 0 30px;
}
.tech-search-hero__title {
    font-size: 30px;
    line-height: 1.25;
    font-weight: 700;
    color: var(--tech-navy);
    margin: 0 0 12px;
    max-width: 620px;
}
.tech-search-hero__subtitle {
    font-size: 15px;
    color: var(--tech-muted);
    margin: 0;
    max-width: 540px;
}
.tech-search-hero__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #FFFFFF;
    color: #006C9D;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 20px;
    border: 1.5px solid #008BCB;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,74,115,.08);
    transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.tech-search-hero__cta:hover {
    background: #EAF7FC;
    color: #00577E;
    border-color: #0073A8;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(0,115,168,.14);
}

/* ============ SEARCH / FILTER PANEL ============ */
.tech-search-section { margin-top: -28px; position: relative; z-index: 2; }
.tech-filter-panel {
    background: var(--tech-white);
    border: 1px solid var(--tech-border);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(8,59,103,.08);
    padding: 20px 22px;
}
.tech-filter-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
    flex-wrap: wrap;
}
.tech-filter-field { flex: 7 1 0%; min-width: 0; position: relative; display: flex; align-items: center; }
.tech-filter-field .bi { position: absolute; left: 14px; color: var(--tech-muted); font-size: 15px; pointer-events: none; }
.tech-filter-input,
.tech-filter-select {
    width: 100%;
    height: 46px;
    border: 1px solid var(--tech-border);
    border-radius: 10px;
    padding: 0 14px 0 40px;
    font-size: 14px;
    color: var(--tech-text);
    background: #fff;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.tech-filter-select { width: 100%; padding-left: 14px; appearance: auto; }
.tech-filter-field--select { flex: 3 1 0%; min-width: 0; }
.tech-filter-input:focus,
.tech-filter-select:focus {
    border-color: var(--tech-primary);
    box-shadow: 0 0 0 3px rgba(0,139,203,.15);
}
.tech-filter-submit {
    height: 46px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #008BCB;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 0 22px;
    border: 1px solid #008BCB;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,139,203,.18);
    transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.tech-filter-submit:hover {
    background: #0073A8;
    border-color: #0073A8;
    box-shadow: 0 6px 16px rgba(0,115,168,.22);
    transform: translateY(-1px);
}

/* Select2 (lĩnh vực) — căn cho khớp chiều cao/bo góc với ô input, scope riêng trang này */
.tech-request-page .select2-container { width: 100% !important; }
.tech-request-page .select2-container--bootstrap-5 .select2-selection {
    height: 46px;
    border: 1px solid var(--tech-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    padding: 0 12px;
}
.tech-request-page .select2-container--bootstrap-5 .select2-selection__rendered {
    padding: 0;
    color: var(--tech-text);
    font-size: 14px;
}
.tech-request-page .select2-container--bootstrap-5.select2-container--focus .select2-selection,
.tech-request-page .select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--tech-primary);
    box-shadow: 0 0 0 3px rgba(0,139,203,.15);
}

.tech-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tech-chips__label { font-size: 13px; color: var(--tech-muted); font-weight: 600; }
.tech-chip {
    font-size: 13px;
    color: #31566A;
    background: #F4F9FC;
    border: 1px solid #D5E5ED;
    border-radius: 999px;
    padding: 5px 12px;
    text-decoration: none;
    transition: all .2s ease;
}
.tech-chip:hover { background: #E4F4FA; color: #006C9D; border-color: #8BCBE3; }
.tech-chip.active { background: #DDF2FA; color: #005F8A; border-color: #008BCB; }

/* ============ RESULTS TOOLBAR ============ */
.tech-results-section { margin-top: 26px; }
.tech-results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.tech-results-count { font-size: 15px; color: var(--tech-text); }
.tech-results-count strong { color: var(--tech-primary-dark); }
.tech-results-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--tech-muted); }
.tech-results-sort select {
    height: 38px;
    border: 1px solid var(--tech-border);
    border-radius: 8px;
    padding: 0 10px;
    font-size: 14px;
    color: var(--tech-text);
    background: #fff;
}

/* ============ CARD GRID ============ */
.tech-request-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}
.tech-request-card {
    display: flex;
    flex-direction: column;
    background: var(--tech-white);
    border: 1px solid var(--tech-border);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.tech-request-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(8,59,103,.10);
    border-color: rgba(0,139,203,.45);
}
.tech-request-card__media { position: relative; aspect-ratio: 16 / 9; background: #eef2f5; overflow: hidden; }
.tech-request-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tech-request-card__badge {
    position: absolute;
    top: 10px; left: 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--tech-primary-dark);
    background: rgba(255,255,255,.94);
    border: 1px solid var(--tech-border);
    border-radius: 6px;
    padding: 4px 9px;
}
.tech-request-card__body { display: flex; flex-direction: column; flex: 1; padding: 14px 15px 15px; }
.tech-request-card__title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--tech-text);
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tech-request-card:hover .tech-request-card__title { color: var(--tech-primary-dark); }
.tech-request-card__desc {
    font-size: 14px;
    color: var(--tech-muted);
    line-height: 1.5;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tech-request-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 12.5px;
    color: var(--tech-muted);
    margin-top: auto;
    padding-top: 10px;
}
.tech-request-card__meta span { display: inline-flex; align-items: center; gap: 5px; }
.tech-request-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--tech-border);
    margin-top: 12px;
    padding-top: 11px;
}
.tech-request-card__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--tech-primary);
    text-decoration: none;
    transition: gap .2s ease, color .2s ease;
}
.tech-request-card__link:hover { gap: 10px; color: var(--tech-primary-dark); }

.tech-request-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--tech-muted);
    background: #fff;
    border: 1px dashed var(--tech-border);
    border-radius: 12px;
    padding: 48px 20px;
}
.tech-request-empty .bi { font-size: 32px; display: block; margin-bottom: 10px; opacity: .5; }

/* ============ PAGINATION ============ */
.tech-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 30px;
    flex-wrap: wrap;
}
.tech-pagination a,
.tech-pagination span {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--tech-border);
    border-radius: 9px;
    background: #fff;
    color: var(--tech-text);
    font-size: 14px;
    text-decoration: none;
    transition: all .2s ease;
}
.tech-pagination a:hover { border-color: var(--tech-primary); color: var(--tech-primary-dark); }
.tech-pagination .is-active { background: var(--tech-primary); border-color: var(--tech-primary); color: #fff; font-weight: 700; }
.tech-pagination .is-disabled { opacity: .45; pointer-events: none; }

/* ============ CTA CUỐI TRANG ============ */
.tech-request-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    background: linear-gradient(120deg, #e9f7f7 0%, #eef6fb 100%);
    border: 1px solid var(--tech-border);
    border-radius: 16px;
    padding: 24px 28px;
    margin-top: 34px;
}
.tech-request-cta__icon {
    font-size: 30px;
    color: var(--tech-primary);
    flex: 0 0 auto;
}
.tech-request-cta__text { flex: 1 1 320px; }
.tech-request-cta__text h2 { font-size: 19px; font-weight: 700; color: var(--tech-navy); margin: 0 0 4px; }
.tech-request-cta__text p { font-size: 14px; color: var(--tech-muted); margin: 0; }
.tech-request-cta__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #008BCB;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 22px;
    border: 1px solid #008BCB;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,139,203,.18);
    transition: background .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.tech-request-cta__btn:hover {
    background: #0073A8;
    border-color: #0073A8;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,115,168,.22);
}

/* ============ FORM GỬI NHU CẦU ============ */
.tech-request-form-section { margin-top: 34px; }
.tech-request-form-section .DangYCCNRegion {
    background: #fff;
    border: 1px solid var(--tech-border);
    border-radius: 16px;
    padding: 24px 26px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 992px) {
    .tech-request-grid { grid-template-columns: repeat(2, 1fr); }
    .tech-search-hero__title { font-size: 26px; }
}
@media (max-width: 768px) {
    .tech-search-hero__inner { flex-direction: column; align-items: flex-start; min-height: 0; padding: 26px 0; }
    .tech-search-hero__cta { width: 100%; justify-content: center; }
    .tech-filter-field, .tech-filter-field--select, .tech-filter-select, .tech-filter-submit { flex: 1 1 100%; }
    .tech-filter-submit { justify-content: center; }
    /* Mobile: bỏ overlap desktop, tách ô search khỏi nút "Đăng nhu cầu tìm mua" một chút */
    .tech-search-section { margin-top: 14px; }
}
@media (max-width: 576px) {
    .tech-request-grid { grid-template-columns: 1fr; }
    .tech-search-hero__title { font-size: 23px; }
    .tech-request-cta { flex-direction: column; align-items: flex-start; gap: 14px; }
    /* Cột: reset flex-basis để khối text không bị kéo cao 320px tạo khoảng trắng lớn */
    .tech-request-cta__text { flex: 0 0 auto; }
    .tech-request-cta__btn { width: 100%; justify-content: center; }
}

/* =====================================================================
   MODAL "Gửi nhu cầu tìm mua" — style CASTA (navy/teal), scope riêng
   ===================================================================== */
.tech-request-modal .modal-dialog {
    max-width: min(820px, calc(100vw - 32px));
    width: 100%;
}

.tech-request-modal {
    z-index: 2100;
}

body:has(.tech-request-modal.show) .modal-backdrop {
    z-index: 2090;
}

body:has(.tech-request-modal.show) .site-header-v2,
body:has(.tech-request-modal.show) .header-mobile {
    display: none !important;
}

.tech-request-modal .modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(8,59,103,.28);
}
.tech-request-modal .modal-dialog-scrollable .modal-body { max-height: calc(90vh - 96px); }

.tech-request-modal__header {
    align-items: flex-start;
    gap: 16px;
    background: #f6fbfc;
    border-bottom: 1px solid #D5E5ED;
    padding: 20px 24px;
}
.tech-request-modal__title { font-size: 20px; font-weight: 700; color: #004A73; margin: 0 0 4px; line-height: 1.3; }
.tech-request-modal__subtitle { font-size: 13.5px; color: #5F7483; margin: 0; max-width: 620px; line-height: 1.5; }
.tech-request-modal__body { padding: 22px 24px; }

/* ---- Form ---- */
.tech-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.tech-form-field { display: flex; flex-direction: column; gap: 6px; }
.tech-form-field--full { grid-column: 1 / -1; }
.tech-form-label { font-size: 13.5px; font-weight: 600; color: #063B60; }
.tech-form-label .req { color: #e11d48; }
.tech-form-input,
.tech-form-textarea {
    width: 100%;
    border: 1px solid #D5E5ED;
    border-radius: 9px;
    padding: 10px 12px;
    font-size: 14px;
    color: #063B60;
    background: #fff;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.tech-form-textarea { resize: vertical; min-height: 104px; }
.tech-form-input:focus,
.tech-form-textarea:focus { border-color: #008BCB; box-shadow: 0 0 0 3px rgba(0,139,203,.15); }

.tech-form-note { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: #5F7483; margin: 14px 0 0; }
.tech-form-note .bi { color: #008BCB; }

.tech-form-error {
    background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
    border-radius: 9px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 14px;
}

.tech-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.tech-form-btn-cancel {
    background: #fff; color: #063B60; border: 1px solid #D5E5ED;
    border-radius: 9px; padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
    transition: background .2s ease;
}
.tech-form-btn-cancel:hover { background: #f1f5f9; }
.tech-form-btn-submit {
    display: inline-flex; align-items: center; gap: 8px;
    background: #008BCB; color: #fff; border: none;
    border-radius: 9px; padding: 10px 22px; font-size: 14px; font-weight: 700; cursor: pointer;
    transition: background .2s ease, box-shadow .2s ease;
}
.tech-form-btn-submit:hover { background: #0073A8; box-shadow: 0 8px 20px rgba(0,139,203,.25); }
.tech-form-btn-submit:disabled { opacity: .7; cursor: not-allowed; }

/* ---- Math captcha (kiểu trang liên hệ): [câu hỏi] = ? [ô nhập kết quả] ---- */
.tech-form-captcha { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tech-form-captcha__q {
    display: inline-flex; align-items: center;
    font-size: 16px; font-weight: 700; color: #004A73; letter-spacing: .5px;
    background: #F4F9FC; border: 1px solid #D5E5ED; border-radius: 8px;
    padding: 8px 14px; white-space: nowrap; user-select: none;
}
.tech-form-captcha__input { flex: 0 1 160px; min-width: 90px; }

/* ---- Thông báo thành công ---- */
.tech-request-success { text-align: center; padding: 24px 12px 12px; }
.tech-request-success .bi { font-size: 46px; color: #008BCB; display: block; margin-bottom: 10px; }
.tech-request-success h3 { font-size: 19px; font-weight: 700; color: #004A73; margin: 0 0 8px; }
.tech-request-success p { font-size: 14px; color: #5F7483; margin: 0 auto 18px; max-width: 420px; line-height: 1.55; }

/* ---- Mobile: form 1 cột, nút full-width ---- */
@media (max-width: 576px) {
    .tech-form-grid { grid-template-columns: 1fr; }
    .tech-form-actions { flex-direction: column-reverse; }
    .tech-form-actions button { width: 100%; justify-content: center; }
    .tech-request-modal__body { padding: 18px 16px; }
    .tech-request-modal__header { padding: 16px 18px; }
}

@media (max-width: 576px) {
    .tech-request-page {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
        overflow-x: hidden;
    }

    .tech-page-container {
        width: 100%;
        padding-left: 12px;
        padding-right: 12px;
    }

    .tech-request-modal {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 2100;
        padding: 0 !important;
    }

    .tech-request-modal .modal-dialog {
        width: 100%;
        max-width: none;
        height: 100dvh;
        min-height: 100dvh;
        margin: 0;
    }

    .tech-request-modal .modal-content {
        min-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }

    .tech-request-modal .modal-dialog-scrollable .modal-content {
        max-height: 100dvh;
    }

    .tech-request-modal .modal-dialog-scrollable .modal-body {
        max-height: none;
        overflow-y: auto;
    }

    .tech-request-modal__header {
        position: sticky;
        top: 0;
        z-index: 2;
        padding: calc(12px + env(safe-area-inset-top)) 14px 10px;
        background: #f6fbfc;
    }

    .tech-request-modal__title {
        font-size: 17px;
        margin-bottom: 2px;
    }

    .tech-request-modal__subtitle {
        font-size: 12.5px;
        line-height: 1.35;
    }

    .tech-request-modal__body {
        padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
    }

    .tech-form-grid {
        gap: 10px;
    }

    .tech-form-field {
        gap: 4px;
    }

    .tech-form-label {
        font-size: 13px;
    }

    .tech-form-input {
        min-height: 42px;
        padding: 8px 12px;
        font-size: 14px;
    }

    .tech-form-textarea {
        min-height: 92px;
        padding: 9px 12px;
        font-size: 14px;
    }

    .tech-form-captcha {
        gap: 8px;
        flex-wrap: nowrap;
    }

    .tech-form-captcha__q {
        flex: 0 0 112px;
        justify-content: center;
        padding: 8px 10px;
    }

    .tech-form-captcha__input {
        flex: 1 1 auto;
        min-width: 0;
    }

    .tech-form-note {
        align-items: flex-start;
        margin-top: 10px;
        font-size: 12px;
        line-height: 1.35;
    }

    .tech-form-actions {
        position: sticky;
        bottom: 0;
        z-index: 1;
        flex-direction: column;
        gap: 8px;
        margin: 12px -14px calc(-14px - env(safe-area-inset-bottom));
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid #D5E5ED;
    }

    .tech-form-btn-cancel,
    .tech-form-btn-submit {
        min-height: 42px;
        padding: 9px 14px;
    }
}
