/* 전역 설정 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #667eea;
  --secondary-color: #50c878;
  --danger-color: #e74c3c;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.25);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  --text-color: #2d3436;
  --text-light: #ffffff;
  --text-muted: #636e72;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "맑은 고딕", Arial, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-color);
  overflow: hidden;
  min-height: 100vh;
  width: 100%;
  height: 100vh;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* 상단 헤더 */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  gap: 15px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.header-left h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-light);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 용지/배경색 선택기 */
.paper-selector,
.bg-color-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 15px;
  border-radius: 10px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.resolution-selector label,
.paper-selector label,
.bg-color-selector label {
  color: var(--text-light);
  font-weight: 600;
  font-size: 13px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.paper-selector select {
  padding: 6px 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-color);
  cursor: pointer;
  transition: all 0.3s ease;
}

.paper-selector select:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.bg-color-selector input[type="color"] {
  width: 40px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.bg-color-selector input[type="color"]:hover {
  transform: scale(1.1);
}

.info-icon {
  cursor: help;
  font-size: 16px;
  opacity: 0.8;
}

/* 여백 설정 */
.margin-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 8px 15px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.margin-selector label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.margin-selector input[type="number"] {
  width: 55px;
  padding: 6px 8px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-color);
  text-align: center;
  transition: all 0.3s ease;
}

.margin-selector input[type="number"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
  transform: translateY(-1px);
}

