import React, { useState } from 'react';
import {
  FileText, Plus, Search, Calendar, Edit, Eye, Printer,
  CheckCircle, Clock, AlertCircle, X, Save, Trash2,
  Image as ImageIcon, Paperclip, ArrowLeft
} from 'lucide-react';

// ============================================================
// 공통 유틸리티 함수
// ============================================================
const getStatusBadge = (status) => {
  const badges = {
    pending: { label: '대기', class: 'bg-gray-100 text-gray-700' },
    progress: { label: '진행중', class: 'bg-blue-100 text-blue-700' },
    completed: { label: '완료', class: 'bg-green-100 text-green-700' }
  };
  const badge = badges[status] || badges.pending;
  return <span className={`px-2 py-1 rounded text-xs font-medium ${badge.class}`}>{badge.label}</span>;
};

const getResultBadge = (result) => {
  if (!result) return null;
  const badges = {
    pass: { label: '합격', class: 'bg-green-100 text-green-700' },
    fail: { label: '불합격', class: 'bg-red-100 text-red-700' }
  };
  const badge = badges[result];
  return <span className={`px-3 py-1 rounded font-medium ${badge.class}`}>{badge.label}</span>;
};

const getTypeBadge = (type) => {
  const badges = {
    IQC: { label: 'IQC', class: 'bg-blue-100 text-blue-700' },
    PQC: { label: 'PQC', class: 'bg-yellow-100 text-yellow-700' },
    FQC: { label: 'FQC', class: 'bg-green-100 text-green-700' }
  };
  const badge = badges[type];
  return <span className={`px-2 py-1 rounded text-xs font-medium ${badge.class}`}>{badge.label}</span>;
};

// 샘플 검사 데이터
const sampleInspections = [
  { id: 62, type: 'IQC', requestDate: '2025-12-19', itemName: 'EGI 절곡판 1.55T', lotNo: 'MAT-251219-01', status: 'pending', inspector: '-', result: null },
  { id: 61, type: 'PQC', requestDate: '2025-12-19', itemName: '조인트바 (조립)', lotNo: 'WO-251219-05', status: 'progress', inspector: '홍길동', result: null },
  { id: 60, type: 'FQC', requestDate: '2025-12-18', itemName: '방화셔터 완제품', lotNo: 'WO-251218-02', status: 'completed', inspector: '김철수', result: 'pass' },
  { id: 59, type: 'PQC', requestDate: '2025-12-18', itemName: '슬랫 성형품', lotNo: 'WO-251218-01', status: 'completed', inspector: '이영희', result: 'pass' },
  { id: 58, type: 'IQC', requestDate: '2025-12-18', itemName: '스테인레스 코일', lotNo: 'MAT-251218-03', status: 'completed', inspector: '박민수', result: 'fail' }
];

// 검사 항목 샘플 데이터
const sampleInspectionItems = [
  { order: 1, name: '가공상태', standard: '결함 없을 것', inputType: 'radio', value: '양호', result: 'pass' },
  { order: 2, name: '높이 (H)', standard: '16.5 ± 1', inputType: 'number', value: '16.6', result: 'pass', unit: 'mm' },
  { order: 3, name: '길이 (L)', standard: '300 ± 4', inputType: 'number', value: '301', result: 'pass', unit: 'mm' }
];

