/* ===================================================================
   wonthe Admin — 통합 스타일시트
   관리자 전 페이지 공통. admin_header.php 에서 <link> 로 로드.
   디자인 방향: 심플 · 세련 · 가볍게 (밝은 배경 + 부드러운 음영)
   =================================================================== */

/* ── Pretendard 웹폰트 ─────────────────────────────────── */
@font-face {
    font-family: 'Pretendard'; font-weight: 400; font-style: normal; font-display: swap;
    src: url('/assets/fonts/Pretendard-Regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Pretendard'; font-weight: 500; font-style: normal; font-display: swap;
    src: url('/assets/fonts/Pretendard-Medium.woff2') format('woff2');
}
@font-face {
    font-family: 'Pretendard'; font-weight: 600; font-style: normal; font-display: swap;
    src: url('/assets/fonts/Pretendard-SemiBold.woff2') format('woff2');
}
@font-face {
    font-family: 'Pretendard'; font-weight: 700; font-style: normal; font-display: swap;
    src: url('/assets/fonts/Pretendard-Bold.woff2') format('woff2');
}

/* ── 리셋 & 토큰 ──────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --sidebar-w:    236px;
    --sidebar-bg:   #1d2c42;
    --sidebar-txt:  rgba(255,255,255,0.62);
    --sidebar-act:  #2563eb;
    --topbar-h:     56px;

    --bg:           #f6f7f9;
    --card-bg:      #ffffff;
    --border:       #eaecef;
    --border-soft:  #f0f2f5;
    --txt:          #1f2937;
    --txt-muted:    #6b7280;
    --txt-faint:    #9ca3af;

    --primary:      #2563eb;
    --primary-dark: #1d4ed8;
    --success:      #10b981;
    --danger:       #ef4444;
    --warning:      #f59e0b;

    --radius:       10px;
    --radius-sm:    7px;
    --shadow:       0 1px 2px rgba(16,24,40,0.04), 0 1px 3px rgba(16,24,40,0.05);
    --shadow-md:    0 2px 8px rgba(16,24,40,0.06);
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
    font-size: 14px;
    color: var(--txt);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.25s ease;
}

/* ── 사이드바 ─────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: width 0.25s ease;
}

.sidebar-toggle-wrap {
    display: flex;
    align-items: center;
    padding: 12px 16px;
}
.sidebar-toggle-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.32);
    letter-spacing: 0.08em;
    flex: 1;
}
.sidebar-toggle-btn {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border: none; border-radius: 6px;
    background: transparent;
    color: rgba(255,255,255,0.4);
    cursor: pointer; flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 18px 18px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-logo svg { width: 26px; height: 26px; stroke: #60a5fa; flex-shrink: 0; }
.sidebar-logo-text { display: flex; flex-direction: column; gap: 1px; }
.logo-title { font-size: 14px; font-weight: 700; color: #fff; white-space: nowrap; letter-spacing: -0.01em; }
.logo-sub   { font-size: 10px; color: rgba(255,255,255,0.4); letter-spacing: 0.06em; }

.sidebar-menu { list-style: none; padding: 10px 0; flex: 1; }
.sidebar-menu li { padding: 1px 10px; }
.sidebar-section {
    padding: 14px 22px 6px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
    color: rgba(255,255,255,0.30); text-transform: uppercase;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--sidebar-txt);
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar-link.active { background: var(--sidebar-act); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,0.35); }
.menu-icon { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.9; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.07); }
.sidebar-admin-info { display: flex; align-items: center; gap: 10px; }
.admin-avatar {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.14);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.admin-name { font-size: 13px; font-weight: 500; color: #fff; }
.admin-role { font-size: 11px; color: rgba(255,255,255,0.42); }

/* 사이드바 접힘 */
body.sidebar-collapsed .sidebar      { width: 0; overflow: hidden; }
body.sidebar-collapsed .main-wrapper { margin-left: 0; }

/* ── 상단바 ───────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: rgba(255,255,255,0.85);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-title { font-size: 15px; font-weight: 600; color: var(--txt); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--txt-muted);
    cursor: pointer; flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.topbar-menu-btn:hover { background: var(--bg); color: var(--txt); }
.topbar-logout {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px; color: var(--txt-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.topbar-logout:hover { background: var(--bg); color: var(--txt); border-color: #d8dce2; }

/* ── 콘텐츠 ───────────────────────────────────────────── */
.content { padding: 28px; flex: 1; }

/* ── 페이지 헤더 ──────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
}
.page-header-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.page-header-sub   { font-size: 13px; color: var(--txt-muted); margin-top: 3px; }

/* ── 카드 ─────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 20px; }
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body  { padding: 20px; }

/* ── 스탯 카드 ────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.18s, transform 0.18s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 21px; height: 21px; fill: none; }
.stat-icon.blue   { background: #eff6ff; } .stat-icon.blue svg   { stroke: #2563eb; }
.stat-icon.green  { background: #ecfdf5; } .stat-icon.green svg  { stroke: #10b981; }
.stat-icon.amber  { background: #fffbeb; } .stat-icon.amber svg  { stroke: #f59e0b; }
.stat-icon.purple { background: #f5f3ff; } .stat-icon.purple svg { stroke: #8b5cf6; }
.stat-value { font-size: 25px; font-weight: 700; line-height: 1; margin-bottom: 5px; letter-spacing: -0.02em; }
.stat-label { font-size: 12.5px; color: var(--txt-muted); }

/* ── 버튼 ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    white-space: nowrap;
    line-height: 1.2;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: #fff; color: var(--txt); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); border-color: #d8dce2; }
.btn-warn { background: #fefce8; border-color: #fde047; color: #a16207; font-weight: 700; }
.btn-warn:hover { background: #fef9c3; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.6} }

/* ── 테이블 ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 13px 18px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
    white-space: nowrap;
}
th:first-child, td:first-child { padding-left: 20px; }
th:last-child,  td:last-child  { padding-right: 20px; }
thead th {
    background: #fafbfc;
    font-weight: 600;
    color: var(--txt-muted);
    font-size: 12px;
    letter-spacing: 0.01em;
    border-bottom: 1px solid var(--border);
}
tbody td { color: var(--txt); }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }
td.muted { color: var(--txt-muted); }
td.faint { color: var(--txt-faint); font-size: 12px; }

/* ── 배지 ─────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}
.badge-blue  { background: #eff6ff; color: #2563eb; }
.badge-green { background: #ecfdf5; color: #16a34a; }
.badge-amber { background: #fffbeb; color: #d97706; }
.badge-red   { background: #fef2f2; color: #dc2626; }
.badge-gray  { background: #f3f4f6; color: #6b7280; }

/* ── 알림 ─────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; border-color: #bbf7d0; color: #15803d; }
.alert-error   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

/* ── 폼 ───────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--txt); }
.form-control {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--txt);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    font-family: inherit;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
textarea.form-control { resize: vertical; min-height: 90px; line-height: 1.6; }
.form-hint { font-size: 12px; color: var(--txt-muted); margin-top: 5px; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row > .form-group { flex: 1; min-width: 180px; }

/* ── 공용 유틸 ────────────────────────────────────────── */
.empty-state { padding: 40px 24px; text-align: center; color: var(--txt-faint); font-size: 13px; }
.u-flex      { display: flex; align-items: center; }
.u-gap-8     { gap: 8px; }
.u-mt-16     { margin-top: 16px; }
.u-mb-16     { margin-bottom: 16px; }
.u-mb-20     { margin-bottom: 20px; }

/* 페이지 헤더 우측 액션 묶음 */
.page-actions { display: flex; gap: 8px; align-items: center; }

/* ── 탭 / 필터 네비게이션 ─────────────────────────────── */
.tab-nav {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.tab-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 15px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: var(--txt-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.tab-link:hover { color: var(--txt); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count {
    background: #f1f3f5; color: var(--txt-muted);
    font-size: 10px; font-weight: 700;
    padding: 1px 6px; border-radius: 100px; line-height: 1.6;
}
.tab-count.hot { background: #fef2f2; color: #dc2626; }

/* 클릭 가능한 테이블 행 */
tbody tr.row-link { cursor: pointer; }

/* ── 반응형 ───────────────────────────────────────────── */
@media (max-width: 720px) {
    .content { padding: 18px 14px; }
    th, td { padding: 11px 12px; }
    th:first-child, td:first-child { padding-left: 14px; }
    th:last-child,  td:last-child  { padding-right: 14px; }
}
