
/* Styles - Pastel Tumblr Aesthetic with Multiple Themes */

@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Source+Code+Pro:wght@300;400;500&display=swap");

/*CSS custom Properties (Theme Tokens)*/
:root {
  --font-display: "Playfair Display", Georgia, serif;
  --font-code: "Source Code Pro", "Consolas", monospace;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 30px rgba(0, 0, 0, 0.1);
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* theme: blush (default) */
[data-theme="blush"] {
  --bg: #fff5f5;
  --bg-card: #ffffff;
  --bg-input: #fff0f0;
  --bg-code: #fff8f8;
  --accent: #f472b6;
  --accent-soft: #fbcfe8;
  --accent-muted: #fce7f3;
  --text: #4a3040;
  --text-muted: #9b7a8e;
  --text-light: #c9a3b8;
  --border: #f9d5e5;
  --dead-bg: #fee2e2;
  --dead-text: #dc6b6b;
  --btn-hover: #ec4899;
  --tag-bg: #fdf2f8;
  --scrollbar: #f9a8d4;
}

/* theme: cloud */
[data-theme="cloud"] {
  --bg: #f0f7ff;
  --bg-card: #ffffff;
  --bg-input: #ebf4ff;
  --bg-code: #f5f9ff;
  --accent: #60a5fa;
  --accent-soft: #bfdbfe;
  --accent-muted: #dbeafe;
  --text: #1e3a5f;
  --text-muted: #6b8db5;
  --text-light: #93b5d6;
  --border: #c7deff;
  --dead-bg: #dbeafe;
  --dead-text: #3b82f6;
  --btn-hover: #3b82f6;
  --tag-bg: #eff6ff;
  --scrollbar: #93c5fd;
}

/* theme: lavender */
[data-theme="lavender"] {
  --bg: #f5f3ff;
  --bg-card: #ffffff;
  --bg-input: #ede9fe;
  --bg-code: #f8f6ff;
  --accent: #a78bfa;
  --accent-soft: #c4b5fd;
  --accent-muted: #ddd6fe;
  --text: #3b2e6e;
  --text-muted: #7c6fb5;
  --text-light: #a89ad4;
  --border: #d8d0f5;
  --dead-bg: #ede9fe;
  --dead-text: #7c3aed;
  --btn-hover: #7c3aed;
  --tag-bg: #f5f3ff;
  --scrollbar: #a78bfa;
}

/* theme: sage*/
[data-theme="sage"] {
  --bg: #f0fdf4;
  --bg-card: #ffffff;
  --bg-input: #ecfdf5;
  --bg-code: #f5fff8;
  --accent: #34d399;
  --accent-soft: #6ee7b7;
  --accent-muted: #a7f3d0;
  --text: #1a3c2a;
  --text-muted: #5c8a6e;
  --text-light: #86b498;
  --border: #bbf0d0;
  --dead-bg: #d1fae5;
  --dead-text: #059669;
  --btn-hover: #059669;
  --tag-bg: #ecfdf5;
  --scrollbar: #6ee7b7;
}

/* theme: buttercream */
[data-theme="buttercream"] {
  --bg: #fffbeb;
  --bg-card: #ffffff;
  --bg-input: #fef9e7;
  --bg-code: #fffdf5;
  --accent: #f59e0b;
  --accent-soft: #fcd34d;
  --accent-muted: #fde68a;
  --text: #5c4a1e;
  --text-muted: #a08040;
  --text-light: #c4a660;
  --border: #fde68a;
  --dead-bg: #fef3c7;
  --dead-text: #d97706;
  --btn-hover: #d97706;
  --tag-bg: #fffbeb;
  --scrollbar: #fcd34d;
}

/* reset & base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition:
    background var(--transition),
    color var(--transition);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 3px;
}

/* header */
.header {
  padding: 2rem 2.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.logo h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  transition: color var(--transition);
}

.logo p {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}

/* theme switcher */
.theme-switcher {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.theme-switcher label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.theme-btn:hover {
  transform: scale(1.15);
}

.theme-btn.active {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--bg);
}

.theme-btn[data-theme="blush"] {
  background: #f472b6;
}
.theme-btn[data-theme="cloud"] {
  background: #60a5fa;
}
.theme-btn[data-theme="lavender"] {
  background: #a78bfa;
}
.theme-btn[data-theme="sage"] {
  background: #34d399;
}
.theme-btn[data-theme="buttercream"] {
  background: #f59e0b;
}

/* main layout */
.main {
  padding: 0 2.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
}

@media (max-width: 1024px) {
  .main {
    grid-template-columns: 1fr;
  }
}

/* cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: all var(--transition);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.card-body {
  padding: 1.2rem 1.4rem;
}

/* input panel */
.input-area {
  width: 100%;
  min-height: 380px;
  max-height: 600px;
  resize: vertical;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  font-family: var(--font-code);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text);
  outline: none;
  transition: all var(--transition);
  tab-size: 4;
}

.input-area:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

/* action bar */
.action-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1.6rem;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--btn-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.btn-primary:active {
  transform: translateY(0);
}

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  appearance: none;
  background: var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: background var(--transition);
  outline: none;
}

.toggle:checked {
  background: var(--accent);
}

.toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.toggle:checked::before {
  transform: translateX(18px);
}

/* output panel */
.output-panel {
  display: flex;
  flex-direction: column;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
}

.tab {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
  transition: color var(--transition);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  font-weight: 600;
}

.tab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0.5rem;
  right: 0.5rem;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.tab-content {
  display: none;
  padding: 1.2rem 1.4rem;
  flex: 1;
}

.tab-content.active {
  display: block;
}

.code-output {
  font-family: var(--font-code);
  font-size: 0.8rem;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  min-height: 300px;
  max-height: 520px;
  overflow-y: auto;
  padding: 0.5rem;
}

.code-output .line {
  display: block;
  padding: 1px 6px;
  border-radius: 3px;
  transition: background var(--transition);
}

.code-output .line-number {
  display: inline-block;
  width: 2.5em;
  text-align: right;
  color: var(--text-light);
  margin-right: 1em;
  font-size: 0.72rem;
  user-select: none;
  opacity: 0.7;
}

.code-output .line.dead {
  background: var(--dead-bg);
  text-decoration: line-through;
  color: var(--dead-text);
  opacity: 0.75;
}

.code-output .line.dead .line-number {
  color: var(--dead-text);
}

/* stats bar */
.stats {
  display: flex;
  gap: 1.5rem;
  padding: 0.8rem 1.4rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.stat-value {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.82rem;
}

/* error display */
.error-msg {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  color: #b91c1c;
  font-size: 0.82rem;
  line-height: 1.6;
  font-family: var(--font-code);
  display: none;
}

.error-msg.visible {
  display: block;
}

/* placeholder */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-light);
  font-style: italic;
  gap: 0.5rem;
}

.placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.3;
}

/* animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.processing {
  animation: pulse 1.2s ease-in-out infinite;
}

/* footer */
.footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.72rem;
  color: var(--text-light);
  font-style: italic;
}

/* responsive */
@media (max-width: 768px) {
  .header {
    padding: 1.5rem 1rem 1rem;
  }
  .main {
    padding: 0 1rem 2rem;
  }
  .logo h1 {
    font-size: 1.4rem;
  }
  .tabs {
    overflow-x: auto;
  }
}
