/* ════════════════════════════════════════════════════════════════════════════
 * 알프스 신규 모달 디자인 규격 (_UI.modal2)
 * ─────────────────────────────────────────────────────────────────────────────
 *  - 기존 알프스 모달 (`_UI.modal` / `.common_ui_modal_*`) 과 완전 분리된 독립 시스템
 *  - 표준 톤: phoenix-primary #3874ff (헤더 #EBF1FF→#F7FAFF 그라데이션 / icon solid blue)
 *  - 정본 디자인: orgMapMaster-pop / orgTypeCode-pop (인라인 패턴) 동일
 *  - 사용: _UI.modal2.open({...}) — 자세한 옵션은 hr.modal2.js 헤더 주석 참조
 *  - 가이드: .claude/references/iframe-modal-pattern.md
 * ════════════════════════════════════════════════════════════════════════════ */

/* === 백드롭 + 박스 wrapper === */
.alps-modal2-wrap {
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	font-family: inherit;
}
.alps-modal2-backdrop {
	position: absolute;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(15, 23, 42, 0.45);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	animation: alpsModal2BackdropFadeIn 150ms ease-out;
}
@keyframes alpsModal2BackdropFadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* === 모달 박스 === */
.alps-modal2-box {
	position: relative;
	background: #fff;
	border-radius: 20px;
	border: 1px solid rgba(56, 116, 255, 0.18);
	box-shadow: 0 28px 72px rgba(0, 0, 0, 0.24), 0 10px 28px rgba(0, 0, 0, 0.12);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	max-height: calc(100vh - 40px);
	max-width:  calc(100vw - 40px);
	animation: alpsModal2BoxEnter 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes alpsModal2BoxEnter {
	from { opacity: 0; transform: translateY(-12px) scale(0.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* === 헤더 (그라데이션 + 아이콘 + 타이틀 + X) === */
.alps-modal2-head {
	background: linear-gradient(135deg, #EBF1FF 0%, #F7FAFF 100%);
	padding: 18px 22px;
	border-bottom: 1px solid #e2e8f0;
	display: flex;
	align-items: center;
	gap: 14px;
	flex: 0 0 auto;
}
.alps-modal2-head .icon {
	width: 42px; height: 42px;
	border-radius: 12px;
	background: #3874ff;
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	font-size: 1.05rem;
	box-shadow: 0 4px 12px rgba(56, 116, 255, 0.28);
	flex: 0 0 auto;
}
.alps-modal2-head .title-area {
	flex: 1 1 0%;
	min-width: 0;
}
.alps-modal2-head .title-area .nm {
	font-size: 1.05rem;
	font-weight: 700;
	color: #2d3748;
	line-height: 1.2;
	margin-bottom: 3px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.alps-modal2-head .title-area .sub {
	font-size: 0.75rem;
	color: #718096;
	font-weight: 400;
}
.alps-modal2-head .close-x {
	width: 32px; height: 32px;
	border: 0;
	background: transparent;
	color: #94a3b8;
	font-size: 1rem;
	cursor: pointer;
	border-radius: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	opacity: 0.7;
	flex: 0 0 auto;
	transition: background-color 0.15s, color 0.15s, opacity 0.15s;
}
.alps-modal2-head .close-x:hover {
	background: rgba(0, 0, 0, 0.05);
	color: #2d3748;
	opacity: 1;
}

/* === 본문 === */
.alps-modal2-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 22px 24px;
	background: #fff;
	color: #2d3748;
	font-size: 0.85rem;
}
.alps-modal2-body::-webkit-scrollbar { width: 6px; }
.alps-modal2-body::-webkit-scrollbar-track { background: transparent; }
.alps-modal2-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
.alps-modal2-body::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* === 풋터 (취소 + 저장) === */
.alps-modal2-foot {
	border-top: 1px solid #e2e8f0;
	padding: 14px 22px;
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	flex: 0 0 auto;
	background: #fff;
}
.alps-modal2-foot button {
	height: 36px;
	padding: 0 18px;
	border-radius: 8px;
	font-size: 0.82rem;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s, border-color 0.15s, transform 0.05s;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.alps-modal2-foot button:active {
	transform: translateY(1px);
}
.alps-modal2-foot .btn-cancel {
	background: #EBF1FF;
	color: #3874ff;
	border: 1px solid #d6e3ff;
	font-weight: 500;
}
.alps-modal2-foot .btn-cancel:hover {
	background: #d6e3ff;
	color: #2A5FE0;
	border-color: #b8c7ff;
}
.alps-modal2-foot .btn-confirm {
	background: #3874ff;
	color: #fff;
	border: 0;
	font-weight: 600;
}
.alps-modal2-foot .btn-confirm:hover {
	background: #2A5FE0;
}

/* === 본문 안 공통 form 톤 (선택적 — 호출 측이 form-label/form-control 그대로 써도 자연스럽게) === */
.alps-modal2-body .form-label {
	display: block;
	font-size: 0.78rem;
	font-weight: 600;
	color: #525B75;
	margin-bottom: 6px;
}
.alps-modal2-body .form-control,
.alps-modal2-body .form-select {
	width: 100%;
	height: 38px;
	padding: 0 12px;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	font-size: 0.85rem;
	color: #2d3748;
	background: #fff;
	transition: border-color 0.15s, box-shadow 0.15s;
}
.alps-modal2-body textarea.form-control {
	height: auto;
	min-height: 60px;
	padding: 8px 12px;
	resize: vertical;
}
.alps-modal2-body .form-control:focus,
.alps-modal2-body .form-select:focus {
	outline: none;
	border-color: #3874ff;
	box-shadow: 0 0 0 3px rgba(56, 116, 255, 0.12);
}
.alps-modal2-body small.text-body-tertiary,
.alps-modal2-body small.help-text {
	display: block;
	margin-top: 4px;
	font-size: 0.72rem;
	color: #94a3b8;
}

/* === 본문 안 강조 정보 박스 (예: "이 시뮬의 새 버전 등록" 컨텍스트 표시) === */
.alps-modal2-body .alps-modal2-target {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	margin-bottom: 18px;
	background: #f7fafc;
	border: 1px solid #e2e8f0;
	border-left: 3px solid #3874ff;
	border-radius: 8px;
	font-size: 0.85rem;
	color: #2d3748;
}
.alps-modal2-body .alps-modal2-target i { color: #3874ff; font-size: 0.8rem; flex-shrink: 0; }
.alps-modal2-body .alps-modal2-target .target-text { font-weight: 600; }


/* ════════════════════════════════════════════════════════════════════════════
 *  .m2-* 표준 컴포넌트 (modal2 본문 안에서 재사용)
 * ─────────────────────────────────────────────────────────────────────────────
 *  - 정본 디자인: orgMapTypeMapping (조직/임직원 조회), okrObjMgr (목표 등록/수정)
 *  - 목적: modal2 안에서 inline `<style>` 로 토큰 복제하지 않고 클래스 조합만으로 작성
 *  - 신규 modal2 작업 시 `.m2-*` 클래스 우선 사용. 새 컴포넌트 필요 시 본 파일에 추가
 *  - 가이드: .claude/references/css-organization-standard.md
 * ════════════════════════════════════════════════════════════════════════════ */

/* --- 섹션 라벨 (아이콘 + 텍스트 + 필수표시) --- */
.m2-section-label {
	display: block;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #4a5568;
	margin-bottom: 6px;
}
.m2-section-label > i {
	color: #3874ff;
	opacity: 0.6;
	margin-right: 0.25rem;
}
.m2-section-label .m2-required {
	color: #e53e3e;
	font-weight: 700;
	margin-left: 0.15rem;
}

/* --- Segment Tabs (회사/조직/개인, 전사공개/비공개 등 필 버튼 그룹) --- */
.m2-segment-tabs {
	display: flex;
	gap: 6px;
	background: #f3f4f6;
	padding: 4px;
	border-radius: 8px;
}
.m2-segment-tab {
	flex: 1;
	text-align: center;
	padding: 0.4rem 0.5rem;
	font-size: 0.75rem;
	font-weight: 600;
	cursor: pointer;
	border: 1px solid transparent;
	border-radius: 6px;
	background: transparent;
	color: #94a3b8;
	transition: background-color 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
	white-space: nowrap;
}
.m2-segment-tab:hover:not(.active) {
	color: #4a5568;
	background: #fff;
}
.m2-segment-tab.active {
	color: #fff;
	background: #3874ff;
	border-color: #3874ff;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* --- 날짜 입력 (캘린더 아이콘 + 텍스트 입력) --- */
.m2-date-input {
	display: flex;
	align-items: stretch;
	border: 1.5px solid #e2e8f0;
	border-radius: 10px;
	overflow: hidden;
	background: #fff;
}
.m2-date-input .m2-date-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 12px;
	background: #f8fafc;
	color: #3874ff;
	font-size: 0.8125rem;
	border-right: 1px solid #e2e8f0;
}
.m2-date-input input {
	flex: 1;
	border: 0;
	padding: 0.5rem 0.75rem;
	font-size: 0.85rem;
	color: #2d3748;
	background: transparent;
	outline: none;
	min-width: 0;
}
.m2-date-input:focus-within {
	border-color: #3874ff;
	box-shadow: 0 0 0 3px rgba(56, 116, 255, 0.12);
}

/* --- Chip Row (Q1/Q2/Q3/Q4/상반기/하반기/연간 등 빠른선택 칩) --- */
.m2-chip-row {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
	align-items: center;
}
.m2-chip {
	padding: 0.35rem 0.75rem;
	border: 1.5px solid #e2e8f0;
	border-radius: 8px;
	background: #fff;
	color: #64748b;
	font-size: 0.75rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s, border-color 0.15s;
	white-space: nowrap;
}
.m2-chip:hover {
	border-color: #3874ff;
	color: #3874ff;
	background: #f0f4ff;
}
.m2-chip.active {
	border-color: #3874ff;
	color: #fff;
	background: #3874ff;
}

/* --- 연도 셀렉트 (칩 옆) --- */
.m2-year-select {
	padding: 0.35rem 0.75rem;
	border: 1.5px solid #e2e8f0;
	border-radius: 8px;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #4a5568;
	background: #fff;
	cursor: pointer;
	outline: none;
	transition: border-color 0.15s, box-shadow 0.15s;
}
.m2-year-select:hover,
.m2-year-select:focus {
	border-color: #3874ff;
	box-shadow: 0 0 0 3px rgba(56, 116, 255, 0.12);
}

/* --- 도움말 회색 텍스트 (정보 안내) --- */
.m2-helper-text {
	display: flex;
	align-items: flex-start;
	gap: 4px;
	font-size: 0.7rem;
	color: #94a3b8;
	margin-top: 0.25rem;
	line-height: 1.4;
}
.m2-helper-text > i {
	font-size: 0.7rem;
	margin-top: 0.15rem;
	flex-shrink: 0;
}

/* --- 빨간 경고 텍스트 (필수 입력 안내 등) --- */
.m2-warning-text {
	display: flex;
	align-items: flex-start;
	gap: 4px;
	font-size: 0.7rem;
	color: #e53e3e;
	margin-top: 0.25rem;
	line-height: 1.4;
}
.m2-warning-text > i {
	font-size: 0.7rem;
	margin-top: 0.15rem;
	flex-shrink: 0;
}

/* --- 행 그룹 (라벨 + 입력 영역 묶음) --- */
.m2-field {
	margin-bottom: 1rem;
}
.m2-field:last-child {
	margin-bottom: 0;
}
.m2-field-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}
.m2-field-sep {
	color: #94a3b8;
	font-weight: 600;
	flex-shrink: 0;
}
