/* style.css */
/* Modern, glassmorphism design with dark theme support */

:root {
  --bg-primary: #f0f2f5;
  --container-bg: rgba(255, 255, 255, 0.92);
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #cbd5e1;
  --input-bg: #ffffff;
  --input-focus: #3b82f6;
  --shadow-color: rgba(0, 0, 0, 0.08);
  --preview-bg: #fafbfc;
}

body.dark-theme {
  --bg-primary: #0f172a;
  --container-bg: rgba(30, 41, 59, 0.7);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --input-bg: #1e293b;
  --input-focus: #60a5fa;
  --shadow-color: rgba(0, 0, 0, 0.4);
  --preview-bg: #1e293b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 40px 20px;
  font-family: 'Inter', 'Noto Sans KR', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
}

.container {
  background: var(--container-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 30px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  box-shadow: 0 10px 40px var(--shadow-color);
  transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* ─── Header ─── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ─── Textarea ─── */
textarea {
  width: 100%;
  max-width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 16px;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: 'Inter', 'Noto Sans KR', monospace;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 20px;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.3s, color 0.3s;
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
}

textarea:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

textarea[readonly] {
  cursor: default;
  opacity: 0.85;
}

/* ─── Buttons ─── */
.controls {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  color: #ffffff !important;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s, opacity 0.2s;
  flex: 1 1 180px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn-convert {
  background: linear-gradient(135deg, #047857, #059669);
  box-shadow: 0 4px 15px rgba(5, 150, 105, 0.4);
}

.btn-pdf {
  background: linear-gradient(135deg, #be123c, #e11d48);
  box-shadow: 0 4px 15px rgba(225, 29, 72, 0.4);
}

.btn-docx {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.btn-copy {
  background: linear-gradient(135deg, #6d28d9, #7c3aed);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.icon {
  flex-shrink: 0;
}

/* ─── Preview ─── */
.preview-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-badge {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

body.dark-theme .preview-badge {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}

.preview {
  min-height: 150px;
  padding: 24px;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  background: var(--preview-bg);
  color: var(--text-primary);
  font-family: 'Inter', 'Noto Sans KR', serif;
  font-size: 1.05rem;
  line-height: 1.7;
  white-space: normal;
  word-break: keep-all;
  word-wrap: break-word;
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

/* ─── Language select ─── */
.language-switch {
  display: flex;
  align-items: center;
  gap: 6px;
}

.language-switch label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.language-switch select {
  padding: 4px 10px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, background-color 0.3s, color 0.3s;
}

.language-switch select:focus {
  border-color: var(--input-focus);
}

/* ─── Theme toggle switch ─── */
.theme-switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #cbd5e1;
  transition: 0.3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #ffffff;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background: #3b82f6;
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.theme-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  body { padding: 16px 10px; }
  .container { padding: 18px; border-radius: 14px; }
  h1 { font-size: 1.3rem; }
  .btn { flex: 1 1 100%; font-size: 0.9rem; padding: 10px 16px; }
}
