/* 전역 스타일 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #4a90e2;
  --success-color: #52c41a;
  --error-color: #ff4d4f;
  --warning-color: #faad14;
  --bg-light: #f5f5f5;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  color: var(--text-primary);
  background-color: var(--bg-light);
  line-height: 1.6;
  padding: 0;
}

/* GNB (Global Navigation Bar) */
.gnb {
  position: sticky;
  top: 0;
  background: white;
  box-shadow: var(--shadow);
  z-index: 1000;
  border-bottom: 2px solid var(--border-color);
}

.gnb-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.gnb-logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s;
}

.gnb-logo:hover {
  color: #357abd;
}

.gnb-menu {
  display: flex;
  gap: 10px;
  align-items: center;
}

.gnb-item {
  padding: 8px 16px;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.gnb-item:hover {
  background: var(--bg-light);
  color: var(--primary-color);
}

.gnb-item.active {
  background: var(--primary-color);
  color: white;
}

.gnb-item.active:hover {
  background: #357abd;
  color: white;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* 헤더 */
.header {
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(135deg, var(--primary-color) 0%, #357abd 100%);
  color: white;
  border-radius: 12px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-lg);
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  font-weight: 700;
}

.subtitle {
  font-size: 1rem;
  opacity: 0.9;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* 업로드 섹션 */
.upload-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 드래그 앤 드롭 영역 */
.drop-zone {
  background: white;
  border: 3px dashed var(--border-color);
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.drop-zone:hover {
  border-color: var(--primary-color);
  background: #f0f7ff;
}

.drop-zone.drag-over {
  border-color: var(--primary-color);
  background: #e8f4fd;
  transform: scale(1.02);
}

.drop-zone-content {
  pointer-events: none;
}

.drop-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.drop-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.drop-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.btn-upload {
  padding: 12px 30px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  pointer-events: all;
  min-height: 44px;
}

.btn-upload:hover {
  background: #357abd;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

/* 이미지 미리보기 */
.image-preview {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.preview-header h3 {
  font-size: 1.3rem;
  color: var(--text-primary);
}

.btn-remove {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--error-color);
  color: white;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove:hover {
  background: #d32f2f;
  transform: scale(1.1);
}

#previewImage {
  max-width: 100%;
  max-height: 500px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* OCR 섹션 */
.ocr-section {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  text-align: center;
}

.btn-ocr {
  padding: 15px 40px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}

.btn-ocr:hover:not(:disabled) {
  background: #357abd;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn-ocr:disabled {
  background: var(--border-color);
  color: var(--text-secondary);
  cursor: not-allowed;
  transform: none;
}

/* OCR 진행률 */
.ocr-progress {
  margin-top: 20px;
}

.progress-bar {
  width: 100%;
  height: 30px;
  background: var(--bg-light);
  border-radius: 15px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), #357abd);
  width: 0%;
  transition: width 0.3s;
  border-radius: 15px;
}

.progress-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* 결과 섹션 */
.result-section {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.result-header h2 {
  font-size: 1.8rem;
  color: var(--text-primary);
}

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-copy,
.btn-save-txt,
.btn-save-xlsx {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}

.btn-copy {
  background: var(--primary-color);
  color: white;
}

.btn-copy:hover {
  background: #357abd;
}

.btn-save-txt {
  background: var(--success-color);
  color: white;
}

.btn-save-txt:hover {
  background: #389e0d;
}

.btn-save-xlsx {
  background: #1890ff;
  color: white;
}

.btn-save-xlsx:hover {
  background: #096dd9;
}

.text-result {
  margin-bottom: 15px;
}

#extractedText {
  width: 100%;
  min-height: 300px;
  padding: 15px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  font-family: 'Courier New', monospace;
  line-height: 1.6;
  resize: vertical;
  background: var(--bg-light);
}

#extractedText:focus {
  outline: none;
  border-color: var(--primary-color);
}

.result-info {
  display: flex;
  gap: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.result-info p {
  margin: 0;
}

.result-info span {
  font-weight: 600;
  color: var(--text-primary);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  .gnb-container {
    flex-direction: column;
    height: auto;
    padding: 10px 20px;
  }

  .gnb-logo {
    font-size: 1.1rem;
    margin-bottom: 10px;
  }

  .gnb-menu {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .gnb-item {
    font-size: 0.9rem;
    padding: 6px 12px;
  }

  .container {
    padding: 10px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .drop-zone {
    padding: 40px 15px;
  }

  .drop-icon {
    font-size: 3rem;
  }

  .drop-text {
    font-size: 1rem;
  }

  .result-header {
    flex-direction: column;
    align-items: stretch;
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions button {
    width: 100%;
  }

  .result-info {
    flex-direction: column;
    gap: 10px;
  }
}

/* Footer 스타일 */
.page-footer {
  text-align: center;
  padding: 30px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-top: 40px;
}

.page-footer p {
  margin-bottom: 15px;
  color: var(--text-secondary);
}

.footer-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-nav a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-nav a:hover {
  text-decoration: underline;
}

.footer-nav span {
  color: var(--text-secondary);
}

/* SNS 링크 숨김 처리 (SEO 및 소셜 미디어 검증용) */
.sns-links-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sns-links-hidden a {
  display: inline-block;
  width: 1px;
  height: 1px;
  overflow: hidden;
  text-indent: -9999px;
}

/* 접근성 */
button:focus,
.drop-zone:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}
