/* css/admin.css */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.8/dist/web/static/pretendard.css");

:root {
    --primary-color: #3b82f6; --primary-hover: #2563eb;
    --danger-color: #ef4444; --text-color: #1f2937;
    --bg-color: #f3f4f6; --card-bg: #ffffff; --border-color: #e5e7eb;
}

body { font-family: "Pretendard Variable", Pretendard, sans-serif; margin: 0; background-color: var(--bg-color); color: var(--text-color); line-height: 1.5; }
* { box-sizing: border-box; }
button { cursor: pointer; font-family: inherit; }
a { text-decoration: none; color: inherit; }
.container { max-width: 1400px; margin: 0 auto; padding: 20px; }
.hidden { display: none !important; }

/* 헤더 */
.admin-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; margin-bottom: 20px; }
.admin-header h2 { font-size: 22px; font-weight: 800; color: #111; margin: 0; }
.header-actions { display: flex; gap: 8px; }

/* 버튼 공통 */
.btn { padding: 8px 14px; border-radius: 6px; font-weight: 600; font-size: 13px; border: none; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 5px; line-height: 1; }
.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger-color); color: white; }
.btn-outline { background: white; border: 1px solid #ccc; color: #555; }
.btn-outline:hover { background: #f9fafb; border-color: #999; }

/* 대시보드 */
.dashboard-card { background: var(--card-bg); border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.03); padding: 25px; border: 1px solid rgba(0,0,0,0.02); margin-bottom: 20px; }
.post-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.post-table th { text-align: left; padding: 12px; border-bottom: 2px solid #ddd; font-size: 13px; color: #666; }
.post-table td { padding: 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
.post-table tr:hover { background-color: #f9fafb; }
.post-table img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; background: #eee; }
.table-title { font-weight: 600; display: block; font-size: 14px; }
.badge { padding: 3px 8px; border-radius: 20px; font-size: 11px; background: #eff6ff; color: var(--primary-color); font-weight: 600; }

/* 에디터 레이아웃 */
.editor-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    position: relative;
    margin-top: 20px;
}

/* 사이드바 영역 */
.editor-sidebar {
    width: 320px;
    min-width: 320px;
    flex-shrink: 0;
}

.sticky-sidebar-area {
    position: -webkit-sticky;
    position: sticky;
    top: 20px; 
}

.sticky-sidebar-area::-webkit-scrollbar { display: none; }

.editor-main { flex: 1; min-width: 0; }

/* 고정 헤더 */
.editor-sticky-header { position: sticky; top: 0; z-index: 100; background: var(--bg-color); padding-top: 10px; padding-bottom: 0; }
.editor-top-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: stretch; }
.editor-title-area { flex: 1; }
.editor-actions-area { display: flex; gap: 5px; }

/* 입력 폼 */
.input-group { margin-bottom: 12px; }
.input-field { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; outline: none; background: white; }
.input-field:focus { border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(59,130,246,0.1); }
.input-title { font-size: 18px; font-weight: bold; padding: 12px; height: 100%; }

/* 툴바 */
.toolbar { background: #f8f9fa; border: 1px solid #ddd; border-bottom: none; border-radius: 8px 8px 0 0; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tool-group { display: flex; gap: 4px; border-right: 1px solid #ddd; padding-right: 8px; margin-right: 4px; }
.tool-group:last-child { border: none; }
.tool-btn { background: white; border: 1px solid #ddd; padding: 5px 8px; border-radius: 4px; cursor: pointer; font-size: 12px; color: #555; height: 28px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.tool-btn:hover { background: #eee; }
.tool-select { padding: 0 5px; border: 1px solid #ddd; border-radius: 4px; height: 28px; font-size: 12px; }

.color-palette { display: flex; gap: 4px; }
.color-dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.1); cursor: pointer; transition: 0.1s; }
.color-dot:hover { transform: scale(1.2); }

/* 에디터 본문 */
.editor-content { border: 1px solid #ddd; min-height: 600px; padding: 30px; background: white; border-radius: 0 0 8px 8px; outline: none; line-height: 1.6; }
.editor-content img { max-width: 100%; border-radius: 4px; margin: 10px 0; cursor: pointer; border: 3px solid transparent; }
.editor-content img:hover { opacity: 0.9; }

/* 코드 블럭 */
.editor-content pre { background: #282c34; color: #abb2bf; padding: 15px; border-radius: 6px; font-family: monospace; font-size: 13px; overflow-x: auto; margin: 15px 0; position: relative; }
.editor-content pre::before { content: "CODE"; position: absolute; top: 5px; right: 10px; font-size: 10px; color: #5c6370; font-weight: bold; }

/* SEO 피드백 스타일 */
.seo-sidebar h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; border-bottom: 2px solid #eee; padding-bottom: 8px; }
.seo-feedback-list { margin-top: 10px; padding: 10px; background: #fff; border-radius: 6px; border: 1px solid #eee; font-size: 12px; max-height: 200px; overflow-y: auto; }
.seo-item { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; color: #555; }
.seo-item.success { color: #10b981; } .seo-item.fail { color: #ef4444; }

/* 모달 및 기타 */
.login-wrapper { max-width: 380px; margin: 80px auto; padding: 30px; background: white; border-radius: 12px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; justify-content: center; align-items: center; }
.modal-content { background: white; width: 90%; max-width: 500px; border-radius: 10px; padding: 20px; box-shadow: 0 20px 25px rgba(0,0,0,0.1); }
.cat-manager-list { border: 1px solid #eee; border-radius: 6px; max-height: 300px; overflow-y: auto; margin-bottom: 15px; }
.cat-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px solid #f5f5f5; }
.cat-name { flex: 1; font-size: 14px; margin-left: 10px; }
.cat-btn { padding: 4px 8px; font-size: 12px; border: 1px solid #ddd; background: white; border-radius: 4px; color: #555; }
.link-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid #eee; cursor: pointer; font-size: 13px; }
.link-item:hover { background: #f9fafb; }

/* 탑 버튼 */
.back-to-top {
    position: fixed; bottom: 30px; right: 30px; width: 50px; height: 50px;
    background: var(--primary-color); color: white; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 20px; cursor: pointer; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    opacity: 0; pointer-events: none; transition: 0.3s; z-index: 2000;
}
.back-to-top.show { opacity: 1; pointer-events: auto; }
.back-to-top:hover { background: var(--primary-hover); transform: translateY(-3px); }

/* 글쓰기 모드 스위치 */
.mode-switch-container {
    display: flex;
    background: #e5e7eb;
    padding: 4px;
    border-radius: 8px;
    width: fit-content;
    margin-bottom: 15px;
}

.mode-switch-label {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    color: #666;
    transition: 0.2s;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mode-switch-container input[type="radio"] { display: none; }
.mode-switch-container input[type="radio"]:checked + .mode-switch-label {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.program-mode-active .editor-toolbar-wrapper, 
.program-mode-active #editor { display: none !important; }

/* 썸네일 업로드 영역 */
.thumb-upload-box {
    border: 2px dashed #cbd5e1;
    background: #f8fafc;
    border-radius: 8px;
    padding: 20px 10px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: 10px;
    color: #64748b;
}
.thumb-upload-box:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
    color: var(--primary-color);
}
.thumb-upload-box i { font-size: 24px; margin-bottom: 5px; display: block; }
.thumb-upload-box span { font-size: 12px; display: block; }

/* 이미지 선택 및 대표이미지 스타일 */
.selected-img-candidate { transition: outline 0.1s; cursor: pointer; }
.is-thumbnail {
    outline: 4px solid #10b981 !important; 
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    position: relative;
}

/* ============================
   [방문자 통계 스타일 추가됨]
   ============================ */

/* 통계 요약 카드 */
.stats-summary {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}
.stat-card {
    flex: 1;
    background: #f8fafc;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
.stat-card h3 { font-size: 13px; color: #64748b; margin: 0 0 8px 0; font-weight: 600; }
.stat-card p { font-size: 26px; font-weight: 800; color: #1e293b; margin: 0; letter-spacing: -0.5px; }

/* CSS 막대 차트 컨테이너 */
.chart-box {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
}
.chart-box h4 { margin: 0 0 15px 0; font-size: 14px; color: #334155; }

/* 실제 그래프 영역 */
.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 180px;
    margin-top: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    gap: 10px;
}
.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: 100%;
    cursor: pointer;
    position: relative;
}
/* 막대 스타일 */
.bar-pv {
    width: 100%;
    background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
    border-radius: 6px 6px 0 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 4px;
    position: relative;
    opacity: 0.9;
}
/* 마우스 오버 시 효과 */
.bar-group:hover .bar-pv { 
    opacity: 1; 
    transform: scaleY(1.05); 
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
}
/* 막대 아래 날짜 라벨 */
.bar-label {
    margin-top: 8px;
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

/* 통계 상세 테이블 */
.table-box {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}
.table-box h4 {
    margin: 0;
    padding: 15px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
    color: #334155;
}

/* 에디터 내 이미지 기본 정렬 설정 */
#editor img {
    display: block;       /* 인라인에서 블록 요소로 변경 */
    margin: 15px auto;    /* 위아래 여백 15px, 좌우 마진 자동(가운데 정렬) */
    max-width: 100%;      /* 본문보다 커지지 않게 조절 */
    height: auto;
}