// ============================================================
// 검사 목록 (InspectionList)
// ============================================================
export const InspectionList = ({ onNavigate }) => {
  const [statusFilter, setStatusFilter] = useState('all');
  const [searchTerm, setSearchTerm] = useState('');

  const filteredData = sampleInspections
    .sort((a, b) => b.id - a.id) // 최신순 정렬
    .filter(item => {
      const matchesStatus = statusFilter === 'all' || item.status === statusFilter;
      const matchesSearch = !searchTerm ||
        item.lotNo.toLowerCase().includes(searchTerm.toLowerCase()) ||
        item.itemName.toLowerCase().includes(searchTerm.toLowerCase());
      return matchesStatus && matchesSearch;
    });

  const statusCounts = {
    all: sampleInspections.length,
    pending: sampleInspections.filter(i => i.status === 'pending').length,
    progress: sampleInspections.filter(i => i.status === 'progress').length,
    completed: sampleInspections.filter(i => i.status === 'completed').length
  };

  return (
    <div className="space-y-6">
      {/* 헤더 */}
      <div className="space-y-3">
        <h1 className="text-xl font-bold text-gray-900 flex items-center gap-2">
          <FileText className="w-6 h-6 text-blue-500" />
          검사 목록
        </h1>
        <div className="flex items-center justify-end">
          <button
            onClick={() => onNavigate('inspection-register')}
            className="flex items-center gap-2 px-4 py-2 bg-black text-white rounded-lg hover:bg-gray-800"
          >
            <Plus className="w-4 h-4" />
            검사 등록
          </button>
        </div>
      </div>

      {/* KPI Cards */}
      <div className="grid grid-cols-4 gap-4">
        <div className="bg-white rounded-xl p-4 border">
          <p className="text-sm text-gray-500 mb-1">금일 대기 건수</p>
          <p className="text-2xl font-bold">{statusCounts.pending} 건</p>
        </div>
        <div className="bg-white rounded-xl p-4 border">
          <p className="text-sm text-gray-500 mb-1">진행 중 검사</p>
          <p className="text-2xl font-bold">{statusCounts.progress} 건</p>
        </div>
        <div className="bg-white rounded-xl p-4 border">
          <p className="text-sm text-gray-500 mb-1">금일 완료 건수</p>
          <p className="text-2xl font-bold">{statusCounts.completed} 건</p>
        </div>
        <div className="bg-white rounded-xl p-4 border">
          <p className="text-sm text-gray-500 mb-1">불량 발생률</p>
          <p className="text-2xl font-bold">0.0%</p>
        </div>
      </div>

      {/* 검색바 */}
      <div className="flex gap-4">
        <div className="flex-1 relative">
          <Search className="absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400" />
          <input
            type="text"
            placeholder="LOT번호, 품목명, 공정명 검색..."
            className="w-full pl-12 pr-4 py-3 border rounded-xl"
            value={searchTerm}
            onChange={(e) => setSearchTerm(e.target.value)}
          />
        </div>
        <div className="flex items-center gap-2 px-4 border rounded-xl bg-white">
          <Calendar className="w-5 h-5 text-gray-400" />
          <span className="text-sm">2025-12-19 ~ 2025-12-19</span>
        </div>
      </div>

      {/* Status Tabs */}
      <div className="flex gap-2">
        <button
          onClick={() => setStatusFilter('all')}
          className={`px-4 py-2 rounded-full text-sm font-medium transition-colors ${
            statusFilter === 'all' ? 'bg-black text-white' : 'bg-gray-100 text-gray-600 hover:bg-gray-200'
          }`}
        >
          전체 {statusCounts.all}
        </button>
        <button
          onClick={() => setStatusFilter('pending')}
          className={`px-4 py-2 rounded-full text-sm font-medium transition-colors ${
            statusFilter === 'pending' ? 'bg-black text-white' : 'bg-gray-100 text-gray-600 hover:bg-gray-200'
          }`}
        >
          대기 {statusCounts.pending}
        </button>
        <button
          onClick={() => setStatusFilter('progress')}
          className={`px-4 py-2 rounded-full text-sm font-medium transition-colors ${
            statusFilter === 'progress' ? 'bg-black text-white' : 'bg-gray-100 text-gray-600 hover:bg-gray-200'
          }`}
        >
          진행중 {statusCounts.progress}
        </button>
        <button
          onClick={() => setStatusFilter('completed')}
          className={`px-4 py-2 rounded-full text-sm font-medium transition-colors ${
            statusFilter === 'completed' ? 'bg-black text-white' : 'bg-gray-100 text-gray-600 hover:bg-gray-200'
          }`}
        >
          완료 {statusCounts.completed}
        </button>
      </div>

      {/* Table */}
      <div className="border rounded-xl overflow-hidden bg-white">
        <table className="w-full text-sm">
          <thead className="bg-gray-50 border-b">
            <tr>
              <th className="text-center px-4 py-3 w-12">
                <input type="checkbox" className="rounded" />
              </th>
              <th className="text-center px-4 py-3 w-20">No</th>
              <th className="text-center px-4 py-3 w-28">검사유형</th>
              <th className="text-center px-4 py-3 w-32">요청일</th>
              <th className="text-left px-4 py-3">품목명</th>
              <th className="text-center px-4 py-3 w-40">LOT NO</th>
              <th className="text-center px-4 py-3 w-28">상태</th>
              <th className="text-center px-4 py-3 w-24">담당자</th>
            </tr>
          </thead>
          <tbody className="divide-y">
            {filteredData.map(item => (
              <tr
                key={item.id}
                className="hover:bg-gray-50 cursor-pointer"
                onClick={() => onNavigate('inspection-detail', item)}
              >
                <td className="text-center px-4 py-3">
                  <input type="checkbox" className="rounded" onClick={(e) => e.stopPropagation()} />
                </td>
                <td className="text-center px-4 py-3 font-medium">{item.id}</td>
                <td className="text-center px-4 py-3">{getTypeBadge(item.type)}</td>
                <td className="text-center px-4 py-3 text-gray-600">{item.requestDate}</td>
                <td className="px-4 py-3 font-medium">{item.itemName}</td>
                <td className="text-center px-4 py-3 text-gray-600 font-mono text-xs">{item.lotNo}</td>
                <td className="text-center px-4 py-3">{getStatusBadge(item.status)}</td>
                <td className="text-center px-4 py-3 text-gray-600">{item.inspector}</td>
              </tr>
            ))}
          </tbody>
        </table>
      </div>
    </div>
  );
};

