/* =========================================================
   코딩두잇 멘토 찾기 (WEB-INF/etc/mentoSearch.jsp)
   공통 헤더·하단·색상 변수는 resources/main/style.css를 그대로 사용
   좌우 끝선은 헤더(.header-inner) 여백과 같은 값으로 맞춤
   ========================================================= */
.mentor-page { --pl: 80px; --pr: 34px; --navy: #121a2f; background: linear-gradient(180deg, #f3f8fe 0, #fff 420px); padding-bottom: 80px; }
.mentor-page .wrap { padding-left: var(--pl); padding-right: var(--pr); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 제목·검색 ---------- */
.m-top { padding: 28px 0 30px; }
.crumb { display: flex; align-items: center; gap: 10px; font-size: 15px; color: #4b5563; }
.crumb a { display: grid; place-items: center; color: #1f2937; }
.crumb a:hover { color: var(--blue); }
.m-top h1 { margin-top: 26px; font-size: 38px; font-weight: 800; letter-spacing: -1.2px; color: var(--navy); }
.m-top p { margin-top: 10px; font-size: 17px; color: #4b5563; }
.m-search { display: flex; align-items: center; gap: 10px; max-width: 720px; margin-top: 22px; padding: 8px 8px 8px 18px; border: 1.5px solid #cfdcf0; border-radius: 16px; background: #fff; color: #8a94a6; transition: .15s; }
.m-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(17, 102, 240, .12); color: var(--blue); }
.m-search input { flex: 1; min-width: 0; height: 42px; border: 0; outline: 0; font-size: 16.5px; color: var(--ink); }
.m-search input::-webkit-search-cancel-button { cursor: pointer; }

/* 버튼 */
.m-btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px; border-radius: 12px; background: var(--blue); color: #fff; font-size: 15px; font-weight: 700; white-space: nowrap; transition: .15s; }
.m-btn:hover { background: var(--blue-d); }
.m-btn.ghost { background: #fff; border: 1px solid #cfd8e6; color: #374151; }
.m-btn.ghost:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- 레이아웃 ---------- */
.m-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }

/* 필터 */
.m-filter { position: sticky; top: 110px; max-height: calc(100vh - 130px); display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 4px 16px rgba(30, 70, 140, .06); }
.m-filter-head { display: flex; align-items: center; gap: 8px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.m-filter-head h2 { font-size: 17px; font-weight: 800; color: var(--navy); }
.m-reset { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--blue); }
.m-close { display: none; width: 36px; height: 36px; font-size: 26px; line-height: 1; color: #374151; }
.m-filter-body { overflow-y: auto; padding: 6px 20px 18px; overscroll-behavior: contain; }
.m-filter-foot { display: none; }
.m-group { border: 0; margin: 0; padding: 14px 0 4px; }
.m-group + .m-group { border-top: 1px dashed var(--line); }
.m-group legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-size: 14.5px; font-weight: 800; color: #1f2937; }
.m-group legend small { margin-left: 4px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.m-chips { clear: both; display: flex; flex-wrap: wrap; gap: 6px; }
.m-chips label { position: relative; cursor: pointer; }
.m-chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.m-chips span { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 12px; border: 1px solid #d5dbe4; border-radius: 999px; background: #fff; font-size: 14px; font-weight: 600; color: #374151; transition: .15s; }
.m-chips label:hover span { border-color: var(--blue); color: var(--blue); }
.m-chips input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.m-chips input:focus-visible + span { box-shadow: 0 0 0 3px rgba(17, 102, 240, .3); }

/* 결과 */
.m-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.m-count { font-size: 16px; font-weight: 700; color: var(--navy); }
.m-open { display: none; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 1px solid #d5dbe4; border-radius: 10px; background: #fff; font-size: 14.5px; font-weight: 600; color: #374151; }
.m-open b { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.m-picked { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.m-picked:empty { display: none; }
.m-tag { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 12px; border-radius: 999px; background: var(--blue-tint); color: var(--blue-ink); font-size: 13.5px; font-weight: 600; }
.m-tag::after { content: "×"; font-size: 16px; line-height: 1; }
.m-tag:hover { background: #d9e8ff; }

/* PC 한 줄 4명, 사진은 메인 멘토 카드(약 227x242)와 비슷한 크기 */
.m-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; max-width: 1000px; margin-top: 16px; }
.m-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 18px; background: #fff; overflow: hidden; box-shadow: 0 4px 14px rgba(30, 70, 140, .06); transition: .2s; }
.m-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(30, 70, 140, .12); }
.m-photo { display: block; aspect-ratio: 150 / 160; background: #eef3fa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b8c7de'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4.4 3.6-7 8-7s8 2.6 8 7z'/%3E%3C/svg%3E") center / 64px no-repeat; }
.m-photo { position: relative; overflow: hidden; }
/* 사진 여러 장: 넘김 버튼(.photo-nav/.photo-btn/.photo-count는 main/style.css)을 사진 칸에 맞춰 덮음 */
.m-photo-wrap { position: relative; }
.m-photo-wrap .photo-nav { inset: 0; aspect-ratio: auto; }
.m-photo-wrap .photo-btn { top: 50%; }
/* 사진 원본 비율과 상관없이 칸은 15:16 그대로 */
.m-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.m-body { display: flex; flex-direction: column; flex: 1; padding: 14px 14px 16px; }
.m-cate { align-self: flex-start; padding: 3px 9px; border-radius: 6px; background: var(--blue-tint); color: var(--blue); font-size: 13px; font-weight: 700; }
.m-card h3 { margin-top: 8px; font-size: 19px; font-weight: 800; letter-spacing: -.4px; color: var(--navy); }
.m-card h3 span { font-size: 14.5px; font-weight: 600; color: #6b7280; }
.m-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 13.5px; color: #4b5563; }
.m-meta b { margin-right: 4px; font-weight: 600; color: #9aa4b5; }
.m-info { margin-top: 10px; font-size: 14.5px; line-height: 1.6; color: #4b5563; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.m-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 14px; }
.m-pay { font-size: 16px; font-weight: 800; color: var(--navy); }
.m-review { font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.m-review:hover { color: var(--blue); }
.m-act { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.m-act .m-btn { flex: 1 0 auto; height: 42px; padding: 0 6px; font-size: 13px; }
.m-act .m-btn:not(.ghost) { border: 1px solid var(--blue); }
.m-act .m-btn:not(.ghost):hover { border-color: var(--blue-d); }
.m-mine { flex: 1 0 auto; display: grid; place-items: center; border-radius: 12px; background: #f3f4f6; font-size: 13.5px; color: var(--muted); }

/* 불러오는 중 */
.m-skel { pointer-events: none; }
.m-skel .m-photo { background: #eef3fa; }
.m-skel i { display: block; height: 14px; margin-top: 10px; border-radius: 6px; background: linear-gradient(90deg, #eef3fa 25%, #f7faff 50%, #eef3fa 75%); background-size: 200% 100%; animation: m-shine 1.2s infinite; }
.m-skel i:nth-child(1) { width: 40%; margin-top: 0; }
.m-skel i:nth-child(2) { width: 60%; height: 20px; }
.m-skel i:nth-child(4) { width: 80%; }
@keyframes m-shine { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .m-skel i { animation: none; } .m-card:hover { transform: none; } }

.m-empty { margin-top: 16px; padding: 48px 20px; border: 1px dashed #cfdcf0; border-radius: 18px; background: #fbfdff; text-align: center; }
.m-empty h3 { font-size: 19px; font-weight: 800; color: var(--navy); }
.m-empty p { margin-top: 8px; font-size: 15px; color: #4b5563; }
.m-empty-act { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.m-more-wrap { display: flex; justify-content: center; margin-top: 22px; }
.m-more { min-width: 220px; }
.m-more[hidden] { display: none; }
.m-ai { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; padding: 22px 24px; border-radius: 18px; background: linear-gradient(120deg, #eaf2ff, #f5f9ff); }
.m-ai strong { font-size: 17px; font-weight: 800; color: var(--navy); }
.m-ai p { margin-top: 4px; font-size: 14.5px; color: #4b5563; }
.m-dim { position: fixed; inset: 0; z-index: 60; background: rgba(17, 24, 39, .45); }

/* ---------- 반응형 ---------- */
@media (max-width: 1240px) { .mentor-page { --pl: 32px; --pr: 24px; } .m-layout { grid-template-columns: 270px minmax(0, 1fr); } }
@media (max-width: 1100px) { .mentor-page { --pl: 20px; --pr: 20px; } .m-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 760px; } }
@media (max-width: 960px) {
  .mentor-page { --pl: 16px; --pr: 16px; }
  .m-layout { grid-template-columns: minmax(0, 1fr); }
  .m-open { display: inline-flex; }
  /* 검색 조건은 화면 아래에서 올라오는 창으로 */
  .m-filter { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 70; max-height: 82vh; border-radius: 20px 20px 0 0; transform: translateY(105%); visibility: hidden; transition: transform .25s ease, visibility .25s; }
  .m-filter.open { transform: none; visibility: visible; }
  .m-close { display: block; }
  .m-filter-foot { display: block; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
  .m-filter-foot .m-btn { width: 100%; height: 50px; font-size: 16px; }
}
@media (max-width: 760px) {
  .mentor-page { padding-bottom: 48px; }
  .m-top { padding: 18px 0 20px; }
  .crumb { font-size: 13.5px; }
  .m-top h1 { margin-top: 16px; font-size: 26px; }
  .m-top p { font-size: 14.5px; }
  .m-search { padding-left: 14px; border-radius: 14px; }
  .m-search input { font-size: 16px; }
  .m-search .m-btn { height: 40px; padding: 0 14px; }
  .m-grid { gap: 12px; }
  .m-body { padding: 12px 12px 14px; }
  .m-card h3 { font-size: 17px; }
  .m-info { -webkit-line-clamp: 2; font-size: 13.5px; }
  .m-act { grid-template-columns: 1fr; }
  .m-act .m-btn.ghost { display: none; }
  .m-ai { flex-direction: column; align-items: stretch; padding: 18px; }
}
/* 휴대폰은 한 줄 2명 */
@media (max-width: 560px) {
  .m-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .m-body { padding: 10px 10px 12px; }
  .m-cate { font-size: 12px; }
  .m-card h3 { font-size: 16px; }
  .m-card h3 span { font-size: 13px; }
  .m-meta { font-size: 12.5px; }
  .m-info { font-size: 13px; }
  .m-pay { font-size: 14.5px; }
  .m-review { font-size: 12.5px; }
  .m-act .m-btn { height: 38px; font-size: 13.5px; }
}

/* 검색창 옆: 전체 멘토에게 문의 */
.m-search-row {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    gap: 12px;
    margin-top: 22px;
}

.m-search-row .m-search {
    flex: 0 1 720px;
    min-width: 0;
    max-width: 720px;
    margin-top: 0;
}

.m-btn.m-all-btn {
    height: auto;
    flex-shrink: 0;
    margin-left: 0; /* 기존 auto 제거 */
    padding: 0 22px;
    background: #fff;
    border: 1.5px solid var(--blue);
    color: var(--blue);
}

.m-btn.m-all-btn:hover {
    background: var(--blue);
    color: #fff;
}

@media (max-width: 760px) {
    .m-search-row {
        flex-direction: column;
        gap: 10px;
    }

    .m-search-row .m-search {
        flex: none;
        width: 100%;
        max-width: none;
    }

    .m-btn.m-all-btn {
        height: 46px;
        align-self: flex-end;
    }
}
