@import "./color.css";

:root {
    --bg-gradient: linear-gradient(135deg, #FFF5F1 0%, #E0F2FF 100%);
}

/* 기본 스타일 */
body {
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
}

/* 헤더 중앙 정렬 */
.navbar {
    background: white;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.nav-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo-text {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-main);
    white-space: nowrap;
}

/* 컨테이너 및 카드 */
.container {
    padding: 40px 20px;
    display: flex;
    justify-content: center;
}

.card {
    background: var(--bg-component);
    width: 100%;
    max-width: 520px;
    border-radius: 20px;
    padding: 35px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.wide-card {
    max-width: 800px;
}

/* 타이틀 및 배지 */
.view-title {
    text-align: left;
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    background: var(--brand-bg);
    color: var(--brand-main);
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

/* 입력 필드 및 버튼 */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#fileName {
    flex: 1;
    padding: 12px;
    border: 1.5px solid var(--border-default);
    border-radius: 10px;
    font-size: 14px;
}

.btn-primary {
    padding: 0 30px;
    background: var(--brand-main);
    color: var(--text-contrast);
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

/* 버튼 스타일 */
.btn-main {
    width: 100%;
    background: var(--brand-main);
    color: var(--text-contrast);
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.blue-dark {
    background: var(--contrast-main);
}

.btn-reset {
    width: 100%;
    background: var(--bg-soft);
    color: var(--text-sub);
    border: none;
    padding: 14px;
    border-radius: 10px;
    margin-top: 20px;
    cursor: pointer;
    font-weight: 600;
}

.action-bar {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.action-bar .btn-main,
.action-bar .btn-reset {
    flex: 1;
    margin-top: 0;
    margin-bottom: 0;
}

/* 테이블 스타일 */
.table-scroll {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid var(--border-default);
    border-radius: 12px;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

tbody tr {
    background: white;
}

th {
    background: var(--brand-main);
    padding: 12px;
    font-size: 13px;
    color: white;
    position: sticky;
    top: 0;
    font-weight: 600;
}

td {
    padding: 12px 15px;
    border-top: 1px solid var(--border-default);
    font-size: 14px;
    background: white;
}

td[contenteditable="true"] {
    background: white;
    cursor: text;
    border-radius: 4px;
}

td[contenteditable="true"]:focus {
    outline: 2px solid var(--brand-main);
    background: var(--brand-sub);
}

/* A4 용지 규격 및 여백 (상하좌우 7mm) */
.a4-page {
    width: 210mm;
    height: 297mm;
    background: white;
    padding: 7mm;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 98mm 98mm;
    grid-template-rows: repeat(6, 47mm);
    gap: 0;
    justify-content: center;
    align-content: center;
}

/* 개별 라벨 박스 ($98mm x $47mm) */
.label-item {
    width: 98mm;
    height: 47mm;
    border: 0.1mm solid var(--border-default);
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

/* 1. 수취인 타이틀 (상단 왼쪽 구석) */
.label-recipient {
    position: absolute;
    top: 6mm;
    left: calc(6mm - 2px);
    color: var(--brand-main);
    font-weight: 700;
    font-size: 16px;
}

/* 2. 주소 + 이름 그룹 (중앙 영역, 들여쓰기 적용) */
.label-group {
    position: absolute;
    top: 16mm;
    left: calc(7mm - 3px);
    display: flex;
    flex-direction: column;
    gap: 2mm;
}

.label-addr {
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.4;
    width: 75mm;
}

.label-name {
    font-size: 18px;
    font-weight: 900;
    color: var(--text-main);
}

/* 3. 우편번호 (우측 하단 구석) */
.label-footer {
    position: absolute;
    bottom: 6mm;
    right: 8mm;
    display: flex;
    gap: 3px;
}

.zip-box {
    width: 20px;
    height: 25px;
    background: var(--brand-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-main);
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    overflow: auto;
}

.modal-content {
    background: var(--bg-component);
    margin: 3% auto;
    padding: 30px;
    border-radius: 20px;
    width: fit-content;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
    padding-bottom: 10px;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--border-default);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.close {
    color: var(--text-main);
    font-size: 35px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    display: flex;
    justify-content: center;
    padding: 8px 0 15px 0;
}

/* 모달 페이지 네비게이션 */
.modal-pagination {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    padding: 15px 0;
}

.btn-prev,
.btn-next {
    background: var(--brand-main);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: 600;
    font-size: 20px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-prev:hover,
.btn-next:hover {
    background: var(--brand-main);
    transform: scale(1.15);
}

.page-numbers {
    display: flex;
    gap: 10px;
}

.page-num {
    background: transparent;
    color: var(--text-sub);
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    font-size: 15px;
}

.page-num:hover {
    color: var(--brand-main);
}

.page-num.active {
    color: var(--brand-main);
    font-weight: 700;
}

/* 모달 액션 */
.modal-actions {
    display: flex;
    margin-top: 20px;
}

.btn-download {
    background: var(--brand-main);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-download:hover {
    background: var(--brand-main);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(53, 114, 239, 0.3);
}

/* 로딩 오버레이 */
.loading-overlay {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 20px;
}

.loading-dots p {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    letter-spacing: 2px;
}

.dots {
    display: inline-block;
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

.loading-overlay p {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}