/* 영문·한글 모두 Pretendard (자체 서버 호스팅) */
@font-face {
    font-family: 'Pretendard Variable';
    font-weight: 45 920;
    font-style: normal;
    font-display: swap;
    src: url('fonts/PretendardVariable.woff2') format('woff2-variations');
}

:root {
    --color-primary: #d71920;
    --color-bg: #f4f5f7;
    --color-side: #1c1d21;
    --color-side-text: #9a9ca3;
    --color-border: #e2e4e8;
    --color-text: #26272b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Pretendard Variable', 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    font-weight: 400; /* 영문·한글 모두 Pretendard */
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ---------- 로그인 ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-side);
}
.login-box {
    width: 360px;
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
}
.login-box .logo { height: 28px; margin-bottom: 6px; }
.login-box h1 { font-size: 18px; margin: 0 0 24px; }
.login-box label { display: block; font-weight: 600; margin: 14px 0 6px; }
.login-box .btn { width: 100%; margin-top: 22px; }

/* ---------- 레이아웃 ---------- */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--color-side);
    color: var(--color-side-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar .brand {
    padding: 20px;
    border-bottom: 1px solid #2c2d33;
}
.sidebar .brand img { height: 22px; display: block; }
.sidebar .brand span {
    display: block; font-size: 11px; margin-top: 6px; letter-spacing: .08em;
}
.sidebar nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar nav a {
    display: block;
    padding: 11px 20px;
    font-size: 14px;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover { color: #fff; background: #26272d; }
.sidebar nav a.active {
    color: #fff;
    background: #26272d;
    border-left-color: var(--color-primary);
}
.sidebar nav a.sub {
    padding: 8px 20px 8px 36px;
    font-size: 13px;
    background: #17181c;
}
.sidebar nav a.sub.active {
    color: #fff;
    border-left-color: var(--color-primary);
}
.sidebar nav a .count {
    float: right;
    background: var(--color-primary);
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    padding: 0 7px;
    line-height: 18px;
    margin-top: 2px;
}
.sidebar .side-foot {
    padding: 16px 20px;
    border-top: 1px solid #2c2d33;
    font-size: 12px;
}
.sidebar .side-foot a { color: var(--color-side-text); }
.sidebar .side-foot a:hover { color: #fff; }

.main { flex: 1; min-width: 0; padding: 28px 32px 60px; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .actions { display: flex; gap: 8px; }

/* ---------- 공통 컴포넌트 ---------- */
.card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 22px;
    margin-bottom: 20px;
}
.card h2 {
    font-size: 15px;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.btn {
    display: inline-block;
    -webkit-appearance: none;
    appearance: none;          /* button 기본 렌더 제거 — a와 높이 통일 */
    margin: 0;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
    border-radius: 7px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.4;
    white-space: nowrap;       /* 버튼 글자가 줄바꿈되지 않게 */
    vertical-align: middle;
}
.btn:hover { background: #f6f6f8; }
.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.btn-primary:hover { background: #b8141a; }
.btn-danger { color: var(--color-primary); border-color: #f0c3c5; }
.btn-danger:hover { background: #fdf1f1; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 5px; }

/* 토글 스위치 (공개/비공개 등) */
.toggle-switch {
    display: inline-block;
    width: 46px;
    height: 24px;
    border-radius: 13px;
    background: #c8cad0;
    border: 0;
    padding: 0;
    position: relative;
    cursor: pointer;
    vertical-align: middle;
    transition: background .2s;
}
.toggle-switch.on { background: #1d7a43; }
.toggle-switch .knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.25);
    transition: transform .2s;
}
.toggle-switch.on .knob { transform: translateX(22px); }

/* 폼용 체크박스 토글 스위치 */
.switch-row { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.form-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.form-switch input { display: none; }
.form-switch .track {
    position: relative;
    width: 46px;
    height: 24px;
    border-radius: 13px;
    background: #c8cad0;
    flex-shrink: 0;
    transition: background .2s;
}
.form-switch .track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.25);
    transition: transform .2s;
}
.form-switch input:checked + .track { background: #1d7a43; }
.form-switch input:checked + .track::after { transform: translateX(22px); }

/* 폼 하단 액션 영역 (카드 바깥) */
.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 4px 0 40px;
}
.form-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;               /* 저장·취소 버튼 높이 동일 */
    box-sizing: border-box;
    padding: 0 30px;
    line-height: 1;
}
.form-actions .btn-primary { padding: 0 44px; } /* 저장 버튼만 가로로 넓게 */

input[type=text], input[type=password], input[type=email], input[type=url],
input[type=number], input[type=date], select, textarea {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--color-text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}
textarea { resize: vertical; min-height: 90px; }

.form-row { margin-bottom: 16px; }
.form-row > label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}
.form-row .hint { font-size: 12px; color: #8a8c93; margin-top: 4px; }
.form-row .req { color: var(--color-primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 20px; }
.form-check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.form-check input { width: auto; }

/* ---------- 테이블 ---------- */
.table-wrap { overflow-x: auto; }
table.list {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
table.list th, table.list td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: middle;
}
table.list th {
    font-size: 12px;
    color: #71737a;
    font-weight: 600;
    background: #fafafb;
    white-space: nowrap;
}
table.list tr:hover td { background: #fafbfc; }
table.list tr.row-link { cursor: pointer; }
table.list td.center, table.list th.center { text-align: center; }
table.list .thumb {
    width: 88px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 5px;
    display: block;
    background: #eee;
}

.badge {
    display: inline-block;
    border-radius: 11px;
    font-size: 11px;
    padding: 2px 9px;
    background: #eef0f3;
    color: #5a5c63;
    white-space: nowrap;
}
.badge-red { background: #fbe9ea; color: var(--color-primary); }
.badge-green { background: #e7f4ec; color: #1d7a43; }
.badge-dark { background: #26272d; color: #fff; }

.pagination { margin-top: 18px; display: flex; gap: 6px; justify-content: center; }
.pagination a {
    min-width: 30px;
    text-align: center;
    padding: 5px 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
}
.pagination a.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* ---------- 알림 ---------- */
.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-weight: 600;
}
.flash-success { background: #e7f4ec; color: #1d7a43; }
.flash-error { background: #fbe9ea; color: var(--color-primary); }

/* ---------- 대시보드 ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.stat-box {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 18px 20px;
}
.stat-box .label { font-size: 13px; color: #71737a; }
.stat-box .num { font-size: 28px; font-weight: 800; margin-top: 2px; }
.stat-box .num small { font-size: 13px; font-weight: 400; color: #8a8c93; }

/* ---------- 정렬/인라인 리스트 ---------- */
.sort-form { display: flex; gap: 8px; align-items: center; }
.inline-form { display: inline; }
.muted { color: #8a8c93; font-size: 12px; }
.preview-img { max-width: 320px; border-radius: 8px; display: block; margin-top: 8px; }
.file-now { font-size: 12px; color: #5a5c63; margin-top: 5px; }

/* 태그 칩 입력 */
.tag-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    padding: 6px 8px;
    background: #fff;
    cursor: text;
}
.tag-input:focus-within { border-color: var(--color-primary); }
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: #f1f2f5;
    border: 1px solid #e4e6ea;
    border-radius: 14px;
    padding: 3px 6px 3px 12px;
    font-size: 13px;
    white-space: nowrap;
}
.tag-chip .tag-x {
    border: 0;
    background: none;
    cursor: pointer;
    color: #8a8c93;
    font-size: 15px;
    line-height: 1;
    padding: 0 4px;
    font-family: inherit;
}
.tag-chip .tag-x:hover { color: var(--color-primary); }
.tag-input .tag-entry {
    border: 0;
    outline: none;
    flex: 1;
    min-width: 140px;
    padding: 4px;
    font-family: inherit;
    font-size: 14px;
    background: transparent;
}

/* 태그 추천 (기존 태그) */
.tag-suggestions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.tag-suggestions .tag-sug-label { font-size: 12px; color: #8a8c93; margin-right: 2px; }
.tag-suggestions .tag-suggest {
    border: 1px dashed #c7c9d0;
    background: #fff;
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 13px;
    color: #5a5c63;
    cursor: pointer;
    font-family: inherit;
    transition: all .12s;
}
.tag-suggestions .tag-suggest:hover { border-style: solid; border-color: var(--color-primary); color: var(--color-primary); }
.tag-suggestions .tag-suggest::before { content: '+ '; opacity: .6; }

/* Hero 타이틀 에디터 */
.hero-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.hero-toolbar input[type=color] {
    width: 44px;
    height: 30px;
    padding: 2px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
}
.hero-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.hero-title-edit {
    flex: 1;
    border: 1px solid #3a3c42;
    border-radius: 7px;
    padding: 10px 14px;
    /* 프론트 Hero(영상 위 흰 글씨) 환경과 동일하게 — 흰색 글자도 보이도록 진한 배경 */
    background: #2b2d31;
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .01em;
    min-height: 26px;
    outline: none;
}
.hero-title-edit:focus { border-color: var(--color-primary); }
.hero-title-edit:empty::before { content: 'BEYOND SCREEN, INTO EXPERIENCE.'; color: rgba(255,255,255,.4); font-weight: 300; }
.hero-subtitle-edit { font-size: 15px; font-weight: 400; }
.hero-subtitle-edit:empty::before { content: '라온스퀘어는 콘텐츠와 인터랙티브 기술로 공간의 경험을 새롭게 설계합니다'; color: rgba(255,255,255,.4); }

/* 드래그 정렬 */
.drag-handle {
    cursor: grab;
    user-select: none;
    color: #b4b6bd;
    font-size: 17px;
}
tr.dragging { opacity: .45; }
tr[draggable=true]:hover .drag-handle { color: var(--color-primary); }

/* 갤러리 관리 */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.gallery-item {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}
.gallery-item img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 5px;
    background: #eee;
}
.gallery-item .row { display: flex; gap: 6px; margin-top: 8px; }
.gallery-item .row input[type=text] { min-width: 0; } /* 캡션칸이 줄어들어 저장 버튼을 밀지 않게 */
.gallery-item .row .btn { flex-shrink: 0; }

/* 섹션 에디터 */
.section-block {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 14px;
    background: #fafafb;
}
.section-block .sec-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 700;
}

/* ---------- 조회 통계 차트 ----------
/* ---------- 조회 통계 차트 ----------
   외부 라이브러리 없이 SVG/CSS로 그린다. 단일 계열이라 색은 브랜드 레드 하나뿐이고
   (범례 없이 제목이 계열을 지시), 그리드·축은 표면에서 한 단계만 떨어진 회색으로 물러난다.

   SVG는 선과 영역만 그리고 축 라벨·끝점·크로스헤어는 HTML로 얹는다.
   가로 100%로 늘려도 글자가 함께 확대되지 않게 하기 위한 구조다. */
.chart { position: relative; padding-left: 46px; }
.chart-plot { position: relative; height: 200px; }

.chart-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}
.chart-area { fill: var(--color-primary); fill-opacity: .1; stroke: none; }  /* 옅은 워시 */
.chart-line {
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;   /* 가로로 늘어나도 굵기 유지 */
}

/* 그리드 — 실선 hairline, 표면에서 한 단계 떨어진 회색 */
.chart-grid {
    position: absolute;
    left: 0; right: 0;
    height: 0;
    border-top: 1px solid var(--color-border);
}
/* 끝점만 강조 — 2px 표면 링으로 선과 겹쳐도 읽힌다 */
.chart-dot {
    position: absolute;
    width: 9px; height: 9px;
    margin: 0 0 -4.5px -4.5px;
    border-radius: 50%;
    background: var(--color-primary);
    box-shadow: 0 0 0 2px #fff;
}
.chart-cross {
    position: absolute;
    top: 0; bottom: 0;
    width: 1px;
    margin-left: -0.5px;
    background: #b9bbc2;
    pointer-events: none;
}

/* 축 라벨 — SVG 밖 HTML이므로 폭과 무관하게 항상 같은 크기 */
.chart-y {
    position: absolute;
    left: 0; top: 0;
    width: 40px; height: 200px;
}
.chart-y span {
    position: absolute;
    right: 0;
    transform: translateY(50%);
    font-size: 11px;
    color: #8b8d94;
    font-variant-numeric: tabular-nums;
}
.chart-x { position: relative; height: 24px; margin-top: 6px; }
.chart-x span {
    position: absolute;
    transform: translateX(-50%);
    font-size: 11px;
    color: #8b8d94;
    white-space: nowrap;
}

/* 툴팁 — 값이 먼저, 라벨은 보조 */
.chart-tip {
    position: absolute;
    top: -4px;
    transform: translateX(-50%);
    background: #26272b;
    color: #fff;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.chart-tip .tip-value { font-weight: 700; font-size: 13px; }
.chart-tip .tip-label { color: #b9bbc2; }

/* 가로 막대 — 순위와 무관하게 한 가지 색 (막대 길이가 이미 크기를 나타낸다) */
.bar-chart { display: flex; flex-direction: column; gap: 2px; }  /* 2px 표면 간격 */
.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 6px;
    border-radius: 6px;
    outline: none;
}
.bar-row:hover, .bar-row:focus-visible { background: #f6f7f9; }
.bar-rank {
    width: 20px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #8b8d94;
    flex: 0 0 auto;
}
.bar-name {
    width: 240px;
    flex: 0 0 auto;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bar-track { flex: 1; min-width: 0; }
.bar-fill {
    height: 14px;                        /* 24px 상한보다 얇게 */
    background: var(--color-primary);
    border-radius: 0 4px 4px 0;          /* 데이터 끝만 둥글게, 기준선 쪽은 각지게 */
}
.bar-value {
    width: 56px;
    flex: 0 0 auto;
    text-align: right;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.num-cell { font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
    .bar-name { width: 120px; }
    .bar-value { width: 44px; }
}

/* 기술 분류 다중 선택 */
.tech-picker { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 4px 0; }
.tech-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.tech-item input { width: auto; margin: 0; }

/* 라디오 선택지 한 줄 배치 (Hero 영상 소스 등) */
.radio-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 22px;
    font-size: 14px;
    cursor: pointer;
}
.radio-inline input { width: auto; margin: 0; }