// ============================================================
// 검사 등록 (InspectionRegister)
// ============================================================
export const InspectionRegister = ({ onNavigate, onSave }) => {
  return (
    <div className="space-y-6">
      {/* 헤더 */}
      <div className="space-y-3">
        <h1 className="text-xl font-bold text-gray-900 flex items-center gap-2">
          <FileText className="w-6 h-6 text-blue-500" />
          검사 등록
        </h1>
        <div className="flex items-center justify-end gap-2">
          <button
            onClick={() => onNavigate('inspection-list')}
            className="px-4 py-2 border rounded-lg hover:bg-gray-50"
          >
            취소
          </button>
          <button
            onClick={onSave}
            className="flex items-center gap-2 px-4 py-2 bg-black text-white rounded-lg hover:bg-gray-800"
          >
            <CheckCircle className="w-4 h-4" />
            검사완료
          </button>
        </div>
      </div>

      {/* 검사 개요 */}
      <div className="border rounded-xl bg-white">
        <div className="p-4 border-b bg-gray-50">
          <h4 className="font-medium">검사 개요</h4>
        </div>
        <div className="p-6">
          <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-4">
            <div>
              <label className="block text-sm font-medium mb-1">LOT NO (자동)</label>
              <input
                type="text"
                value="WO-251219-05"
                disabled
                className="w-full px-3 py-2 border rounded-lg bg-gray-50 text-gray-600"
              />
            </div>
            <div>
              <label className="block text-sm font-medium mb-1">품목명 (자동)</label>
              <input
                type="text"
                value="조인트바"
                disabled
                className="w-full px-3 py-2 border rounded-lg bg-gray-50 text-gray-600"
              />
            </div>
            <div>
              <label className="block text-sm font-medium mb-1">공정명 (자동)</label>
              <input
                type="text"
                value="조립 공정"
                disabled
                className="w-full px-3 py-2 border rounded-lg bg-gray-50 text-gray-600"
              />
            </div>
            <div>
              <label className="block text-sm font-medium mb-1">수량</label>
              <input
                type="text"
                value="50 EA"
                disabled
                className="w-full px-3 py-2 border rounded-lg bg-gray-50 text-gray-600"
              />
            </div>
          </div>
          <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
            <div>
              <label className="block text-sm font-medium mb-1">작업자 *</label>
              <input
                type="text"
                value="홍길동"
                className="w-full px-3 py-2 border rounded-lg"
              />
            </div>
            <div>
              <label className="block text-sm font-medium mb-1">특이사항</label>
              <input
                type="text"
                placeholder="특이사항 입력"
                className="w-full px-3 py-2 border rounded-lg"
              />
            </div>
          </div>
        </div>
      </div>

      {/* 검사 기준 및 도해 */}
      <div className="border rounded-xl bg-white">
        <div className="p-4 border-b bg-gray-50">
          <h4 className="font-medium">검사 기준 및 도해</h4>
        </div>
        <div className="p-6">
          <div className="h-64 border-2 border-dashed rounded-lg flex items-center justify-center bg-gray-50">
            <div className="text-center text-gray-400">
              <ImageIcon className="w-12 h-12 mx-auto mb-2" />
              <p className="text-sm">템플릿에서 설정한 조인트바 표준 도면이 표시됨</p>
            </div>
          </div>
        </div>
      </div>

      {/* 검사 데이터 입력 */}
      <div className="border rounded-xl bg-white">
        <div className="p-4 border-b bg-gray-50">
          <h4 className="font-medium">검사 데이터 입력</h4>
          <p className="text-xs text-gray-500 mt-1">* 측정값을 입력하면 판정이 자동 처리됩니다.</p>
        </div>
        <div className="p-6 space-y-4">
          {sampleInspectionItems.map(item => (
            <div key={item.order} className="border rounded-lg p-4 bg-gray-50">
              <div className="flex items-center justify-between mb-3">
                <h5 className="font-medium">{item.order}. {item.name}</h5>
                <span className="px-3 py-1 bg-green-100 text-green-700 rounded text-sm font-medium">
                  판정: 적합
                </span>
              </div>
              <div className="grid grid-cols-2 gap-4">
                <div>
                  <label className="block text-sm font-medium mb-1">기준(Spec)</label>
                  <input
                    type="text"
                    value={item.standard}
                    disabled
                    className="w-full px-3 py-2 border rounded-lg bg-white text-gray-600"
                  />
                </div>
                <div>
                  <label className="block text-sm font-medium mb-1">
                    {item.inputType === 'radio' ? '결과 입력 *' : `측정값 입력 ${item.unit ? `(${item.unit})` : ''} *`}
                  </label>
                  {item.inputType === 'radio' ? (
                    <div className="flex gap-4 items-center h-[42px]">
                      <label className="flex items-center gap-2">
                        <input type="radio" name={`item-${item.order}`} defaultChecked className="w-4 h-4" />
                        <span className="text-sm">양호</span>
                      </label>
                      <label className="flex items-center gap-2">
                        <input type="radio" name={`item-${item.order}`} className="w-4 h-4" />
                        <span className="text-sm">불량</span>
                      </label>
                    </div>
                  ) : (
                    <input
                      type="number"
                      defaultValue={item.value}
                      className="w-full px-3 py-2 border rounded-lg"
                    />
                  )}
                </div>
              </div>
            </div>
          ))}
        </div>
      </div>
    </div>
  );
};

