/* 글로벌 변수 및 테마 정의 - 미니멀 & 단색 중심 */
:root {
    --bg-main: #f8fafc;        /* 밝은 슬레이트 그레이 */
    --bg-card: #ffffff;        /* 백색 카드 */
    --bg-input: #f1f5f9;       /* 가벼운 회색 배경 */
    --text-primary: #1e293b;   /* 깊은 다크 그레이 */
    --text-secondary: #64748b; /* 서브 그레이 텍스트 */
    --color-primary: #1e293b;  /* 단정하고 무거운 차콜 */
    --color-primary-hover: #0f172a;
    --color-accent: #475569;   /* 미디엄 차콜 */
    --color-success: #1e293b;  /* 알록달록함 배제하여 통일 */
    --color-danger: #991b1b;   /* 경고용 딥 레드 */
    --color-skip: #94a3b8;     
    --border-radius-lg: 8px;   /* 보다 날렵하고 깔끔한 모서리 */
    --border-radius-md: 4px;
    --transition-speed: 0.15s;
    --font-sans: 'Outfit', 'Noto Sans KR', -apple-system, sans-serif;
}

/* 기본 스타일 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.4;
    min-height: 100vh;
    padding: 1rem 0.5rem;
}

/* 레이아웃 컨테이너 */
.app-container {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* 헤더 스타일 - 알록달록한 그라데이션 제거 및 차분한 단색화 */
.app-header {
    text-align: center;
    margin-bottom: 0.2rem;
}

.app-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

/* 메인 구조 */
.app-main {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* 공통 카드 스타일 - 아주 연한 경계선 및 섀도우 최소화 */
.dropzone-card, .summary-section, .preview-section {
    background-color: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

/* 드롭존 영역 - 단정하고 정갈하게 */
.drop-zone {
    border: 1px dashed #cbd5e1;
    border-radius: var(--border-radius-md);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    background-color: #f8fafc;
}

.drop-zone.dragover {
    border-color: var(--color-primary);
    background-color: #f1f5f9;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

/* 업로드 아이콘 크기 축소 및 단색화 */
.upload-icon {
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
}

.drop-text {
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 500;
}

.drop-text strong {
    color: var(--color-primary);
}

.or-text {
    color: var(--text-secondary);
    font-size: 0.75rem;
    position: relative;
    width: 100%;
    max-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.or-text::before, .or-text::after {
    content: '';
    position: absolute;
    width: 25%;
    height: 1px;
    background-color: #e2e8f0;
    top: 50%;
}

.or-text::before { left: 0; }
.or-text::after { right: 0; }

.file-inputs {
    display: flex;
    gap: 0.5rem;
}

/* 버튼 컴포넌트 - 단색 및 직관적 디자인 */
.btn {
    font-family: var(--font-sans);
    font-weight: 500;
    padding: 0.35rem 0.8rem;
    border-radius: var(--border-radius-md);
    border: 1px solid #cbd5e1;
    cursor: pointer;
    transition: all 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    background-color: #ffffff;
    color: var(--text-primary);
}

.btn:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

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

.btn-primary:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
}

.btn-danger {
    color: var(--color-danger);
    border-color: rgba(153, 27, 27, 0.2);
}

.btn-danger:hover {
    background-color: rgba(153, 27, 27, 0.05);
}

.btn-lg {
    padding: 0.5rem 1.5rem;
    font-size: 0.88rem;
}

.btn-icon {
    width: 14px;
    height: 14px;
}

/* 요약 정보 카드 - 보더 컬러도 흑백톤으로 통일 */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stat-card {
    background-color: #f8fafc;
    border-radius: var(--border-radius-md);
    padding: 0.6rem 0.8rem;
    border: 1px solid #e2e8f0;
    border-left: 3px solid var(--color-accent);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.stat-card.success {
    border-left-color: #334155;
}

.stat-card.skip {
    border-left-color: #94a3b8;
}

.stat-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

/* 프로그레스바 - 그라데이션 제거 및 깔끔한 회색/차콜로 구성 */
.progress-container {
    background-color: #f8fafc;
    padding: 0.6rem 0.8rem;
    border-radius: var(--border-radius-md);
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.progress-bar-bg {
    height: 5px;
    background-color: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background-color: var(--color-primary);
    transition: width 0.1s ease;
}

/* 컨트롤 액션 */
.control-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* 데이터 미리보기 섹션 */
.preview-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.4rem;
}

.section-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
}

.table-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.table-count strong {
    color: var(--text-primary);
}

/* 테이블 컨테이너 - 오밀조밀하게 높이 조절 */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius-md);
    border: 1px solid #e2e8f0;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.75rem;
}

th {
    background-color: #f1f5f9;
    color: var(--text-primary);
    font-weight: 600;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid #cbd5e1;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-secondary);
    white-space: nowrap;
}

tr:hover td {
    background-color: #f8fafc;
    color: var(--text-primary);
}

/* 헤더 타이틀과 카운트 레이아웃 정렬 */
.header-title-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* 테이블 스티키 컬럼 설정 (기록일, 기록시간, 모델명, S/N 고정) */
.table-container th:nth-child(1),
.table-container td:nth-child(1) {
    position: sticky;
    left: 0;
    width: 100px;
    min-width: 100px;
    max-width: 100px;
}

.table-container th:nth-child(2),
.table-container td:nth-child(2) {
    position: sticky;
    left: 100px;
    width: 90px;
    min-width: 90px;
    max-width: 90px;
}

.table-container th:nth-child(3),
.table-container td:nth-child(3) {
    position: sticky;
    left: 190px;
    width: 110px;
    min-width: 110px;
    max-width: 110px;
}

.table-container th:nth-child(4),
.table-container td:nth-child(4) {
    position: sticky;
    left: 300px;
    width: 130px;
    min-width: 130px;
    max-width: 130px;
    border-right: 2px solid #cbd5e1;
}

/* 스티키 열 배경색 정의 (스크롤 시 뒤로 텍스트가 겹쳐 흐르는 것을 막음) */
.table-container th:nth-child(-n+4) {
    background-color: #f1f5f9 !important;
    z-index: 12; /* 테이블 헤더(10)보다 높은 레이어 */
}

.table-container td:nth-child(-n+4) {
    background-color: #ffffff;
    z-index: 5;
}

/* 행 호버 시 고정 열의 배경색도 함께 연동 변경 */
.table-container tr:hover td:nth-child(-n+4) {
    background-color: #f8fafc;
}



/* 반응형 처리 */
@media (max-width: 768px) {
    body {
        padding: 0.25rem 0.1rem;
    }
    .dropzone-card, .summary-section, .preview-section {
        padding: 0.75rem;
    }
    .control-actions {
        flex-direction: column;
        width: 100%;
    }
    .control-actions button {
        width: 100%;
    }
}