.margin-selector .unit {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 파일 입력 그룹 */
.file-input-group {
  display: flex;
  gap: 8px;
}

.btn-file {
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s ease;
  display: inline-block;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-file:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-file input[type="file"] {
  display: none;
}

/* 내보내기 버튼 그룹 */
.export-buttons {
  display: flex;
  gap: 8px;
}

.btn-export {
  width: 44px;
  height: 44px;
  padding: 0;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.btn-export:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* 메인 컨텐츠 */
.main-content {
  margin-top: 70px;
  display: flex;
  height: calc(100vh - 70px);
  gap: 10px;
  padding: 8px;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* 왼쪽 컨트롤 패널 */
.control-panel {
  width: 220px;
  padding: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  border-radius: 12px;
  max-height: 100%;
}

.control-section {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.control-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.control-section h3 {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-light);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.form-group {
  margin-bottom: 6px;
}

.form-group label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 3px;
}

.form-group select,
.form-group input[type="number"] {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  color: var(--text-light);
  transition: all 0.3s ease;
}

.form-group select:focus,
.form-group input[type="number"]:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.checkbox-option label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.checkbox-option input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

/* 슬라이더 스타일 */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  outline: none;
  transition: all 0.3s ease;
  margin: 4px 0;
}

.slider:hover {
  background: rgba(255, 255, 255, 0.4);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--primary-color);
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb:hover {
  background: #7c92f5;
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--primary-color);
  cursor: pointer;
  border-radius: 50%;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.slider::-moz-range-thumb:hover {
  background: #7c92f5;
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.small-input {
  width: 50px !important;
  display: inline-block;
  margin-left: 6px;
  padding: 2px 4px !important;
  font-size: 10px !important;
  text-align: center;
}

.form-group label span {
  color: var(--secondary-color);
  font-weight: 700;
  min-width: 30px;
  display: inline-block;
  text-align: right;
}

button {
  width: 100%;
  padding: 6px;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 5px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary {
  background: rgba(80, 200, 120, 0.4);
  color: var(--text-light);
  box-shadow: 0 3px 10px rgba(80, 200, 120, 0.2);
}

.btn-secondary:hover {
  background: rgba(80, 200, 120, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(80, 200, 120, 0.3);
}

.btn-danger {
  background: rgba(231, 76, 60, 0.4);
  color: var(--text-light);
  box-shadow: 0 3px 10px rgba(231, 76, 60, 0.2);
}

.btn-danger:hover {
  background: rgba(231, 76, 60, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3);
}

/* 워터마크 섹션 스타일 */
.watermark-section {
  background: rgba(102, 126, 234, 0.1);
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.watermark-section h3 {
  font-size: 11px;
  margin-bottom: 6px;
  color: var(--text-light);
}

/* 접기/펼치기 스타일 */
.collapsible-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  transition: all 0.3s ease;
}

.collapsible-header:hover {
  color: rgba(255, 255, 255, 1);
  text-shadow: 0 0 10px rgba(102, 126, 234, 0.6);
}

.toggle-icon {
  display: inline-block;
  font-size: 10px;
  transition: transform 0.3s ease;
}

.collapsible-header.active .toggle-icon {
  transform: rotate(90deg);
}

.collapsible-content {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  max-height: 0;
}

.collapsible-content.active {
  opacity: 1;
  max-height: 1000px;
  margin-top: 6px;
}

/* 위치 컨트롤 스타일 */
.position-control {
  position: relative;
}

.position-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.position-row .slider {
  flex: 1;
}

.btn-reset-position {
  width: 24px;
  height: 24px;
  padding: 0;
  background: rgba(102, 126, 234, 0.6);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.btn-reset-position:hover {
  background: rgba(102, 126, 234, 0.9);
  transform: scale(1.15) rotate(180deg);
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.6);
}

.btn-reset-position:active {
  transform: scale(0.95) rotate(180deg);
}

.btn-file-small {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(102, 126, 234, 0.5);
  color: white;
  border-radius: 6px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
}

.btn-file-small:hover {
  background: rgba(102, 126, 234, 0.7);
  transform: translateY(-1px);
}

.btn-clear-small {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(231, 76, 60, 0.5);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  margin-left: 5px;
}

.btn-clear-small:hover {
  background: rgba(231, 76, 60, 0.7);
  transform: translateY(-1px);
}

.watermark-preview {
  width: 100%;
  height: 60px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  margin: 5px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.watermark-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.watermark-preview:empty::before {
  content: '이미지 없음';
  color: rgba(255, 255, 255, 0.5);
  font-size: 9px;
}

/* 전체 초기화 버튼 */
.btn-reset-all {
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(255, 100, 100, 0.6), rgba(255, 50, 50, 0.7));
  border: 2px solid rgba(255, 100, 100, 0.8);
  border-radius: 10px;
  color: white;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  box-shadow: 0 4px 10px rgba(255, 50, 50, 0.3);
}

.btn-reset-all:hover {
  background: linear-gradient(135deg, rgba(255, 50, 50, 0.7), rgba(255, 0, 0, 0.8));
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(255, 50, 50, 0.5);
}

.btn-reset-all:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(255, 50, 50, 0.4);
}

/* 도형 섹션 스타일 */
.shape-section {
  background: rgba(80, 200, 120, 0.1);
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.shape-section h3 {
  font-size: 11px;
  margin-bottom: 6px;
  color: var(--text-light);
}

/* 도형 선택기 */
.shape-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 5px 0;
}

.shape-btn {
  width: 100%;
  aspect-ratio: 1;
  padding: 8px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
}

.shape-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(80, 200, 120, 0.5);
}

.shape-btn.active {
  background: rgba(80, 200, 120, 0.6);
  border-color: rgba(80, 200, 120, 0.8);
  box-shadow: 0 0 20px rgba(80, 200, 120, 0.6);
  transform: scale(1.05);
}

/* 색상 선택기 */
.color-picker {
  width: 100%;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.color-picker:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(80, 200, 120, 0.5);
}

/* 도형 미리보기 */
.shape-preview {
  width: 100%;
  height: 60px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  margin: 5px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
}

.shape-preview .shape-display {
  transition: all 0.3s ease;
}

.shape-preview:empty::before {
  content: '도형 선택';
  color: rgba(255, 255, 255, 0.5);
  font-size: 9px;
}

/* 레이어 선택기 */
.layer-selector {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
}

.layer-selector:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(80, 200, 120, 0.5);
}

.layer-selector:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 10px rgba(80, 200, 120, 0.4);
}

.layer-selector option {
  background: rgba(30, 30, 50, 0.95);
  color: var(--text-light);
  padding: 8px;
}

/* 레이어는 동적으로 z-index 설정되므로 기본 스타일만 정의 */
.watermark-layer,
.shape-layer {
  position: absolute;
  pointer-events: none;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.9);
}

.checkbox-inline input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

/* 미리보기 패널 */
.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 100%;
}

.preview-header {
  padding: 12px 20px;
  border-radius: 20px 20px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  min-height: 50px;
}

.preview-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-light);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.page-info {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 12px;
  border-radius: 14px;
  backdrop-filter: blur(5px);
}

.preview-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0 0 20px 20px;
  max-height: calc(100% - 50px);
}