// ============================================================
// 검사 상세 (InspectionDetail)
// ============================================================
export const InspectionDetail = ({ inspection, onNavigate }) => {
  const selectedInspection = inspection || sampleInspections[1];

  return (
    <div className="space-y-6">
      {/* 헤더 */}
      <div className="space-y-3">
        <div className="flex items-center gap-4">
          <h1 className="text-xl font-bold text-gray-900 flex items-center gap-2">
            <FileText className="w-6 h-6 text-blue-500" />
            검사 상세
          </h1>
          <div className="flex items-center gap-2 text-sm text-gray-500">
            <span className="font-mono">QC-251219-05</span>
            {getResultBadge('pass')}
          </div>
        </div>
        <div className="flex items-center justify-between">
          {/* 좌측: 문서 버튼 */}
          <div className="flex items-center gap-2">
            <button className="flex items-center gap-1 px-3 py-1.5 text-sm border rounded hover:bg-gray-50">
              <Printer className="w-4 h-4" /> 성적서
            </button>
          </div>
          {/* 우측: 액션 버튼 */}
          <div className="flex items-center gap-2">
            <button
              onClick={() => onNavigate('inspection-list')}
              className="flex items-center gap-1 px-4 py-2 border rounded hover:bg-gray-50"
            >
              목록
            </button>
            <button
              onClick={() => onNavigate('inspection-edit', selectedInspection)}
              className="flex items-center gap-2 px-4 py-2 bg-black text-white rounded-lg hover:bg-gray-800"
            >
              <Edit className="w-4 h-4" />
              수정
            </button>
          </div>
        </div>
      </div>

      {/* 검사 정보 */}
      <div className="border rounded-xl bg-white">
        <div className="p-4 border-b bg-gray-50">
          <h4 className="font-medium">검사 정보</h4>
        </div>
        <div className="p-6">
          <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
            <div>
              <p className="text-sm text-gray-500 mb-1">검사번호</p>
              <p className="font-medium">QC-251219-05</p>
            </div>
            <div>
              <p className="text-sm text-gray-500 mb-1">검사유형</p>
              <p className="font-medium">공정검사 (PQC)</p>
            </div>
            <div>
              <p className="text-sm text-gray-500 mb-1">검사일자</p>
              <p className="font-medium">2025-12-19</p>
            </div>
            <div>
              <p className="text-sm text-gray-500 mb-1">판정결과</p>
              <p className="font-bold text-green-600">합격</p>
            </div>
            <div>
              <p className="text-sm text-gray-500 mb-1">품목명</p>
              <p className="font-medium">조인트바</p>
            </div>
            <div>
              <p className="text-sm text-gray-500 mb-1">LOT NO</p>
              <p className="font-medium font-mono text-sm">WO-251219-05</p>
            </div>
            <div>
              <p className="text-sm text-gray-500 mb-1">공정명</p>
              <p className="font-medium">조립 공정</p>
            </div>
            <div>
              <p className="text-sm text-gray-500 mb-1">검사자</p>
              <p className="font-medium">홍길동</p>
            </div>
          </div>
        </div>
      </div>

      {/* 검사 결과 데이터 */}
      <div className="border rounded-xl bg-white">
        <div className="p-4 border-b bg-gray-50">
          <h4 className="font-medium">검사 결과 데이터</h4>
        </div>
        <div className="overflow-x-auto">
          <table className="w-full text-sm">
            <thead className="bg-gray-50 border-b">
              <tr>
                <th className="text-left px-4 py-3">항목명</th>
                <th className="text-left px-4 py-3">기준(Spec)</th>
                <th className="text-left px-4 py-3">측정값/결과</th>
                <th className="text-center px-4 py-3 w-32">판정</th>
              </tr>
            </thead>
            <tbody className="divide-y">
              {sampleInspectionItems.map(item => (
                <tr key={item.order}>
                  <td className="px-4 py-3 font-medium">{item.name}</td>
                  <td className="px-4 py-3 text-gray-600">{item.standard}</td>
                  <td className="px-4 py-3">{item.value} {item.unit || ''}</td>
                  <td className="px-4 py-3 text-center">
                    <span className="px-2 py-1 bg-green-100 text-green-700 rounded text-xs font-medium">
                      적합
                    </span>
                  </td>
                </tr>
              ))}
            </tbody>
          </table>
        </div>
      </div>

      {/* 종합 의견 */}
      <div className="border rounded-xl bg-white">
        <div className="p-4 border-b bg-gray-50">
          <h4 className="font-medium">종합 의견</h4>
        </div>
        <div className="p-6">
          <p className="text-gray-700">특이사항 없음. 후공정(포장) 인계 완료함.</p>
        </div>
      </div>

      {/* 첨부 파일 */}
      <div className="border rounded-xl bg-white">
        <div className="p-4 border-b bg-gray-50">
          <h4 className="font-medium">첨부 파일</h4>
        </div>
        <div className="p-6">
          <div className="flex items-center gap-2 text-sm text-blue-600 hover:underline cursor-pointer">
            <Paperclip className="w-4 h-4" />
            현장_검사_사진_01.jpg
          </div>
        </div>
      </div>
    </div>
  );
};

