html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    width: 100%;
    overflow: hidden; /* 페이지 자체 스크롤 방지 */
}

:root {
    --sidebar-width: 200px;
}

body {
    background: #f4f4f4;
    font-family: Arial, sans-serif;
}

/* 전체 컨테이너: 뷰포트 딱 맞춤 */
.container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    width: 100vw;
    height: 100vh;
    padding: 14px;
    box-sizing: border-box;
    overflow: hidden;
}

/* 카드: 뷰포트 높이를 꽉 채움 → 이미지 로드해도 크기 안 변함 */
.photo-preview-box {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    padding: 18px 28px 14px;
    box-sizing: border-box;
    overflow: hidden;
}

h2 {
    text-align: center;
    margin: 0 0 14px 0;
    color: #333;
    font-size: 1.3em;
    flex-shrink: 0;
}

/* ── 메인 레이아웃: 사이드바 + 미리보기 ── */
.main-layout {
    display: flex;
    flex-direction: row;
    gap: 20px;
    flex: 1;
    min-height: 0; /* flex 자식이 줄어들 수 있도록 */
    overflow: hidden;
}

/* ── 사이드바 ── */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
}

.section-label {
    font-size: 0.70em;
    color: #bbb;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 7px;
}

/* 업로드 */
.upload-area {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.upload-area.drag-over {
    background-color: #e3f2fd;
    border: 2px dashed #1976d2;
    border-radius: 8px;
}

#photo-input {
    display: none;
}

.upload-btn {
    background: #1976d2;
    color: #fff;
    padding: 11px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    text-align: center;
    transition: background 0.2s;
    box-sizing: border-box;
    width: 100%;
    font-weight: 500;
}

.upload-btn:hover {
    background: #1565c0;
}

/* 사이즈 탭 – 세로 배치 */
.size-tabs {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tab {
    padding: 9px 12px;
    font-size: 0.92em;
    border: none;
    border-radius: 6px;
    background: #e0e0e0;
    color: #333;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.tab.active, .tab:hover {
    background: #1976d2;
    color: #fff;
}

/* 모드 탭 – 세로 배치 */
.print-mode-tabs {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mode-tab {
    padding: 9px 12px;
    font-size: 0.88em;
    border: 2px solid #1976d2;
    border-radius: 6px;
    background: #fff;
    color: #1976d2;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
}

.mode-tab.active, .mode-tab:hover {
    background: #1976d2;
    color: #fff;
}

/* 모드 설명 */
.mode-description {
    margin-top: 7px;
}

.description-text {
    color: #666;
    font-size: 0.76em;
    padding: 6px 9px;
    background: #f8f8f8;
    border-radius: 6px;
    display: block;
    line-height: 1.5;
}

/* 배율 슬라이더 */
.scale-control {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

#scale-slider {
    width: 100%;
    accent-color: #1976d2;
    cursor: pointer;
    height: 4px;
}

.scale-value-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.scale-unit {
    font-size: 0.82em;
    color: #888;
}

#scale-input {
    width: 54px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.88em;
    text-align: center;
    color: #333;
    outline: none;
    transition: border-color 0.2s;
    -moz-appearance: textfield;
    appearance: textfield;
}

#scale-input::-webkit-outer-spin-button,
#scale-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

#scale-input:focus {
    border-color: #1976d2;
}

.scale-reset-btn {
    margin-left: auto;
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #999;
    font-size: 0.9em;
    cursor: pointer;
    padding: 3px 6px;
    line-height: 1;
    transition: all 0.15s;
}

.scale-reset-btn:hover {
    border-color: #1976d2;
    color: #1976d2;
}

/* ── 미리보기 영역 ── */
.preview-area {
    flex: 1;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    border: 1px solid #eee;
    border-radius: 6px;
    background-color: #0b3d0b;
    background-image:
        repeating-linear-gradient(0deg, rgba(0,0,0,0.9) 0 1px, transparent 1px 20px),
        repeating-linear-gradient(90deg, rgba(0,0,0,0.9) 0 1px, transparent 1px 20px);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* 눈금자 안쪽 스크롤 영역 */
.preview-scroll {
    position: absolute;
    top: 28px;
    left: 28px;
    right: 28px;
    bottom: 28px;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ── 인쇄 영역 래퍼 ── */
.print-area-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px;
    flex-shrink: 0;
}

/* ── 인쇄 영역 (실제 사진 프레임) ── */
.print-area {
    overflow: hidden;
    position: relative;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    flex-shrink: 0;
}

.print-area.paper-full {
    cursor: grab;
}

.print-area.paper-full:active,
.print-area.dragging {
    cursor: grabbing;
}

.print-area.image-full {
    cursor: default;
    background: white;
}

/* 사진 이미지 */
.client-preview-img {
    width: 100%;
    height: 100%;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none; /* 드래그는 print-area에서 처리 */
}

/* 드래그 힌트 */
.drag-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: rgba(255,255,255,0.9);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72em;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.4s;
    letter-spacing: 0.02em;
}

/* 미리보기 라벨 (사진 아래) */
.preview-label {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.88em;
    font-weight: 500;
    text-align: center;
}

/* 초기 안내 문구 */
.preview-notice {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.95em;
    text-align: center;
    line-height: 2;
    pointer-events: none;
}

.preview-notice small {
    font-size: 0.85em;
    opacity: 0.8;
}

/* ── 눈금 오버레이: preview-area 4개 가장자리에 항상 고정 ── */
.ruler-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

/* 상단/하단: 좌우 눈금자 사이 (코너는 좌우 눈금자가 차지) */
.ruler-top    { top: 0;    left: 28px; right: 28px; height: 28px; }
.ruler-bottom { bottom: 0; left: 28px; right: 28px; height: 28px; }
/* 좌측/우측: 전체 높이 */
.ruler-left   { left: 0;   top: 0;     bottom: 0;   width: 28px; }
.ruler-right  { right: 0;  top: 0;     bottom: 0;   width: 28px; }

/* ── 광고 영역 ── */
.ad-area {
    flex-shrink: 0;
    width: 100%;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ── 메타 박스 (숨김) ── */
.meta-box { display: none; }

/* ── SEO 설명 텍스트 ── */
.seo-description {
    font-size: 0.85em;
    color: #666;
    line-height: 1.6;
    padding: 10px 4px 4px;
}

/* ── 상태바 ── */
.status-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 16px;
    margin-bottom: 10px;
    font-size: 0.85em;
    color: #444;
    min-height: 32px;
    flex-wrap: wrap;
}
.status-bar:empty::before {
    content: '사진을 업로드하면 품질 정보가 표시됩니다';
    color: #aaa;
}
.status-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 14px;
    border-right: 1px solid #ddd;
}
.status-item:first-child { padding-left: 0; }
.status-item:last-child  { border-right: none; }
.status-label { color: #888; font-weight: 500; }
.status-value { font-weight: 600; color: #222; }
.status-quality { font-weight: 700; }


.download-btn {
    padding: 8px 20px;
    background: #2e7d32;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}

.download-btn:hover {
    background: #1b5e20;
}