.empty-preview {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 15px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* 용지 스타일 */
.paper-page {
  background: white;
  margin: 0 auto 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: visible;
}

/* 워터마크 레이어 - 각 이미지 내부에 위치 */
.watermark-layer {
  position: absolute;
  pointer-events: none;
}

.watermark-layer.watermark-1 {
  z-index: 3;
}

.watermark-layer.watermark-2 {
  z-index: 2;
}

.watermark-layer img {
  display: block;
  object-fit: contain;
}

.paper-A4 { width: 210mm; height: 297mm; }
.paper-A3 { width: 297mm; height: 420mm; }
.paper-A5 { width: 148mm; height: 210mm; }

.paper-A4.landscape { width: 297mm; height: 210mm; }
.paper-A3.landscape { width: 420mm; height: 297mm; }
.paper-A5.landscape { width: 210mm; height: 148mm; }

.paper-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 정렬 스타일 */
.paper-page.center .paper-content {
  justify-content: center;
}

.paper-page.top .paper-content {
  justify-content: flex-start;
}

.paper-page.bottom .paper-content {
  justify-content: flex-end;
}

.paper-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.paper-image-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.paper-image {
  position: relative;
  display: inline-block;
  overflow: hidden;
  transform-origin: center center;
  flex-shrink: 0;
}

.paper-image.with-border {
  border: 1px solid #e0e0e0;
  box-sizing: border-box;
}

/* 절취선 스타일 - 최상단 레이어 */
.cut-line {
  position: absolute;
  pointer-events: none;
  border-color: #999;
  border-style: dashed;
  border-width: 0;
  z-index: 100;
}

.cut-line-tl {
  top: 0;
  left: 0;
  width: 10mm;
  height: 10mm;
  border-top-width: 1px;
  border-left-width: 1px;
}

.cut-line-tr {
  top: 0;
  right: 0;
  width: 10mm;
  height: 10mm;
  border-top-width: 1px;
  border-right-width: 1px;
}

.cut-line-bl {
  bottom: 0;
  left: 0;
  width: 10mm;
  height: 10mm;
  border-bottom-width: 1px;
  border-left-width: 1px;
}

.cut-line-br {
  bottom: 0;
  right: 0;
  width: 10mm;
  height: 10mm;
  border-bottom-width: 1px;
  border-right-width: 1px;
}

.page-number {
  position: absolute;
  bottom: 5mm;
  right: 5mm;
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 8px;
  border-radius: 4px;
}

/* 오른쪽 이미지 목록 패널 */
.image-list-panel {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-radius: 15px;
  overflow: hidden;
  max-height: 100%;
}

.image-list-panel .panel-header {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.image-list-panel .panel-header h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 8px;
}

.btn-toggle-all {
  padding: 4px 10px;
  font-size: 11px;
  background: rgba(80, 200, 120, 0.4);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
}

.btn-toggle-all:hover {
  background: rgba(80, 200, 120, 0.6);
  transform: scale(1.05);
}

.btn-clear-images {
  padding: 6px 10px;
  font-size: 14px;
  background: rgba(255, 100, 100, 0.4);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-clear-images:hover {
  background: rgba(255, 50, 50, 0.6);
  transform: scale(1.1);
}

.btn-select-all {
  padding: 4px 10px;
  font-size: 11px;
  background: rgba(102, 126, 234, 0.4);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: auto;
  margin: 0;
}

.btn-select-all:hover {
  background: rgba(102, 126, 234, 0.6);
  transform: scale(1.05);
}

.image-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 8px;
  border-radius: 8px;
}

.image-list-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
}

