/* Partner Portal — 전용 스타일 */

/* D2Coding 웹폰트 */
@font-face {
    font-family: 'D2Coding';
    src: url('../fonts/D2Coding.woff') format('woff'),
         url('../fonts/D2Coding.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --bg: #f8fafc;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #3b82f6;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'D2Coding', monospace, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
input, textarea, select, button { font-family: 'D2Coding', monospace, sans-serif; }
.tabulator, .tabulator * { font-family: 'D2Coding', monospace, sans-serif !important; }

/* 로그인 페이지 */
.login-body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: url('../img/company_large.jpg') center/cover no-repeat fixed; }
.login-card { background: #fff; padding: 48px 40px; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); width: 400px; }
.login-card h1 { text-align: center; color: var(--primary); margin-bottom: 4px; font-size: 24px; }
.login-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 32px; font-size: 13px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 600; font-size: 13px; color: var(--text-muted); }
.form-group input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; outline: none; }
.form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.btn-login { width: 100%; padding: 12px; background: var(--primary); color: #fff; border: none; border-radius: 6px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 8px; }
.btn-login:hover { background: var(--primary-hover); }
.error-msg { color: var(--danger); font-size: 13px; padding: 8px 0; }

/* 레이아웃 — 브라우저 크기 고정, 그리드 내부만 스크롤 */
html, body { height: 100%; overflow: hidden; }
#app { display: flex; height: 100vh; }

/* 사이드바 */
#sidebar { width: 155px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 20px 16px 12px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header h2 { font-size: 16px; color: #fff; margin-bottom: 4px; }
.sidebar-header span { font-size: 12px; color: var(--sidebar-text); }
#nav-menu { list-style: none; flex: 1; padding: 8px 0; overflow-y: auto; }
#nav-menu li a { display: block; padding: 10px 16px; color: var(--sidebar-text); text-decoration: none; font-size: 13px; border-left: 3px solid transparent; transition: all 0.15s; }
#nav-menu li a:hover { background: rgba(255,255,255,0.05); color: #fff; }
#nav-menu li a.active { background: rgba(59,130,246,0.15); color: #fff; border-left-color: var(--sidebar-active); }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; }
.sidebar-footer button { background: none; border: 1px solid rgba(255,255,255,0.2); color: var(--sidebar-text); padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.sidebar-footer button:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* 메인 콘텐츠 */
#content { flex: 1; padding: 20px 24px; overflow: hidden; display: flex; flex-direction: column; }
#page-title { flex-shrink: 0; }
#page-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; position: relative; }
#page-title h2 { font-size: 18px; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--primary); }

/* 공통 컴포넌트 */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.toolbar input[type="text"] { padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; width: 200px; box-sizing: border-box; height: 28px; }
.toolbar select { padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; box-sizing: border-box; height: 28px; background: #fff; }
.btn { padding: 6px 14px; border: none; border-radius: 4px; font-size: 13px; cursor: pointer; font-weight: 500; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f1f5f9; }


/* Tabulator 헤더: 정렬 화살표 숨김 + 제목 중앙정렬 (정렬 기능은 유지) */
.tabulator .tabulator-col .tabulator-col-sorter,
.tabulator .tabulator-header .tabulator-col .tabulator-col-sorter,
.tabulator-col-sorter,
.tabulator .tabulator-arrow {
    display: none !important;
    width: 0 !important;
    visibility: hidden !important;
}
.tabulator .tabulator-col .tabulator-col-content {
    padding: 4px 2px !important;
}
.tabulator .tabulator-col .tabulator-col-title {
    width: 100% !important;
    text-align: center !important;
    padding: 0 !important;
}

/* Tabulator 편집 가능 셀 표시 */
.tabulator .tabulator-cell.cell-editable {
    background: #eff6ff !important;
    border-right: 1px solid #bfdbfe !important;
    cursor: text;
}
.tabulator .tabulator-cell.cell-editable:hover {
    background: #dbeafe !important;
}

/* Tabulator 행 호버/선택 스타일 */
.tabulator .tabulator-row:hover { background: #e0ecff !important; }
.tabulator .tabulator-row.tabulator-selected { background: #c7dbff !important; }

.placeholder { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 15px; }

/* 카트 뱃지 */
.cart-count { background: var(--danger); color: #fff; border-radius: 50%; padding: 1px 6px; font-size: 11px; margin-left: 4px; }

/* 토스트 */
.toast { position: fixed; top: 20px; right: 20px; padding: 12px 20px; border-radius: 6px; color: #fff; font-size: 13px; z-index: 9999; animation: slideIn 0.3s; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warn { background: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 그리드 컨텍스트 메뉴 */
.grid-ctx-menu { position: fixed; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); z-index: 2000; min-width: 140px; padding: 4px 0; font-size: 13px; }
.grid-ctx-menu div { padding: 6px 14px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.grid-ctx-menu div:hover { background: #eff6ff; color: var(--primary); }
.grid-ctx-menu .ctx-sep { height: 1px; background: var(--border); margin: 3px 8px; padding: 0; cursor: default; }
.grid-ctx-menu .ctx-shortcut { margin-left: auto; font-size: 11px; color: var(--text-muted); }

/* 모달 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; justify-content: center; align-items: center; z-index: 1000; pointer-events: auto; }
.modal-box { background: #fff; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); width: 640px; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); cursor: move; user-select: none; }
.modal-header h3 { font-size: 16px; margin: 0; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); text-align: right; display: flex; gap: 8px; justify-content: flex-end; }
.form-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.form-grid-2col .full-width { grid-column: 1 / -1; }
.form-grid-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 16px; }
.form-grid-3col .full-width { grid-column: 1 / -1; }
.form-grid-3col .span-2 { grid-column: span 2; }
.form-field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 3px; font-weight: 500; }
.form-field .required { color: var(--danger); }
.form-field input, .form-field select { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 5px; font-size: 13px; outline: none; }
.form-field input:focus, .form-field select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
.form-field textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 5px; font-size: 13px; outline: none; resize: vertical; font-family: 'D2Coding', monospace, sans-serif; }
.form-field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }

/* ── 로딩 오버레이 ── */
.loading-overlay { position: absolute; inset: 0; background: rgba(255,255,255,0.7); display: flex; justify-content: center; align-items: center; z-index: 100; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 확인 다이얼로그 ── */
.confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; justify-content: center; align-items: center; z-index: 1100; }
.confirm-box { background: #fff; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); width: 380px; padding: 24px; }
.confirm-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.confirm-message { font-size: 14px; margin-bottom: 20px; line-height: 1.6; color: var(--text); }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── 빈 상태 표시 ── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-text { font-size: 14px; }

/* ── 구분선 ── */
.divider { height: 0; border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ── 작은 버튼 ── */
.btn-sm { padding: 3px 10px; font-size: 12px; }

/* ── 비활성 버튼 ── */
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ========================================
   사용안내 매뉴얼
   ======================================== */

.guide-container { display: flex; height: 100%; overflow: hidden; }

/* 좌측 TOC */
.guide-toc {
    width: 180px; flex-shrink: 0; overflow-y: auto;
    background: #f8fafc; border-right: 1px solid var(--border);
    padding: 16px 0; font-size: 13px;
}
.guide-toc-title {
    padding: 0 14px 10px; font-size: 14px; font-weight: 700; color: var(--text);
    border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.guide-toc a {
    display: block; padding: 5px 14px; color: var(--text-muted);
    text-decoration: none; border-left: 3px solid transparent; transition: all 0.15s;
    line-height: 1.5;
}
.guide-toc a:hover { color: var(--primary); background: rgba(37,99,235,0.04); }
.guide-toc a.active { color: var(--primary); border-left-color: var(--primary); font-weight: 600; background: rgba(37,99,235,0.06); }
.guide-toc a.toc-chapter { font-weight: 600; color: var(--text); padding-top: 10px; font-size: 13px; }
.guide-toc a.toc-section { padding-left: 24px; font-size: 12px; }
.guide-toc-bottom {
    padding: 12px 14px; border-top: 1px solid var(--border); margin-top: 8px;
}
.guide-toc-bottom a {
    border-left: none; text-align: center; color: var(--text-muted); font-size: 12px;
}

/* 우측 본문 */
.guide-body {
    flex: 1; overflow-y: auto; padding: 24px 32px;
    scroll-behavior: smooth; background: #fff;
}

/* 챕터 제목 */
.guide-chapter {
    font-size: 18px; font-weight: 700; color: var(--text);
    margin: 32px 0 16px; padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}
.guide-chapter:first-child { margin-top: 0; }

/* 섹션 카드 */
.guide-section {
    background: #fff; border: 1px solid var(--border); border-radius: 8px;
    padding: 24px; margin-bottom: 20px;
}
.guide-section h3 {
    font-size: 15px; font-weight: 600; color: var(--text);
    padding-left: 12px; border-left: 4px solid var(--primary);
    margin-bottom: 12px;
}
.guide-section-desc {
    color: var(--text-muted); font-size: 13px; margin-bottom: 16px; line-height: 1.6;
}
.guide-role-badge {
    display: inline-block; font-size: 11px; padding: 1px 8px;
    border-radius: 10px; margin-left: 8px; font-weight: 500; vertical-align: middle;
}
.guide-role-admin { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.guide-role-user { background: #eff6ff; color: var(--primary); border: 1px solid #bfdbfe; }
.guide-role-viewer { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

/* 스크린샷 */
.guide-img-wrap {
    margin: 16px 0; text-align: center;
}
.guide-img {
    max-width: 100%; border: 1px solid var(--border); border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08); cursor: pointer;
    transition: box-shadow 0.2s;
}
.guide-img:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
.guide-img-caption {
    font-size: 12px; color: var(--text-muted); margin-top: 6px; text-align: center;
}

/* 단계별 사용법 */
.guide-steps {
    margin: 16px 0; padding-left: 0; list-style: none; counter-reset: step;
}
.guide-steps li {
    counter-increment: step; padding: 8px 0 8px 36px; position: relative;
    font-size: 13px; line-height: 1.6; border-bottom: 1px solid #f1f5f9;
}
.guide-steps li:last-child { border-bottom: none; }
.guide-steps li::before {
    content: counter(step); position: absolute; left: 0; top: 8px;
    width: 24px; height: 24px; background: var(--primary); color: #fff;
    border-radius: 50%; text-align: center; line-height: 24px;
    font-size: 12px; font-weight: 700;
}

/* TIP 박스 */
.guide-tip {
    margin: 16px 0; padding: 12px 16px;
    background: #eff6ff; border-left: 4px solid var(--primary);
    border-radius: 0 6px 6px 0; font-size: 13px; line-height: 1.6;
}
.guide-tip strong { color: var(--primary); }

/* 주의 박스 */
.guide-warn {
    margin: 16px 0; padding: 12px 16px;
    background: #fffbeb; border-left: 4px solid var(--warning);
    border-radius: 0 6px 6px 0; font-size: 13px; line-height: 1.6;
}
.guide-warn strong { color: var(--warning); }

/* 소개 영역 */
.guide-intro {
    display: flex; gap: 20px; align-items: flex-start; margin-bottom: 16px;
}
.guide-intro-text { flex: 1; font-size: 13px; line-height: 1.7; color: var(--text); }
.guide-feature-list {
    margin: 10px 0; padding-left: 20px; font-size: 13px; line-height: 1.8;
}

/* 이미지 확대 모달 */
.guide-zoom-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    display: flex; justify-content: center; align-items: center;
    z-index: 2000; cursor: zoom-out;
}
.guide-zoom-overlay img {
    max-width: 92vw; max-height: 92vh;
    border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

/* 첨부 미리보기 모달 (biopro-doc-viewer 호스트 셸 — js/partner-preview.js, W13 2026-09-09). 뷰 팝업(.modal-overlay 1000) 위 */
.doc-preview-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; z-index: 1500; }
.doc-preview-modal [hidden] { display: none !important; }
.doc-preview-content { background: #fff; border-radius: 10px; width: 1040px; max-width: 94vw; height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.doc-preview-header { padding: 10px 14px; gap: 12px; flex: 0 0 auto; }
.doc-preview-header h3 { min-width: 0; flex: 1; font-size: 14px; display: flex; align-items: center; }
.doc-preview-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-preview-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.doc-preview-tools > span { display: inline-flex; align-items: center; gap: 6px; }
.doc-preview-chip { min-width: 26px; height: 26px; border: 1px solid var(--border); background: #fff; border-radius: 4px; color: var(--text-muted); cursor: pointer; line-height: 1; font-size: 12px; }
.doc-preview-chip:hover:not(:disabled) { color: var(--primary); border-color: var(--primary); }
.doc-preview-chip:disabled { opacity: 0.4; cursor: default; }
.doc-preview-val { font-size: 12px; color: var(--text-muted); min-width: 44px; text-align: center; }
.doc-preview-sep { color: var(--border); }
.doc-preview-download { display: inline-flex; align-items: center; padding: 4px 10px; font-size: 12px; border: 1px solid var(--border); border-radius: 4px; color: var(--text); background: #fff; text-decoration: none; }
.doc-preview-download:hover { color: var(--primary); border-color: var(--primary); }
.doc-preview-notice { flex: 0 0 auto; background: #fef3c7; color: #92400e; font-size: 12px; padding: 6px 12px; text-align: center; border-bottom: 1px solid #fde68a; }
.doc-preview-sheet-tabs { flex: 0 0 auto; display: flex; gap: 2px; padding: 6px 8px; background: #f3f4f6; border-bottom: 1px solid #ddd; overflow-x: auto; }
.doc-preview-sheet-tab { padding: 4px 12px; font-size: 12px; border: 1px solid #ddd; background: #fff; color: #333; cursor: pointer; white-space: nowrap; border-radius: 3px 3px 0 0; }
.doc-preview-sheet-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.doc-preview-stage { position: relative; flex: 1; min-height: 0; display: flex; }
.doc-preview-viewport { flex: 1; min-width: 0; overflow: auto; background: #525659; }
.doc-preview-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #525659; }
.doc-preview-center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #e5e7eb; }
.doc-preview-msg { margin: 0; font-size: 14px; text-align: center; line-height: 1.6; }
.doc-preview-msg small { color: #cbd5e1; }
.doc-preview-spinner { width: 36px; height: 36px; border: 4px solid rgba(255,255,255,0.25); border-top-color: #fff; border-radius: 50%; animation: doc-preview-spin 0.8s linear infinite; }
@keyframes doc-preview-spin { to { transform: rotate(360deg); } }
.doc-preview-primary { padding: 6px 16px; font-size: 13px; border: none; border-radius: 4px; background: var(--primary); color: #fff; cursor: pointer; text-decoration: none; }
@media (max-width: 640px) { .doc-preview-content { width: 98vw; height: 94vh; } }
