/* 기본 설정 */
body {
  margin: 0;
  font-family: 'Segoe UI', 'Noto Sans KR', sans-serif;
  background: #f9fafb;
  color: #333;
  transition: background 0.3s ease, color 0.3s ease;
}

.container {
  max-width: 960px;
  margin: 40px auto;
  padding: 24px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.3s ease, background 0.3s ease;
}

.container:hover {
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.12);
}

.title {
  font-size: 2rem;
  font-weight: 700;
  color: #4f46e5;
  margin-bottom: 4px;
  animation: fadeInDown 0.8s ease;
}

.filename {
  font-size: 0.95em;
  color: #6b7280;
  margin-bottom: 18px;
  animation: fadeIn 1.2s ease;
}

.viewer {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  height: 600px;
  background: #fff;
  overflow: auto;
  padding: 16px;
  animation: fadeInUp 1s ease;
}

.location {
  text-align: center;
  color: #6b7280;
  margin-top: 14px;
  font-size: 0.95em;
  animation: fadeIn 1.2s ease;
}

.controls {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.95em;
  animation: fadeInUp 1s ease;
}

button {
  background: #eef2ff;
  color: #1e293b;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.95em;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.2s ease;
}

button:hover {
  background: #c7d2fe;
  transform: translateY(-2px);
}

.font-size-btn.active {
  border: 2px solid #6366f1;
  font-weight: bold;
}

/* 로딩 오버레이 */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.loader {
  border: 8px solid #e5e7eb;
  border-top: 8px solid #4f46e5;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 20px;
  font-size: 1.1rem;
  color: #4b5563;
}

/* 애니메이션 효과 */
@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes fadeInDown {
  0% { opacity: 0; transform: translateY(-20px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 반응형 */
@media (max-width: 600px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
}

/* 🌙 다크모드 지원 */
@media (prefers-color-scheme: dark) {
  body {
    background: #0f172a;
    color: #e2e8f0;
  }

  .container {
    background: #1e293b;
    box-shadow: 0 10px 40px rgba(255, 255, 255, 0.06);
  }

  .viewer {
    background: #1e293b;
    border: 1px solid #334155;
  }

  .title {
    color: #818cf8;
  }

  .filename,
  .location {
    color: #94a3b8;
  }

  button {
    background: #334155;
    color: #e2e8f0;
  }

  button:hover {
    background: #475569;
  }

  .loading-overlay {
    background: rgba(15, 23, 42, 0.95);
  }

  .loader {
    border-color: #334155;
    border-top-color: #818cf8;
  }

  .loading-text {
    color: #cbd5e1;
  }
}

/* 🌗 다크모드 토글 버튼 */
.dark-mode-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.9em;
  cursor: pointer;
  transition: background 0.3s;
}

.dark-mode-toggle:hover {
  background: #4f46e5;
}

body.dark {
  background: #0f172a;
  color: #e2e8f0;
}

body.dark .container,
body.dark .viewer {
  background: #1e293b;
  border-color: #334155;
}

body.dark button {
  background: #334155;
  color: #e2e8f0;
}

body.dark button:hover {
  background: #475569;
}
