/*
 * 트렌드 분석 화면 공통 — 인기 순위 · 소비층 분석 · 키워드 분석 · 디자인 자가 진단
 * 수집한 값은 전부 상대지수라 절대 수치는 적지 않는다.
 * 그래프를 가리킬 때의 표시는 insight-chart.css 가 맡는다.
 * 폭과 좌우 여백은 사이트의 .inner 가, 화면 제목은 사이트의 .top-tit h2.title 이 맡는다.
 *
 * 사이트 공통 규칙에 맞춘다(css/ai-design.css 머리 주석과 같다): 누르는 요소는 모서리 5px, 상자·틀은 10px,
 * 상태 표시(배지·태그)만 알약형. 선택 상태는 메인색 테두리 + 연한 배경(#f3f6fa) + 메인색 글씨.
 * 회색은 #111 제목 / #333 본문 / #555 보조 / #767676 안내 / #999 흐린 값, 선은 #eaeaea·var(--gray) 만 쓴다.
 */

/* reset.css 의 `b, strong { font-weight: bolder }` 는 부모 기준 상대값이다.
   본문(300) 안에서는 400밖에 안 되고 제목(700) 안에서는 900이 된다. 고정값으로 못박는다. */
.trd-view-wrap strong { font-weight: 600; }

/* 줄바꿈 — 한글은 글자 사이가 아니라 띄어쓰기에서 끊는다("아디다스 스페지/알" 방지).
   띄어쓰기 없이 칸보다 긴 이름만 글자 단위로 끊는다. anywhere 는 표 칸 폭 계산까지 줄여 한 글자씩 세로로 서므로 쓰지 않는다 */
.trd-view-wrap { word-break: keep-all; overflow-wrap: break-word; }

