/* ================================================================
   진담헤어 관리자 – Admin CSS
   디자인 톤: 파란색 계열, 둥근 버튼 (디자이너 테마 통일)
   ================================================================ */

/* ── Variables ────────────────────────────────────── */
:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #EFF6FF;
    --primary-border: #BFDBFE;
    --secondary: #64748B;
    --success: #10B981;
    --success-light: #ECFDF5;
    --danger: #EF4444;
    --danger-light: #FEF2F2;
    --warning: #F59E0B;
    --bg: #F8FAFC;
    --card-bg: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --border: #E2E8F0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
}

/* Base */
body {
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    margin: 0;
}

/* ================================================================
   레이아웃
   ================================================================ */

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: #1E293B;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-brand h1 {
    font-size: 18px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0;
}

.sidebar-brand small {
    font-size: 11px;
    color: #94A3B8;
}

.sidebar-nav {
    padding: 16px 0;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    color: #64748B;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 8px 24px 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    color: #94A3B8;
    text-decoration: none;
    font-size: 14px;
    border-radius: 0;
    transition: all 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(37,99,235,.15);
    color: #60A5FA;
}

.sidebar-nav a.active {
    border-left: 3px solid #2563EB;
}

.sidebar-nav a i {
    width: 18px;
    text-align: center;
}

/* ── Main Content ────────────────────────────────── */
.main-content {
    margin-left: 240px;
    min-height: 100vh;
}

/* ── Top Header ──────────────────────────────────── */
.top-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

/* ── Hamburger (mobile) ──────────────────────────── */
.hamburger-btn {
    display: none;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
}

.sidebar-overlay.show {
    display: block;
}

/* ── Page Body ───────────────────────────────────── */
.page-body {
    padding: 28px;
}

/* ================================================================
   카드
   ================================================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
}

.card-body {
    padding: 20px;
}

/* ================================================================
   테이블
   ================================================================ */
.table-wrapper {
    overflow-x: auto;
}

.table { font-size: 14px; margin: 0; }
.table thead th {
    background: #F8FAFC;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    padding: 10px 14px;
}
.table tbody td {
    padding: 12px 14px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-primary);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover td { background-color: var(--primary) !important; color: #fff !important; cursor: pointer; }
.table tbody tr:hover td .btn { color: inherit; background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.4); }
.table tbody tr:hover td .badge-status { opacity: .9; }
.table .text-center { text-align: center; }
.table .text-right { text-align: right; }

/* ================================================================
   배지
   ================================================================ */
.badge-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-active { background: var(--success-light); color: var(--success); }
.badge-inactive { background: var(--danger-light); color: var(--danger); }
.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-default { background: var(--bg); color: var(--text-secondary); }

/* ================================================================
   버튼
   ================================================================ */
.btn {
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    color: #fff;
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover,
.btn-outline-primary.active {
    background: var(--primary);
    color: #fff;
}

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ================================================================
   검색 바
   ================================================================ */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.search-bar .form-control,
.search-bar .form-select {
    max-width: 200px;
    height: 38px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.search-bar .btn {
    height: 38px;
    font-size: 14px;
    border-radius: var(--radius-sm);
}

/* ================================================================
   페이지네이션
   ================================================================ */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 16px 0;
}
.pagination .page-link {
    color: var(--primary);
    font-size: 14px;
    border-radius: var(--radius-sm);
    margin: 0 4px;
}
.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ================================================================
   모달
   ================================================================ */
.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--border); padding: 12px 20px; }

/* ================================================================
   폼
   ================================================================ */
.form-label { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.form-control, .form-select {
    font-size: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-text { font-size: 12px; color: var(--text-secondary); }

/* ================================================================
   Info Row (read-only detail)
   ================================================================ */
.info-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-label {
    width: 120px;
    min-width: 120px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
}
.info-value { flex: 1; color: var(--text-primary); }

/* ================================================================
   탭
   ================================================================ */
.nav-tabs .nav-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 20px;
    margin-bottom: -2px;
    transition: all 0.15s;
}
.nav-tabs .nav-link:hover {
    color: var(--primary);
}
.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
    background: none;
}

/* ================================================================
   빈 상태
   ================================================================ */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}
.empty-state i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}
.empty-state p {
    font-size: 14px;
}

/* ================================================================
   로딩
   ================================================================ */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.loading-overlay.show { display: flex; }

/* ================================================================
   서버 모니터링
   ================================================================ */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}
.status-dot.up { background: var(--success); }
.status-dot.down { background: var(--danger); }
.status-dot.skipped { background: #9e9e9e; }

.log-viewer {
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    padding: 16px;
    border-radius: var(--radius);
    height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
}

/* ================================================================
   로그인 페이지
   ================================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(37,99,235,.12);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    margin: 0;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.login-form .form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-form .form-control {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.login-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    outline: none;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    background: var(--primary);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}

.login-btn:hover {
    background: var(--primary-dark);
}

/* ================================================================
   반응형
   ================================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .page-body {
        padding: 16px;
    }

    .top-header {
        padding: 12px 16px;
    }

    .hamburger-btn {
        display: flex !important;
    }

    .search-bar .form-control,
    .search-bar .form-select {
        max-width: 100%;
    }
}

/* ================================================================
   추가 스타일 — 관리자 UI 개선
   ================================================================ */

/* 사이드바 섹션 구분 강화 */
.sidebar-nav .nav-section-title {
    margin-top: 20px;
    padding: 12px 24px 6px;
    font-size: 10px;
    font-weight: 700;
    color: #94A3B8;
    letter-spacing: .12em;
    text-transform: uppercase;
    border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-nav .nav-section-title:first-child {
    border-top: none;
    margin-top: 8px;
}

/* 테이블 행 호버 강조 (클릭 가능한 행) */
.table-clickable tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

/* 패널 수정버튼 hover 시만 표시 */
.panel-list-item .btn { opacity: 0; transition: opacity 0.15s; }
.panel-list-item:hover .btn { opacity: 1; }

/* 프로필 이미지 */
.profile-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-light);
    background: var(--bg);
}
.profile-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    flex-shrink: 0;
}