// ============================================================
// 검사 수정 (InspectionEdit)
// ============================================================
export const InspectionEdit = ({ inspection, onNavigate, onSave }) => {
  const selectedInspection = inspection || sampleInspections[1];

  return (
    <div className="space-y-6">
      {/* 헤더 */}
      <div className="space-y-3">
        <h1 className="text-xl font-bold text-gray-900 flex items-center gap-2">
          <FileText className="w-6 h-6 text-blue-500" />
          검사 수정
        </h1>
        <div className="flex items-center justify-end gap-2">
          <button
            onClick={() => onNavigate('inspection-detail', selectedInspection)}
            className="px-4 py-2 border rounded-lg hover:bg-gray-50"
          >
            취소
          </button>
          <button
            onClick={onSave}
            className="flex items-center gap-2 px-4 py-2 bg-black text-white rounded-lg hover:bg-gray-800"
          >
            <CheckCircle className="w-4 h-4" />
            수정 완료
          </button>
        </div>
      </div>

      {/* 검사 개요 (비활성) */}
      <div className="border rounded-xl bg-white">
        <div className="p-4 border-b bg-gray-50">
          <h4 className="font-medium">검사 개요 (수정 불가)</h4>
        </div>
        <div className="p-6">
          <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
            <div>
              <label className="block text-sm font-medium mb-1">LOT NO (비활성)</label>
              <input
                type="text"
                value="WO-251219-05"
                disabled
                className="w-full px-3 py-2 border rounded-lg bg-gray-100 text-gray-600"
              />
            </div>
            <div>
              <label className="block text-sm font-medium mb-1">품목명 (비활성)</label>
              <input
                type="text"
                value="조인트바"
                disabled
                className="w-full px-3 py-2 border rounded-lg bg-gray-100 text-gray-600"
              />
            </div>
            <div>
              <label className="block text-sm font-medium mb-1">공정명 (비활성)</label>
              <input
                type="text"
                value="조립 공정"
                disabled
                className="w-full px-3 py-2 border rounded-lg bg-gray-100 text-gray-600"
              />
            </div>
            <div>
              <label className="block text-sm font-medium mb-1">수량 (비활성)</label>
              <input
                type="text"
                value="50 EA"
                disabled
                className="w-full px-3 py-2 border rounded-lg bg-gray-100 text-gray-600"
              />
            </div>
          </div>
        </div>
      </div>

      {/* 수정 사유 */}
      <div className="border rounded-xl bg-white">
        <div className="p-4 border-b bg-gray-50">
          <h4 className="font-medium">수정 사유 (필수 ★)</h4>
        </div>
        <div className="p-6">
          <label className="block text-sm font-medium mb-1">사유 입력 *</label>
          <textarea
            rows={3}
            placeholder="수정 사유를 입력하세요 (예: 오기입 수정, 높이 측정값 입력 오류)"
            className="w-full px-3 py-2 border rounded-lg"
          />
        </div>
      </div>

      {/* 검사 데이터 수정 */}
      <div className="border rounded-xl bg-white">
        <div className="p-4 border-b bg-gray-50">
          <h4 className="font-medium">검사 데이터 수정</h4>
        </div>
        <div className="p-6 space-y-4">
          {sampleInspectionItems.map(item => (
            <div key={item.order} className="border rounded-lg p-4 bg-gray-50">
              <div className="flex items-center justify-between mb-3">
                <h5 className="font-medium">{item.order}. {item.name}</h5>
                <span className="px-3 py-1 bg-green-100 text-green-700 rounded text-sm font-medium">
                  판정: 적합
                </span>
              </div>
              <div className="grid grid-cols-2 gap-4">
                <div>
                  <label className="block text-sm font-medium mb-1">기준(Spec)</label>
                  <input
                    type="text"
                    value={item.standard}
                    disabled
                    className="w-full px-3 py-2 border rounded-lg bg-white text-gray-600"
                  />
                </div>
                <div>
                  <label className="block text-sm font-medium mb-1">
                    {item.inputType === 'radio' ? '결과 입력 *' : `측정값 입력 ${item.unit ? `(${item.unit})` : ''} *`}
                  </label>
                  {item.inputType === 'radio' ? (
                    <div className="flex gap-4 items-center h-[42px]">
                      <label className="flex items-center gap-2">
                        <input type="radio" name={`item-edit-${item.order}`} defaultChecked className="w-4 h-4" />
                        <span className="text-sm">양호</span>
                      </label>
                      <label className="flex items-center gap-2">
                        <input type="radio" name={`item-edit-${item.order}`} className="w-4 h-4" />
                        <span className="text-sm">불량</span>
                      </label>
                    </div>
                  ) : (
                    <div>
                      <input
                        type="number"
                        defaultValue={item.value}
                        className="w-full px-3 py-2 border rounded-lg border-blue-500"
                      />
                      {item.order === 2 && (
                        <p className="text-xs text-blue-600 mt-1">👆 (166으로 잘못 쓴걸 16.6으로 수정)</p>
                      )}
                    </div>
                  )}
                </div>
              </div>
            </div>
          ))}
        </div>
      </div>
    </div>
  );
};

// ============================================================
// 레거시 호환성을 위한 기본 export (사용 안 함)
// ============================================================
const InspectionManagement = () => {
  console.warn('InspectionManagement: Use individual components (InspectionList, InspectionRegister, InspectionDetail, InspectionEdit) instead');
  return null;
};

export default InspectionManagement;