/* ---------------------------------------------- 제목 아래 기준일·갱신 */
.ti-base { margin-top: 10px; color: #767676; font-size: 14px; line-height: 1.6; word-break: keep-all; }
.ti-badge { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 12px;
            font-size: 12px; font-weight: 600; vertical-align: 1px; white-space: nowrap; }
.ti-badge.ok { background: #f3f6fa; color: var(--main-color); }
.ti-badge.warn { background: #fdecea; color: #c73c32; }
.ti-badge.none { background: #f4f4f4; color: #767676; }

/* ---------------------------------------------- 조회 조건 — 사이트 조건 표(.table-st.type-2)와 같은 결 */
.ti-cond { border-top: 1px solid #111; background: #fff; }
.ti-cond-row { display: flex; border-bottom: 1px solid #eaeaea; }
.ti-cond-k { flex: none; display: flex; flex-wrap: wrap; align-content: center; gap: 2px 6px; width: 160px;
             padding: 14px 20px; background: #f4f4f4; color: #111; font-size: 15px; font-weight: 600; }
.ti-cond-k small { color: #999; font-size: 12px; font-weight: 400; }
/* 칸이 높은 줄(키워드 고르기)은 이름을 가운데가 아니라 첫 줄에 맞춘다 */
.ti-cond-k.is-top { align-content: flex-start; padding-top: 18px; }
.ti-cond-v { flex: 1; min-width: 0; padding: 14px 20px; }

/* 고르는 버튼. 누르면 새로 조회하는 링크다 */
.ti-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.ti-opts a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
             border: 1px solid var(--gray); border-radius: 5px; background: #fff; color: #333; font-size: 14px;
             transition: border-color .15s, background-color .15s; }
.ti-opts a:hover { border-color: var(--main-color); }
.ti-opts a.on { border-color: var(--main-color); background: #f3f6fa; color: var(--main-color); font-weight: 600; }
.ti-opts a:focus-visible { outline: 2px solid var(--main-color); outline-offset: 2px; }
.ti-opts .cnt { color: #999; font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }

/* 기간 — 정해 둔 기간 버튼 옆에 직접 고르는 칸. 직접 고른 기간을 보는 중이면 칸을 선택 상태로 칠한다 */
.ti-period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.ti-range { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ti-range input, .ti-range select { height: 36px; border: 1px solid var(--gray); border-radius: 5px;
                                    background-color: #fff; color: #333; font-size: 14px; }
.ti-range input { padding: 0 10px; }
/* 셀렉트는 reset.css 의 화살표 그림을 그대로 쓰고 여백만 줄인다 */
.ti-range select { padding: 0 32px 0 12px; background-position: right 12px center; }
.ti-range.on input, .ti-range.on select { border-color: var(--main-color); background-color: #f3f6fa;
                                          color: var(--main-color); font-weight: 600; }
.ti-range .sep { color: #767676; }
.ti-range button { min-height: 36px; padding: 0 16px; border-radius: 5px; background: var(--main-color); color: #fff;
                   font-size: 14px; font-weight: 600; }
.ti-range :focus:not(:focus-visible) { outline: none; }
.ti-range :focus-visible { outline: 2px solid var(--main-color); outline-offset: 2px; }

/* 키워드 분석의 고르기 — 유형·모델·브랜드·검색어 탭. 사이트 탭(.tab-mn-wrap)처럼 밑줄로 고른 것을 보인다 */
.ti-tabs { display: flex; flex-wrap: wrap; gap: 0 28px; border-bottom: 1px solid #eaeaea; }
.ti-tabs button { position: relative; padding: 4px 0 10px; border: 0; background: none; color: #555;
                  font-size: 15px; font-weight: 500; cursor: pointer; }
.ti-tabs button[aria-selected="true"] { color: var(--main-color); font-weight: 600; }
.ti-tabs button[aria-selected="true"]::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px;
                                               background: var(--main-color); content: ""; }
.ti-tabs button:focus:not(:focus-visible) { outline: none; }
.ti-tabs button:focus-visible { outline: 2px solid var(--main-color); outline-offset: 2px; }
.ti-pick-panel { margin-top: 14px; max-height: 260px; overflow-y: auto; }
.ti-pick-row { display: flex; gap: 12px; align-items: flex-start; }
.ti-pick-row + .ti-pick-row { margin-top: 8px; }
.ti-pick-row > .k { flex: none; width: 90px; padding-top: 8px; color: #555; font-size: 14px; font-weight: 600; }

/* ---------------------------------------------- 결과 — 상자 사이는 30px(AI 화면과 같다) */
.ti-body { margin-top: 40px; }
.ti-body > * + * { margin-top: 30px; }
.ti-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 30px;
           /* 늘리지 않는다. 칸 수가 다른 상자가 나란히 오면 짧은 쪽 아래가 통째로 빈다 */
           align-items: start; }
.ti-grid.three { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
/* 제목 옆 기준(.src)은 자리가 모자라면 제목 뒤에서 끊기지 않고 통째로 다음 줄로 내려간다 */
.ti-sec-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
                margin-bottom: 20px; color: #111; font-size: 20px; font-weight: 600; }
.ti-sec-title .src { color: #767676; font-size: 13px; font-weight: 400; }

/* 상자 — 사이트 .bd-box 와 같은 그림자 */
.ti-card { min-width: 0; padding: 30px; border-radius: 10px; background: #fff; box-shadow: 1px 1px 5px rgba(0, 0, 0, .1); }
.ti-card h3, .ti-card h4 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
                           margin-bottom: 16px; color: #111; font-size: 18px; font-weight: 600; }
.ti-card .src { color: #767676; font-size: 13px; font-weight: 400; }
.ti-card h3 > .tag { margin-left: 0; align-self: center; }
.ti-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 20px; }
.ti-card-head h3 { margin-bottom: 0; font-size: 20px; }

/* 표 — 위 굵은 선, 줄마다 옅은 선 */
.ti-table { width: 100%; border-collapse: collapse; border-top: 1px solid #111; color: #333; font-size: 14px; }
.ti-table th, .ti-table td { padding: 11px 8px; border-bottom: 1px solid #eaeaea; text-align: left; vertical-align: middle; }
.ti-table th { background: #f9f9f9; color: #111; font-weight: 600; }
.ti-table td.k { color: #767676; }
.ti-table tr.on td { background: #f3f6fa; font-weight: 600; }
.ti-table a { color: inherit; }
.ti-table tr[data-href] { cursor: pointer; }
.ti-table tr[data-href]:hover td { background: #f9f9f9; }
.ti-scroll { overflow-x: auto; }

/* 모델 사진·브랜드 로고(관리자 등록). 사진은 옛 크롤링 원본이라 비율이 제각각이어서 자르지 않고 contain 으로 넣는다 */
.ti-img { display: inline-block; flex: none; width: 36px; height: 36px; object-fit: contain; background: #fff;
          border: 1px solid #eaeaea; border-radius: 5px; vertical-align: middle; }
.ti-logo { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 36px; height: 36px;
           border: 1px solid #eaeaea; border-radius: 5px; background: #fff; overflow: hidden; vertical-align: middle; }
.ti-logo img { width: 100%; height: 100%; object-fit: contain; }
.ti-logo.initial { background: #f3f6fa; color: var(--main-color); font-weight: 700; font-size: 15px; }
.ti-with-img { display: inline-flex; align-items: center; gap: 8px; }

/* 확정 목업 기준. 상승 초록·하락 빨강이다(한국 증시 관례와 반대). ▲ 와 숫자는 한 덩어리라 가르지 않는다 */
.ti-up { color: #16a34a; font-weight: 600; white-space: nowrap; }
.ti-down { color: #dc2626; font-weight: 600; white-space: nowrap; }
.ti-flat { color: #999; }

/* 태그 — 상태 표시라 알약형 */
.tag { display: inline-block; margin-left: 4px; padding: 1px 8px; border: 1px solid #eaeaea; border-radius: 12px;
       background: #f9f9f9; color: #555; font-size: 12px; font-weight: 400; white-space: nowrap; }

.idx { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.idx .track { flex: 1; height: 8px; background: #f3f6fa; border-radius: 4px; overflow: hidden; }
.idx .fill { display: block; height: 100%; background: var(--main-color); }
.idx .num { width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.ti-style-table { min-width: 560px; }

/* 더 보기 — 사이트 흰 버튼(.btn-st.bd-line)과 같은 결 */
.ti-more { display: block; width: 100%; min-height: 44px; margin-top: 16px; border: 1px solid #eaeaea; border-radius: 5px;
           background: #fff; color: #333; font-size: 14px; cursor: pointer; }
.ti-more:hover { border-color: var(--main-color); color: var(--main-color); }
.ti-more:focus:not(:focus-visible) { outline: none; }
.ti-more:focus-visible { outline: 2px solid var(--main-color); outline-offset: 2px; }

/* 순위 목록 — 번호 + 이름 + 오른쪽 값 */
.ti-rank { margin: 0; padding: 0; border-top: 1px solid #111; list-style: none; color: #333; font-size: 14px; }
.ti-rank li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #eaeaea; }
.ti-rank .no { flex: none; width: 22px; color: var(--main-color); font-weight: 600; text-align: center;
               font-variant-numeric: tabular-nums; }
/* 이름이 길면 이름 칸 안에서만 줄을 바꾸고, 오른쪽 값은 한 줄로 오른쪽 끝에 붙여 둔다 */
.ti-rank li > a { flex: 1 1 auto; min-width: 0; }
.ti-rank .v { flex: none; margin-left: auto; padding-left: 8px; color: #555; font-variant-numeric: tabular-nums;
              white-space: nowrap; text-align: right; }
.ti-rank a { color: inherit; }
.ti-risers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 30px; }

.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.bar-row .label { width: 70px; color: #555; flex: none; }
.bar-row .track { flex: 1; background: #f3f6fa; border-radius: 4px; height: 14px; overflow: hidden; }
.bar-row .fill { display: block; background: var(--main-color); height: 100%; }
.bar-row .value { width: 62px; text-align: right; color: #555; flex: none; }

.spark-wrap { display: flex; gap: 6px; align-items: stretch; }
.spark-scale { flex: none; width: 24px; height: 190px; display: flex; flex-direction: column;
               justify-content: space-between; font-size: 10px; color: #999; text-align: right; }
/* 기준선. 아래에서부터 25% 간격이고 맨 위 선은 테두리로 준다 */
.spark { flex: 1; display: flex; align-items: flex-end; gap: 2px; height: 190px;
         box-sizing: border-box; border-top: 1px solid #eaeaea;
         background-image: repeating-linear-gradient(to top, #eaeaea 0 1px, transparent 1px 25%); }
.spark .col { flex: 1; background: #8994e5; border-radius: 2px 2px 0 0; min-height: 1px; }
.spark .col.last { background: var(--main-color); }
.spark-dates { display: flex; justify-content: space-between; font-size: 12px; color: #999; margin-top: 6px; }
.weeks { display: flex; gap: 8px; align-items: flex-end; }
.weeks .w { flex: 1; text-align: center; font-size: 12px; color: #767676; }
.weeks .w .b { background: #8994e5; border-radius: 3px 3px 0 0; margin: 0 auto 4px; width: 70%; }

.ti-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 18px 24px; }
.ti-summary > div { display: flex; flex-direction: column; gap: 4px; }
.ti-summary .k { color: #767676; font-size: 13px; }
.ti-summary .v { color: #111; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ti-summary .v small { color: #999; font-size: 13px; font-weight: 400; }

.ti-path { color: #767676; font-size: 13px; }
.ti-path a { color: var(--main-color); }

/* 빈 값 — 칸 안은 흐린 글씨 한 줄, 화면 전체가 비면 상자 하나 */
.ti-empty { padding: 10px 0; color: #999; font-size: 13px; }
.ti-nodata { margin-top: 40px; padding: 60px 20px; border-radius: 10px; background: #fff;
             box-shadow: 1px 1px 5px rgba(0, 0, 0, .1); color: #767676; font-size: 15px; text-align: center; }

/* 상자 아래 덧붙이는 한 줄(합산 안내·다른 화면 바로가기) */
.ti-foot { margin-top: 12px; color: #767676; font-size: 13px; }
.ti-foot a { color: var(--main-color); font-weight: 600; }

.ti-note { margin-top: 50px; padding-top: 24px; border-top: 1px solid #eaeaea; color: #767676; font-size: 13px; line-height: 1.8; }
.ti-note strong { color: #555; }
.ti-note > strong:first-child { color: #111; font-size: 15px; }
.ti-note a { color: var(--main-color); }

@media (max-width: 767px) {
    .ti-cond-k { width: 84px; padding: 12px; font-size: 14px; }
    .ti-cond-v { padding: 12px; }
    .ti-opts a { min-height: 34px; padding: 0 12px; }
    .ti-range input, .ti-range select { height: 34px; }
    .ti-range button { min-height: 34px; }
    .ti-tabs { gap: 0 20px; }
    .ti-pick-row { flex-direction: column; gap: 4px; }
    .ti-pick-row > .k { width: auto; padding-top: 0; }
    .ti-body, .ti-nodata { margin-top: 30px; }
    .ti-body > * + * { margin-top: 20px; }
    .ti-grid { gap: 20px; }
    .ti-card { padding: 20px 16px; }
    /* 이름을 단어 단위로만 끊으면 표의 최소 폭이 커진다. 칸 여백과 사진을 줄여 폰 폭 안에 넣고, 그래도 넘치면 .ti-scroll 이 가로로 민다 */
    .ti-table th, .ti-table td { padding: 10px 5px; }
    .ti-img, .ti-logo { width: 32px; height: 32px; }
    .ti-with-img { gap: 6px; }
    .ti-sec-title { font-size: 18px; }
}
