/* ============================================
   조사계획 (Plan) 스타일
   ============================================ */

/* ── 서브탭 (계획/완료) — 조사결과 탭과 동일 패턴 ── */
.plan-sub-tabs { display: flex; border-bottom: 2px solid #e0e0e0; margin-bottom: 8px; flex-shrink: 0; }
.plan-sub-tab {
    flex: 1; padding: 10px 0; text-align: center;
    font-size: 13px; font-weight: 500; color: #888;
    background: none; border: none; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}
.plan-sub-tab.active { color: #2196f3; border-bottom-color: #2196f3; }

/* planSubContent: flex 확장으로 목록 영역만 스크롤 */
#planSubContent {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* ── 목록 ── */
.plan-list { display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 0; }
.plan-list-toolbar { display: flex; justify-content: flex-end; margin-top: 6px; flex-shrink: 0; }
.plan-list-search { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.plan-list-search-row { display: flex; gap: 6px; }

.plan-create-btn {
    width: 100%;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    padding: 8px; border: none; border-radius: 4px;
    background: #ef6c00; color: #fff; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: background 0.15s; box-sizing: border-box;
}
.plan-create-btn:hover { background: #e65100; }

.plan-search-select {
    flex: 1; padding: 6px 8px; border: 1px solid #ddd; border-radius: 4px;
    font-size: 12px; outline: none; background: #fff;
}

/* ── 목록 카드 ── */
.plan-list-item {
    padding: 10px 12px; border: 1px solid #e8e8e8; border-radius: 8px;
    background: #fff; cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s;
    position: relative; overflow: visible;
}
.plan-list-item:hover { border-color: #90caf9; box-shadow: 0 1px 4px rgba(33,150,243,0.12); }
.plan-list-item:hover > .v2-card-delete-float { display: flex; }
.plan-list-item.done { background: #f9fdf9; border-color: #c8e6c9; }
.plan-list-item-header {
    display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
}
.plan-list-item-title {
    display: flex; align-items: center; gap: 4px; min-width: 0;
    font-size: 13px; font-weight: 600; color: #333;
    flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plan-list-item-title-text {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plan-list-item-title .field-list-item-name-edit { opacity: 0; transition: opacity 0.15s; }
.plan-list-item:hover .plan-list-item-title .field-list-item-name-edit { opacity: 1; }
.plan-list-item-title.editing { display: flex; align-items: center; gap: 4px; }
.plan-list-item-meta {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.plan-list-item-footer { display: flex; justify-content: space-between; font-size: 10px; color: #bbb; }
.plan-list-date { font-size: 10px; color: #bbb; flex-shrink: 0; }

.plan-done-label {
    font-size: 10px; font-weight: 700; color: #2e7d32;
    background: #e8f5e9; padding: 2px 8px; border-radius: 10px;
}

/* ── 뱃지 ── */
.plan-status-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
}
.plan-status-badge.plan     { background: #e3f2fd; color: #1565c0; }
.plan-status-badge.progress { background: #fff3e0; color: #ef6c00; }
.plan-status-badge.done     { background: #e8f5e9; color: #2e7d32; }
.plan-status-badge.cancel   { background: #f5f5f5; color: #999; }

.plan-priority-badge {
    display: inline-block; padding: 2px 6px; border-radius: 3px;
    font-size: 10px; font-weight: 600;
}
.plan-priority-badge.p1 { background: #ffebee; color: #c62828; }
.plan-priority-badge.p2 { background: #fff3e0; color: #e65100; }
.plan-priority-badge.p3 { background: #f5f5f5; color: #666; }
.plan-priority-badge.p4, .plan-priority-badge.p5 { background: #f5f5f5; color: #aaa; }

.pm-pt, .pm-ln, .pm-pg {
    display: inline-block; padding: 1px 6px; border-radius: 3px;
    font-size: 10px; font-weight: 600;
    background: #e3f2fd; color: #1565c0;
}
.pm-empty { font-size: 10px; color: #ccc; }

/* ── 상세 ── */
.plan-detail { display: flex; flex-direction: column; gap: 10px; }

/* 상단 행: 제목 + 버튼 */
.plan-detail-top-row { display: none; }
.plan-detail-top-actions {
    display: flex; gap: 4px; flex-shrink: 0;
}
.plan-action-btn.back {
    background: #f0f0f0; color: #555; border-color: #ddd;
}
.plan-action-btn.back:hover { background: #e0e0e0; border-color: #bbb; color: #333; }

.plan-detail-back {
    display: none;
}
.plan-form-back {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 600; color: #555; cursor: pointer;
    padding: 5px 12px; background: #f0f0f0; border-radius: 6px;
    border: 1px solid #ddd; transition: all 0.15s; align-self: flex-start;
}
.plan-form-back:hover { background: #e0e0e0; color: #222; border-color: #bbb; }

.plan-detail-header { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.plan-detail-title { font-size: 15px; font-weight: 700; color: #222; }
.plan-detail-title-row { display: flex; align-items: center; gap: 8px; }
.plan-detail-date { font-size: 11px; color: #999; }
.plan-detail-desc { font-size: 12px; color: #666; line-height: 1.5; background: #fafafa; padding: 8px 10px; border-radius: 6px; }

/* ── 액션 버튼 ── */
.plan-detail-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.plan-action-btn {
    padding: 5px 12px; border: 1px solid #ddd; border-radius: 5px;
    font-size: 11px; cursor: pointer; background: #fff; color: #555;
    display: inline-flex; align-items: center; gap: 4px; transition: all 0.15s;
}
.plan-action-btn:hover { border-color: #aaa; background: #f5f5f5; }
.plan-action-btn.done { background: #e8f5e9; color: #2e7d32; border-color: #c8e6c9; }
.plan-action-btn.done:hover { background: #c8e6c9; }
.plan-action-btn.revert { background: #e3f2fd; color: #1565c0; border-color: #bbdefb; }
.plan-action-btn.revert:hover { background: #bbdefb; }
.plan-action-btn.delete { color: #e74c3c; border-color: #fdd; }
.plan-action-btn.delete:hover { background: #fff5f5; }
.plan-action-btn.match { color: #3b82f6; border-color: #bfdbfe; }
.plan-action-btn.match:hover { background: #eff6ff; border-color: #93c5fd; }

/* ── 매칭 결과 패널 ── */
.field-match-legend {
    position: absolute; top: 10px; right: 10px;
    z-index: 200; width: 220px;
    background: rgba(255,255,255,0.97); border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    overflow: hidden;
    animation: droneConfirmSlideIn 0.25s ease;
}
.fml-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px 8px;
}
.fml-title {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 700; color: #333;
}
.fml-close {
    width: 22px; height: 22px; border: none; background: none;
    cursor: pointer; color: #bbb; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
}
.fml-close:hover { background: #fee; color: #e53935; }

/* 진행률 바 */
.fml-progress-section { padding: 0 14px 8px; }
.fml-progress-bar {
    height: 8px; background: #f0f0f0; border-radius: 4px;
    overflow: hidden; margin-bottom: 4px;
}
.fml-progress-fill {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, #43a047, #66bb6a);
    transition: width 0.6s ease;
    min-width: 2px;
}
.fml-progress-label {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 10px; color: #888;
}
.fml-pct { font-size: 14px; font-weight: 800; color: #2e7d32; }

/* 통계 */
.fml-stats {
    display: flex; align-items: center; justify-content: center; gap: 16px;
    padding: 8px 14px; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
}
.fml-stat-item {
    display: flex; flex-direction: column; align-items: center;
}
.fml-stat-num { font-size: 20px; font-weight: 800; line-height: 1.1; }
.fml-stat-num small { font-size: 11px; font-weight: 600; }
.fml-stat-item.matched .fml-stat-num { color: #2e7d32; }
.fml-stat-item.unmatched .fml-stat-num { color: #e53935; }
.fml-stat-item.dev .fml-stat-num { color: #ef6c00; }
.fml-stat-label { font-size: 10px; color: #888; margin-top: 1px; }

/* 범례 안내 */
.fml-guide {
    padding: 10px 14px; display: flex; flex-direction: column; gap: 6px;
}
.fml-guide-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; color: #555; line-height: 1.3;
}
.fml-guide-row strong { color: #333; font-weight: 600; }
.fml-dot {
    width: 12px; height: 12px; border-radius: 50%;
    flex-shrink: 0; border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.12);
}
.fml-dot.unmatched-dot {
    background: rgba(229,57,53,0.2);
    border: 2px solid #e53935;
    box-shadow: none;
}
.fml-line-icon {
    width: 20px; height: 0; flex-shrink: 0;
    border-top: 3px dashed #ef6c00;
}

/* 팁 */
.fml-tip {
    padding: 8px 14px; background: #f8fafc;
    border-top: 1px solid #f0f0f0;
    font-size: 10px; color: #999; text-align: center;
}

/* ── 그리기 도구 ── */
.plan-draw-tools {
    display: flex; flex-direction: column; gap: 0;
    padding: 8px 12px; background: #f0f7ff; border-radius: 8px; border: 1px solid #d0e4f5;
}
.plan-draw-row {
    display: flex; align-items: center; gap: 8px;
}
.plan-draw-label { font-size: 11px; color: #555; font-weight: 600; flex-shrink: 0; }
.plan-draw-btns { display: flex; align-items: center; gap: 4px; }
.plan-draw-hint {
    font-size: 10px; color: #90a4ae; margin-top: 4px;
}
.plan-draw-btn {
    width: 34px; height: 34px; min-width: 34px; border: 1px solid #cde; border-radius: 6px;
    background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; flex-shrink: 0;
}
.plan-draw-btn:hover { border-color: #2196F3; background: #e3f2fd; }
.plan-draw-btn.active { border-color: #2196F3; background: #bbdefb; box-shadow: 0 0 0 2px rgba(33,150,243,0.25); }
.plan-draw-btn.cancel { width: auto; min-width: auto; padding: 0 10px; font-size: 11px; color: #e74c3c; border-color: #fdd; gap: 3px; white-space: nowrap; }
.plan-draw-btn.cancel:hover { background: #fff5f5; }

/* ── 도형 추가 안내 메시지 ── */
.plan-draw-guide {
    display: flex; align-items: flex-start; gap: 6px;
    margin-top: 6px; padding: 7px 10px;
    background: #e8f0fe; border-radius: 6px;
    font-size: 11px; color: #1565c0; line-height: 1.5;
}
.plan-draw-guide svg { flex-shrink: 0; margin-top: 1px; }

/* ── 하이라이트 애니메이션 (10초) ── */
.plan-draw-tools.plan-draw-highlight {
    animation: planDrawPulse 1.5s ease-in-out 6;
}
@keyframes planDrawPulse {
    0%   { box-shadow: 0 0 0 0 rgba(33,150,243,0.4); border-color: #d0e4f5; }
    50%  { box-shadow: 0 0 0 6px rgba(33,150,243,0.15); border-color: #2196F3; }
    100% { box-shadow: 0 0 0 0 rgba(33,150,243,0); border-color: #d0e4f5; }
}

/* ── 도형 목록 ── */
.plan-features { display: flex; flex-direction: column; gap: 4px; }
.plan-features-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.plan-features-title { font-size: 12px; font-weight: 700; color: #555; }
.plan-feat-clear-btn {
    padding: 3px 10px; border: 1px solid #fdd; border-radius: 4px;
    background: #fff; color: #e74c3c; font-size: 10px; font-weight: 600;
    cursor: pointer; transition: all 0.15s;
}
.plan-feat-clear-btn:hover { background: #ffebee; }

.plan-feature-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border: 1px solid #eee; border-radius: 6px;
    background: #fff; cursor: pointer; transition: border-color 0.15s;
}
.plan-feature-item:hover { border-color: #90caf9; }
.plan-feature-item.visited { background: #f9fdf9; border-color: #c8e6c9; }
.plan-feature-item.highlight { border-color: #FF6F00; background: #fff8e1; box-shadow: 0 0 0 2px rgba(255,111,0,0.2); }

.plan-feature-icon {
    width: 26px; height: 26px; border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; flex-shrink: 0;
    background: #e3f2fd; color: #1565c0;
}
.plan-feature-info { flex: 1; min-width: 0; }
.plan-feature-name { font-size: 12px; font-weight: 500; color: #333; }
.plan-feature-seq {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 16px; padding: 0 4px;
    background: #1565c0; color: #fff; border-radius: 3px;
    font-size: 10px; font-weight: 700; margin-right: 2px;
}
.plan-feature-memo { font-size: 10px; color: #999; margin-top: 2px; }
.plan-feature-visited { font-size: 10px; color: #2e7d32; margin-top: 2px; }
.plan-feature-actions { display: flex; gap: 3px; flex-shrink: 0; }

.plan-feat-btn {
    width: 22px; height: 22px; border: 1px solid #ddd; border-radius: 4px;
    background: #fff; cursor: pointer; font-size: 11px;
    display: flex; align-items: center; justify-content: center;
}
.plan-feat-btn.del { color: #e74c3c; }
.plan-feat-btn.del:hover { background: #ffebee; border-color: #ef9a9a; }

/* ── 생성/수정 폼 ── */
.plan-form { display: flex; flex-direction: column; gap: 14px; }
.plan-form-title {
    font-size: 15px; font-weight: 700; color: #222;
    padding-bottom: 10px; border-bottom: 2px solid #2196F3;
    display: flex; align-items: center; gap: 6px;
}
.plan-form-group {
    display: flex; flex-direction: column; gap: 4px;
    padding: 0 2px;
}
.plan-form-label {
    font-size: 11px; font-weight: 600; color: #555;
    display: flex; align-items: center; gap: 3px;
}
.plan-form-required { color: #e74c3c; font-weight: 700; }
.plan-form-input {
    padding: 9px 12px; border: 1px solid #e0e0e0; border-radius: 6px;
    font-size: 13px; outline: none; background: #fafafa; box-sizing: border-box;
    transition: border-color 0.2s, background 0.2s;
}
.plan-form-input:focus { border-color: #2196F3; background: #fff; box-shadow: 0 0 0 2px rgba(33,150,243,0.1); }
.plan-form-textarea { resize: vertical; font-family: inherit; min-height: 80px; }
.plan-form-btns {
    display: flex; gap: 8px; justify-content: flex-end; padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}
.plan-form-btn {
    padding: 8px 22px; border: none; border-radius: 6px; font-size: 13px;
    font-weight: 600; cursor: pointer; transition: all 0.15s;
    display: inline-flex; align-items: center; gap: 4px;
}
.plan-form-btn.cancel { background: #f0f0f0; color: #666; border: 1px solid #ddd; }
.plan-form-btn.cancel:hover { background: #e0e0e0; border-color: #bbb; }
.plan-form-btn.ok { background: #2196F3; color: #fff; box-shadow: 0 2px 4px rgba(33,150,243,0.3); }
.plan-form-btn.ok:hover { background: #1976D2; }