/* 상세 카드 레이아웃 */
.detail-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
}
.detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.detail-header-info {
    flex: 1;
    min-width: 0;
}
.detail-header-id {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-secondary);
}
.detail-header-id code {
    color: var(--text-secondary);
    font-size: 11px;
}
.detail-header-info h5 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
}
.detail-header-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.detail-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: .03em;
}
.detail-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
code {
    color: inherit;
}

/* 섹션 제목 (왼쪽 accent bar) */
.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    padding-left: 12px;
    border-left: 3px solid var(--primary);
    margin: 24px 0 16px;
}
.section-title:first-child,
.section-title.mt-0 {
    margin-top: 0;
}

/* 모달 요약 영역 */
.modal-summary {
    background: var(--bg-light);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-summary .summary-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.modal-summary .summary-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    flex-shrink: 0;
}
.modal-summary .summary-sub code {
    color: var(--text-secondary);
    font-size: 11px;
}

/* 3-panel 레이아웃 (시술 메뉴) */
.three-panel {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}
@media (max-width: 992px) {
    .three-panel { grid-template-columns: 1fr; }
}
.panel-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}
.panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    border-radius: var(--radius) var(--radius) 0 0;
    flex-shrink: 0;
}
.panel-body {
    max-height: 500px;
    overflow-y: auto;
    flex: 1;
}
.panel-list-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.panel-list-item:last-child { border-bottom: none; }
.panel-list-item:hover { background: var(--primary-light); }
.panel-list-item.active {
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
}
.panel-list-item .item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.panel-list-item:hover .item-actions { opacity: 1; }

/* 이미지 썸네일 */
.img-thumbnail-wrap {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: 4px;
}
.img-thumbnail-wrap img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    display: block;
}

/* 콤보박스 */
.combo-box { position: relative; }
.combo-box .combo-input { padding-right: 32px; cursor: text; }
.combo-box .combo-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
    font-size: 12px;
}
.combo-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1060;
    margin-top: 2px;
}
.combo-dropdown.show { display: block; }
.combo-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s;
}
.combo-item:hover { background: var(--primary-light); color: var(--primary); }
.combo-item.selected { background: var(--primary); color: #fff; }

/* 모달 드래그 */
.modal-header { cursor: move; }
.modal-dialog.dragging { transition: none !important; }

/* 모달 수직 정중앙 */
.modal-dialog {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

/* 패널 드래그 정렬 */
.panel-list-item .drag-handle {
    cursor: grab;
    color: var(--text-secondary);
    margin-right: 8px;
    font-size: 12px;
}
.panel-list-item.dragging { opacity: 0.4; }
.panel-list-item.drag-over-top { border-top: 2px solid var(--primary); padding-top: 8px; }
.panel-list-item.drag-over-bottom { border-bottom: 2px solid var(--primary); padding-bottom: 8px; }

/* Quill 에디터 */
.ql-editor { min-height: 150px; }
.ql-toolbar.ql-snow { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.ql-container.ql-snow { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

/* ── 시술 메뉴 상세 팝업 ── */
.menu-detail-gallery { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 16px; }
.menu-detail-img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); flex-shrink: 0; }
.menu-detail-price-card { background: var(--primary-light); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px; text-align: center; }
.menu-detail-original-price { font-size: 0.85rem; color: var(--text-muted); text-decoration: line-through; margin-bottom: 2px; }
.menu-detail-sale-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.menu-detail-discount { font-size: 1.25rem; font-weight: 700; color: #ef4444; }
.menu-detail-sale-price { font-size: 1.25rem; font-weight: 700; color: var(--text-dark); }
.menu-detail-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.menu-detail-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; font-size: 0.8rem; border-radius: 999px; background: var(--bg-light); border: 1px solid var(--border); color: var(--text-secondary); }
.menu-detail-desc { margin-top: 0; padding: 16px; background: var(--bg-light); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.menu-detail-desc-text { font-size: 0.9rem; line-height: 1.7; color: var(--text-dark); white-space: pre-wrap; }

/* ── 캐로셀 이미지 ── */
.carousel-detail-img { max-height: 300px; max-width: 100%; object-fit: contain; border-radius: var(--radius-sm); }
.carousel-indicators [data-bs-target] { background-color: var(--primary); }
.carousel-control-prev-icon,
.carousel-control-next-icon { background-color: rgba(0,0,0,.4); border-radius: 50%; padding: 12px; background-size: 50%; }
.carousel { border-radius: var(--radius-sm); background: var(--bg-light); }
