:root {
  --bg-color: #0f172a;
  --text-color: #e2e8f0;
  --text-muted: #94a3b8;
  --panel-bg: rgba(30, 41, 59, 0.7);
  --border-color: rgba(148, 163, 184, 0.1);
  --primary-color: #38bdf8;
  --primary-hover: #0ea5e9;
  --secondary-bg: rgba(51, 65, 85, 0.5);
  --secondary-hover: rgba(71, 85, 105, 0.5);
  --glass-border: 1px solid rgba(255, 255, 255, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme='light'] {
  --bg-color: #f8fafc;
  --text-color: #1e293b;
  --text-muted: #64748b;
  --panel-bg: rgba(255, 255, 255, 0.8);
  --border-color: rgba(0, 0, 0, 0.1);
  --primary-color: #0284c7;
  --primary-hover: #0369a1;
  --secondary-bg: rgba(226, 232, 240, 0.5);
  --secondary-hover: rgba(203, 213, 225, 0.5);
  --glass-border: 1px solid rgba(255, 255, 255, 0.5);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-color);
  accent-color: var(--primary-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* Background Blobs */
.background-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s infinite alternate;
}

.blob-1 {
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: #4f46e5;
}

.blob-2 {
  bottom: -10%;
  right: -10%;
  width: 40vw;
  height: 40vw;
  background: #0ea5e9;
  animation-delay: -5s;
}

.blob-3 {
  top: 40%;
  left: 40%;
  width: 30vw;
  height: 30vw;
  background: #ec4899;
  animation-delay: -10s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    transform: translate(50px, 50px) rotate(20deg);
  }
}

/* App Container */
.app-container {
  width: 95%;
  max-width: 1400px;
  height: 95vh;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--panel-bg);
  border: var(--glass-border);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* Main Content - Vertical Layout */
main.vertical-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 1rem 0;
  gap: 1rem;
  overflow-y: auto; /* Allow scrolling if content is tall */
  min-height: 0; /* Important for flex child scrolling */
}

/* Sections */
.section-input {
  flex: 0 0 auto;
  min-height: 50px;
  display: flex;
  flex-direction: column;
}

.section-html-preview {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.section-controls {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end; /* or center? Mock shows right aligned maybe? No, let's right align to match controls */
  padding-bottom: 0.5rem;
}

.section-outputs {
  flex: 1;
  min-height: 200px; /* Minimum height for outputs */
  display: flex;
  gap: 1rem;
  position: relative;
}

.section-copy-actions {
  flex: 0 0 auto;
  /* padding: 1rem 0; */
}


/* Input Panel Specifics */
.input-panel {
  height: 100%;
}


/* 2-Column Grid */
.two-column-grid {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.output-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.output-column .panel {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.output-column .editor-container {
  flex: 1;
  /* Ensure previews scroll internally */
  overflow: hidden;
}

.column-footer {
  display: flex;
  justify-content: center;
}

.radio-label {
  display: block;
  text-align: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
  width: 100%;
  padding: 0.3rem 0;
  margin-top: 0.1rem;
  border-radius: 4px;
  transition: 150ms background-color;

  &:hover {
    background: var(--secondary-bg);
  }
}

.radio-label input {
  accent-color: var(--primary-color);
  vertical-align: middle;
}


/* View Toggle Buttons */
.view-toggle {
  display: flex;
  background: var(--secondary-bg);
  padding: 0.25rem;
  border-radius: 8px;
  gap: 0.25rem;
}

.view-toggle .toggle-btn {
  background: none;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-toggle .toggle-btn.active {
  background: var(--bg-color);
  color: var(--text-color);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  font-weight: 500;
}

/* Render Preview (vs Editor) */
.render-preview {
  width: 100%;
  height: 100%;
  padding: 0.5rem;
  overflow-y: auto;
  background: white; /* Rendered HTML usually expects white bg, or adapt to theme? */
  color: black;
  border-radius: 6px;
  font-size: 70%;

  a:link {
    color: var(--text-muted)
  }
  a:link:hover {
    text-decoration-style: wavy;
  }

  /* preview stuff should look like normal */
  * {
    margin: revert;
    padding: revert;
  }

  pre, code {
    background: var(--secondary-bg);
    color: var(--text-color);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 90%;
  }
}


[data-theme='dark'] .render-preview {
  background: #1e293b; /* darker bg for dark mode */
  color: #e2e8f0;
}

/* Hidden Utility */
.hidden {
  display: none !important;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--panel-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(4px);
  border-radius: 6px;
  color: var(--text-color);
  font-weight: 500;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--secondary-bg);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* App Footer */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-top: var(--glass-border);
  background: var(--panel-bg);
}


#themeToggle {
  background: transparent;
  border: 0;
  color: var(--text-color);
}

/* Reuse existing styles but ensure selectors match */
.panel-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}

/* HTML Panel Specifics */
.panel.html-panel {
  height: auto;
}

#htmlPreview.editor {
  resize: vertical;
  min-height: 50px;
  height: 100px;
}