.image-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-state {
  text-align: center;
  padding: 30px 15px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

/* 이미지 아이템 - 기본 스타일 */
.image-item {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 6px;
  transition: all 0.3s ease;
  cursor: move;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  user-select: none;
}

.image-item:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* 드래그 중인 이미지 */
.image-item.dragging {
  opacity: 0.5;
  transform: scale(0.95);
  cursor: grabbing;
}

/* 드래그 오버 영역 */
.image-item.drag-over {
  border-color: rgba(80, 200, 120, 0.8);
  background: rgba(80, 200, 120, 0.2);
  transform: translateY(-4px);
}

/* 숨김(미선택) 이미지 - 매우 명확하게 */
.image-item.hidden-image {
  opacity: 0.45;
  background: linear-gradient(135deg, rgba(50, 50, 50, 0.4), rgba(80, 50, 50, 0.3));
  border: 4px solid rgba(231, 76, 60, 1);
  box-shadow: 0 0 20px rgba(231, 76, 60, 0.5), 
              0 0 35px rgba(231, 76, 60, 0.3),
              0 4px 15px rgba(0, 0, 0, 0.3);
}

.image-item.hidden-image::before {
  content: '✕ 숨김';
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(231, 76, 60, 0.95);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  z-index: 15;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.image-item.hidden-image .image-preview {
  opacity: 0.35;
  filter: grayscale(1) brightness(0.5) contrast(0.8);
  border: 3px solid rgba(231, 76, 60, 0.6);
}

.image-item.hidden-image .image-name {
  text-decoration: line-through;
  opacity: 0.6;
}

.image-item.hidden-image::after {
  content: '🚫 숨김';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(231, 76, 60, 0.9);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.image-item.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.image-checkbox {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(5px);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  padding: 3px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.image-checkbox:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
}

.image-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin: 0;
  accent-color: var(--primary-color);
}

.image-preview {
  width: 100%;
  height: 100px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  margin-bottom: 6px;
}

.image-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.size-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.size-inputs input {
  flex: 1;
  min-width: 0;
  padding: 4px 3px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  font-size: 11px;
  text-align: center;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  color: var(--text-light);
  transition: all 0.3s ease;
}

.size-inputs .separator {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}

.size-inputs input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.image-name {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 회전 버튼 */
.rotate-buttons {
  position: absolute;
  top: 5px;
  left: 5px;
  display: flex;
  gap: 3px;
  z-index: 10;
}

.rotate-btn {
  width: 24px;
  height: 24px;
  background: rgba(102, 126, 234, 0.9);
  backdrop-filter: blur(5px);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  padding: 0;
  margin: 0;
}

.rotate-btn:hover {
  background: rgba(102, 126, 234, 1);
  transform: scale(1.15) rotate(15deg);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.rotate-btn.rotate-left:hover {
  transform: scale(1.15) rotate(-15deg);
}

.rotate-btn:active {
  transform: scale(0.95);
}

.remove-image-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  background: rgba(231, 76, 60, 0.85);
  backdrop-filter: blur(5px);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
  padding: 0;
  margin: 0;
}

.remove-image-btn:hover {
  background: rgba(231, 76, 60, 1);
  transform: scale(1.2);
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.5);
}

/* 회전 버튼 */
.rotate-buttons {
  position: absolute;
  top: 5px;
  left: 5px;
  display: flex;
  gap: 3px;
  z-index: 10;
}

.rotate-btn {
  width: 24px;
  height: 24px;
  background: rgba(102, 126, 234, 0.85);
  backdrop-filter: blur(5px);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  padding: 0;
  margin: 0;
}

.rotate-btn:hover {
  background: rgba(102, 126, 234, 1);
  transform: scale(1.15);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.rotate-left:hover {
  transform: scale(1.15) rotate(-15deg);
}

.rotate-right:hover {
  transform: scale(1.15) rotate(15deg);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  backdrop-filter: blur(5px);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Print 스타일 - 정확한 출력 보장 */
@page {
  size: A4;
  margin: 0;
}

@page :first {
  margin-top: 0;
}

/* A4 용지 */
@media print and (max-width: 210mm) {
  @page {
    size: A4 portrait;
    margin: 0;
  }
}

/* A4 가로 */
@media print and (min-width: 297mm) and (max-width: 298mm) {
  @page {
    size: A4 landscape;
    margin: 0;
  }
}

/* A3 용지 */
@media print and (min-width: 297mm) and (max-height: 420mm) {
  @page {
    size: A3 portrait;
    margin: 0;
  }
}

/* A3 가로 */
@media print and (min-width: 420mm) {
  @page {
    size: A3 landscape;
    margin: 0;
  }
}

/* A5 용지 */
@media print and (max-width: 148mm) {
  @page {
    size: A5 portrait;
    margin: 0;
  }
}

/* A5 가로 */
@media print and (min-width: 210mm) and (max-width: 211mm) {
  @page {
    size: A5 landscape;
    margin: 0;
  }
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  html, body {
    background: white !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .top-header,
  .control-panel,
  .image-list-panel,
  .preview-header {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    display: block !important;
    height: auto !important;
    padding: 0 !important;
  }

  .preview-panel {
    background: white !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .preview-container {
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    overflow: visible !important;
  }

  .paper-page {
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    page-break-after: always !important;
    page-break-inside: avoid !important;
    break-after: page !important;
    break-inside: avoid !important;
    border: none !important;
    background: white !important;
    position: relative !important;
  }

  .paper-page:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  .page-number {
    display: none !important;
  }

  .paper-content {
    background: transparent !important;
  }

  .paper-image {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .paper-image img {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
  }
}
