/* GlobalCRM - 메인 스타일시트 */

:root {
    --sidebar-width: 250px;
    --topbar-height: 60px;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --bg: #f1f5f9;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #2563eb;
    --card-shadow: 0 1px 3px rgba(0,0,0,.1);
}

* { box-sizing: border-box; }
body { font-family: 'Noto Sans KR', sans-serif; background: var(--bg); color: #334155; margin: 0; }

/* ── 레이아웃 ── */
.app-wrapper { display: flex; min-height: 100vh; }
.main-content { flex: 1; display: flex; flex-direction: column; margin-left: var(--sidebar-width); transition: margin .3s; min-width: 0; }

/* ── 사이드바 ── */
.sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-width);
    background: var(--sidebar-bg); display: flex; flex-direction: column;
    overflow-y: auto; z-index: 1000; transition: transform .3s;
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-link { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: #fff; font-size: 1.1rem; }
.brand-icon { color: var(--primary); font-size: 1.3rem; }
.brand-text strong { color: var(--primary); }
.sidebar-user { padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: .75rem; }
.user-avatar { font-size: 2rem; color: #64748b; }
.user-name { color: #e2e8f0; font-weight: 500; font-size: .9rem; }
.user-role { font-size: .7rem; padding: .15rem .5rem; border-radius: 10px; }
.role-agent   { background: #3b82f6; color: #fff; }
.role-sm      { background: #10b981; color: #fff; }
.role-bm      { background: #f59e0b; color: #fff; }
.role-director{ background: #8b5cf6; color: #fff; }
.role-branch  { background: #ef4444; color: #fff; }
.role-ceo     { background: #1d4ed8; color: #fff; }

.sidebar-menu { list-style: none; margin: 0; padding: .5rem 0; flex: 1; }
.menu-divider { padding: .75rem 1.25rem .25rem; font-size: .7rem; text-transform: uppercase; color: #475569; letter-spacing: .05em; }
.menu-item { }
.menu-link { display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; color: var(--sidebar-text); text-decoration: none; transition: background .15s, color .15s; font-size: .88rem; }
.menu-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.menu-item.active .menu-link { background: var(--sidebar-active); color: #fff; border-right: 3px solid #93c5fd; }
.menu-icon { width: 18px; text-align: center; flex-shrink: 0; }
.badge { display: inline-flex; align-items: center; justify-content: center; }

/* ── 상단 바 ── */
.topbar { height: var(--topbar-height); background: #fff; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; position: sticky; top: 0; z-index: 100; box-shadow: var(--card-shadow); }
.topbar-user { display: flex; align-items: center; color: #64748b; font-size: .88rem; }

/* ── 페이지 콘텐츠 ── */
.page-content { padding: 1.5rem; flex: 1; }

/* ── 카드 ── */
.card { border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: var(--card-shadow); background: #fff; }
.card-header { background: #fff; border-bottom: 1px solid #e2e8f0; padding: .85rem 1.25rem; font-weight: 600; font-size: .9rem; color: #475569; border-radius: 8px 8px 0 0 !important; }

/* ── 통계 카드 ── */
.stat-card { display: flex; align-items: center; gap: 1rem; background: #fff; border-radius: 10px; padding: 1.25rem; box-shadow: var(--card-shadow); border: 1px solid #e2e8f0; transition: transform .15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-primary .stat-icon { background: #dbeafe; color: var(--primary); }
.stat-success .stat-icon { background: #dcfce7; color: var(--success); }
.stat-warning .stat-icon { background: #fef3c7; color: var(--warning); }
.stat-info    .stat-icon { background: #cffafe; color: var(--info); }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; color: #1e293b; }
.stat-label { font-size: .78rem; color: #94a3b8; margin-top: .2rem; }

/* ── 로그인 페이지 ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); padding: 1rem; }
.login-container { width: 100%; max-width: 420px; }
.login-logo { text-align: center; color: #fff; margin-bottom: 1.5rem; }
.login-logo i { font-size: 2.5rem; color: var(--primary); margin-bottom: .5rem; }
.login-logo h1 { font-size: 1.8rem; margin: 0; }
.login-logo strong { color: var(--primary); }
.login-subtitle { color: #94a3b8; font-size: .85rem; margin-top: .25rem; }
.login-card { background: #fff; border-radius: 12px; padding: 2rem; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.login-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.5rem; color: #1e293b; }
.btn-login { padding: .75rem; font-size: 1rem; font-weight: 600; }
.login-footer { text-align: center; margin-top: 1.5rem; font-size: .85rem; color: #64748b; }

/* ── 테이블 ── */
.table th { font-size: .8rem; text-transform: uppercase; color: #64748b; font-weight: 600; background: #f8fafc; border-bottom: 2px solid #e2e8f0; }
.table td { font-size: .88rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ── 반응형 ── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; }

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; }
    .page-content { padding: 1rem; }
}

/* ── 유틸리티 ── */
.page-header { border-bottom: 1px solid #e2e8f0; padding-bottom: 1rem; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-role { display: inline-block; }
