/* ============================================================
   전체 도구 (/tools) — app/views/tools/all-tools.php
   시안 06-user-screens 04절. 토큰은 tools-common.css :root 를 쓴다.

   홈과 다른 점이 이 파일의 존재 이유다:
   홈은 설명형 카드(3열·설명 2줄), 여기는 **컴팩트 행 4열**.
   "전부를 훑는" 화면이라 한 행의 높이를 최대한 낮춘다.
   ============================================================ */

.at-header {
    display: flex;
    align-items: flex-end;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.at-header .tool-info {
    flex: 1 1 320px;
    min-width: 0;
}

/* ── 검색 ────────────────────────────────────────────────── */

.at-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 0 1 380px;
    min-width: 240px;
}

.at-search-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.at-search-icon {
    position: absolute;
    left: 12px;
    font-size: var(--text-xs);
    color: var(--text-muted);
    pointer-events: none;
}

.at-search-input {
    flex: 1 1 auto;
    min-width: 0;
    box-sizing: border-box;
    padding: 9px 12px 9px 32px;
    font-family: inherit;
    font-size: var(--text-sm);
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
}

.at-search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-focus);
}

.at-search-submit {
    flex: none;
    padding: 9px 16px;
    font-family: inherit;
    font-size: var(--text-ui-sm, 0.8125rem);
    font-weight: 600;
    color: #fff;
    background: var(--gradient-primary);
    border: 0;
    border-radius: var(--radius-md);
    cursor: pointer;
}

/* ── 카테고리 칩 = 점프 (필터 아님) ──────────────────────── */

.at-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin: var(--spacing-lg) 0 var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color-light);
}

.at-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: var(--text-ui-sm, 0.8125rem);
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-full);
    text-decoration: none;
}

.at-chip:hover {
    border-color: var(--accent-primary);
    color: var(--accent-text);
    text-decoration: none;
}

.at-chip-all {
    color: #fff;
    background: var(--gradient-primary);
    border-color: transparent;
}

.at-chip-all:hover { color: #fff; }

.at-chip-n {
    font-variant-numeric: tabular-nums;
    opacity: .7;
}

/* ── 카테고리 섹션 ───────────────────────────────────────── */

.at-cat {
    margin-bottom: var(--spacing-xl);
    /* 칩으로 점프했을 때 sticky 헤더에 제목이 가리지 않게 */
    scroll-margin-top: 76px;
}

.at-cat[hidden] { display: none; }

.at-cat-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin: 0 0 var(--spacing-sm);
    padding-bottom: 6px;
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color-light);
}

.at-cat-dot {
    width: 8px;
    height: 8px;
    flex: none;
    border-radius: 3px;
}

.at-cat-n {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ── 컴팩트 행 4열 ───────────────────────────────────────── */

.at-rows {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--spacing-xs);
    margin: 0;
    padding: 0;
    list-style: none;
}

.at-row[hidden] { display: none; }

.at-row-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    height: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}

.at-row-link:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.at-row-mark {
    flex: none;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    font-size: var(--text-xs);
    font-weight: 700;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

.at-row-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.at-row-name {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

/* 한 줄 설명 — 두 줄로 흐르면 "컴팩트 행"이 아니게 된다. */
.at-row-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── 배지 3종 (그 이상 만들지 마라) ──────────────────────── */

.at-badge {
    flex: none;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.at-badge-popular { color: var(--success-text); background: var(--success-soft); }
.at-badge-new     { color: var(--accent-text);  background: var(--accent-soft); }
.at-badge-login   { color: var(--accent-text);  background: var(--accent-soft); }

/* ── 빈 상태 ─────────────────────────────────────────────── */

.at-empty {
    padding: var(--spacing-xl) 0;
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.at-empty[hidden] { display: none; }

.at-empty-q::before { content: '\201C'; }
.at-empty-q::after  { content: '\201D'; }

/* ── 반응형 — 4 → 3 → 2 → 1 ─────────────────────────────── */

@media (max-width: 1280px) { .at-rows { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .at-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 576px) {
    .at-rows { grid-template-columns: minmax(0, 1fr); }
    .at-search { flex: 1 1 100%; }
}