.editor-container {
  flex: 1;
  position: relative;
  background: var(--secondary-bg);
  border-radius: 6px;
  border: 1px solid transparent;
  transition: border-color 0.2s ease;
  overflow: hidden;
  /* display: flex; */
  flex-direction: column;
}

.editor-container:focus-within {
  border-color: var(--primary-color);
}

.editor {
  flex: 1;
  width: 100%;
  height: 100%;
  padding: 1.5rem;
  background: transparent;
  border: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--text-color);
  outline: none;
  overflow-y: auto;
  margin: 0;
  white-space: pre-wrap;
}

/* Prism Overrides */
pre[class*='language-'] {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  text-shadow: none !important;
  font-family: var(--font-mono) !important;
}

code[class*='language-'],
pre[class*='language-'] {
  color: var(--text-color) !important;
  font-size: 0.7rem !important;
}

/* Ensure code wraps */
code[class*='language-'] {
  white-space: pre-wrap !important;
  word-break: break-word;
}

#inputArea[contenteditable]:empty:before {
  content: attr(placeholder);
  color: var(--text-muted);
  opacity: 0.6;
}

.hidden {
  display: none;
}

.arrow-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0.5;
}

@media (max-width: 768px) {
  .arrow-divider {
    transform: rotate(90deg);
    padding: 1rem 0;
  }
}

/* Actions */
.panel-actions {
  margin-top: 1rem;
  grid-column: 1 / -1; /* Span across both columns */
  display: flex;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn.primary {
  background: var(--primary-color);
  color: white;
}

.btn.primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

#copyBtn {
  width: 100%;
  padding: 0.8rem 1.2rem;
  font-size: 1rem;
}

.btn.secondary {
  background: var(--secondary-bg);
  color: var(--text-color);
}

.btn.secondary:hover {
  background: var(--secondary-hover);
}

/* Toggle Group */
.toggle-group {
  display: flex;
  background: var(--secondary-bg);
  padding: 0.25rem;
  border-radius: 8px;
}

.toggle-btn {
  background: none;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: var(--bg-color);
  color: var(--text-color);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--secondary-hover);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.radio-group {
  display: flex;
  font-size: 0.85rem;
  border: 0;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;

  /* give it some height for background hover effect. neg margin cuz i'm lazy */
  padding: 0.4rem 1rem;
  margin: -0.4rem 0;

  border-radius: 8px;
  transition: all 0.2s ease;

  &:first-child {
    margin-left: 4px;
  }
}

.radio-group label:hover {
  background: var(--secondary-bg);
  color: var(--text-color);
}


.logo {
  display: flex;
  align-items: center;
  gap: 12px;

  svg {
    color: var(--primary-color);
  }

  h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--text-color), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

}

