:root {
  /* Solarized Dark Palette */
  --base03: #002b36;
  --base02: #073642;
  --base01: #586e75;
  --base00: #657b83;
  --base0: #839496;
  --base1: #93a1a1;
  --base2: #eee8d5;
  --base3: #fdf6e3;
  --yellow: #b58900;
  --orange: #cb4b16;
  --red: #dc322f;
  --magenta: #d33682;
  --violet: #6c71c4;
  --blue: #268bd2;
  --cyan: #2aa198;
  --green: #859900;

  /* IDE Mappings */
  --bg-main: var(--base03);
  --bg-sidebar: var(--base02);
  --bg-terminal: var(--base02);
  --text-main: var(--base0);
  --text-highlight: var(--base1);
  --text-muted: var(--base01);
  --border-color: var(--base01);
  --accent: var(--blue);

  --font-mono: "Fira Code", "Cascadia Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: grid;
  grid-template-columns: 50px 1fr 1fr;
  grid-template-rows: 2.5em 1fr 1.8em;
  gap: 0px 0px;
  grid-template-areas:
    "sidebar header header"
    "sidebar main-content main-content"
    "sidebar footer footer";
}

/* Sidebar */
.sidebar {
  grid-area: sidebar;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
  gap: 25px;
}

.sidebar-icon {
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-icon:hover {
  color: var(--text-highlight);
}

.sidebar-icon.active {
  color: var(--accent);
}

.sidebar-icon:active {
  transform: scale(0.9);
}

/* Header */
.header {
  grid-area: header;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding-left: 10px;
}

.logo {
  height: 2em;
}

.logo-text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--text-main);
  margin-left: 12px;
  letter-spacing: -1px;
}

/* Main Content Area */
.main-content {
  grid-area: main-content;
  overflow: hidden;
  position: relative;
  width: 100%;
  height: 100%;
}

/* View Management */
.view {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 30%;
  gap: 0px 0px;
  grid-template-areas:
    "code-area output-area"
    "code-area details-area";
}

.view>* {
  min-height: 0;
  min-width: 0;
}

.view.active {
  opacity: 1;
  visibility: visible;
}

#home-view {
  display: flex;
  grid-template-columns: unset;
  grid-template-rows: unset;
  grid-template-areas: unset;
}

/* Landing Page */
.landing-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-main);
  gap: 50px;
  padding: 0 100px;
}

.landing-content {
  text-align: left;
  flex: 1;
  max-width: 600px;
}

.landing-visual {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-video {
  max-width: 100%;
  max-height: 400px;
  border-radius: 12px;
  /* box-shadow: 0 10px 30px rgba(0,0,0,0.3); */
}

.landing-title {
  font-size: 3.5em;
  margin-bottom: 0.2em;
  color: var(--accent);
  font-weight: 300;
  letter-spacing: -1px;
}

.landing-subtitle {
  font-size: 1.5em;
  margin-bottom: 1.5em;
  color: var(--base1);
  font-weight: 300;
}

.landing-description {
  font-size: 1.1em;
  line-height: 1.7;
  margin-bottom: 2.5em;
  color: var(--text-main);
  max-width: 500px;
  margin-right: auto;
  /* Removing auto margin-left/right to keep it left aligned */
}

.go-editor-btn {
  background-color: var(--green);
  color: var(--base3);
  border: none;
  padding: 12px 30px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s, transform 0.1s;
}

.go-editor-btn:hover {
  opacity: 0.9;
}

.go-editor-btn:active {
  transform: translateY(1px);
}

/* Code Area (Left Pane) */
.code-area {
  grid-area: code-area;
  position: relative;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
}

/* Output Area (Top Right Pane) */
.output-area {
  grid-area: output-area;
  position: relative;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border-color);
}

/* Details/Terminal Area (Bottom Right Pane) */
.details-area {
  grid-area: details-area;
  padding: 15px;
  /* overflow-y: auto; -- removed, let children scroll */
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: row;
  gap: 15px; /* Separation between logs and details */
}

.details-area pre {
  color: var(--text-main);
  font-size: 11px;
  line-height: 1.6;
}

.transpiler-details {
  flex: 1;
  overflow-y: auto;
  padding-left: 15px;
  border-left: 1px solid var(--border-color);
}

/* Buttons Panel */
.buttons-panel {
  position: absolute;
  top: 15px;
  right: 20px;
  z-index: 100;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
  /* Allow clicks to pass through panel container */
}

.buttons-group {
  display: flex;
  gap: 0.5em;
  pointer-events: auto;
  /* Re-enable clicks on buttons */
}

.convert-btn,
.adjust-btn {
  background-color: var(--green);
  color: var(--base3);
  border: none;
  padding: 6px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  /* Stronger shadow for floating */
  opacity: 0.9;
}

.adjust-btn {
  background-color: var(--blue);
  padding: 6px 12px;
  border-radius: 4px;
}

.convert-btn:hover,
.adjust-btn:hover {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.convert-btn:active,
.adjust-btn:active {
  transform: translateY(1px);
}

/* CodeMirror Editor */
.code-editor {
  width: 100%;
  height: 100%;
  padding-top: 0;
  overflow: hidden;
}

.code-editor .CodeMirror {
  height: 100%;
  font-family: var(--font-mono);
  font-size: 14px;
}

/* Output Area Tabs */
.tabs-header {
  height: 35px;
  background-color: var(--bg-sidebar);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-left: 10px;
}

.tab-item {
  padding: 0 15px;
  height: 100%;
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-right: 1px solid transparent;
  border-left: 1px solid transparent;
  transition: all 0.2s;
}

.tab-item:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.05);
}

.tab-item.active {
  color: var(--accent);
  background-color: var(--bg-main);
  border-right: 1px solid var(--border-color);
  border-left: 1px solid var(--border-color);
  font-weight: 500;
}

.tab-content {
  display: none;
  height: calc(100% - 35px);
  /* Subtract header height */
  width: 100%;
  position: relative;
  background-color: #f5f5f5;
}

.tab-content.active {
  display: block;
}

.logs-div {
  padding: 15px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  height: 100%;
  overflow: scroll;
}

/* Output Code Div - content inside tab */
.output-code-div {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--bg-main);
  overflow-y: auto;
  padding: 15px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--cyan);
}

.output-content {
  white-space: pre-wrap;
  word-wrap: break-word;
  /* overflow is handled by parent .output-code-div */
}

/* Footer */
.footer {
  grid-area: footer;
  background-color: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-size: 11px;
}

.wftpl-logo {
  height: 1em;
  vertical-align: middle;
  margin-right: 3px;
}


.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.online {
  background-color: #51afef;
}

.offline {
  background-color: var(--red);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: var(--base01);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--base00);
}

/* Customizations for Output Area */
/* Customizations for Output Area */
.output-code-div {
  color: var(--cyan);
  flex: 1; /* Take remaining space */
  height: 0; /* Important for scrollable flex item */
  min-height: 0;
  /* overflow-y: auto is already set in original class definition */
}

/* Hilite.me style overrides if needed */
.output-code-div pre {
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  background-color: transparent !important; /* Let our bg shine through if needed, though hilite usually sets one */
  color: inherit;
  border: none !important;
}

/* Target only the div inside output-content to avoid breaking buttons-panel */
.output-content div {
    width: 100% !important; /* Ensure hilite container takes full width */
    overflow-x: auto !important;
    background: transparent !important;
}

/* Status Logs in Output Pane */
/* Status Logs in Output Pane */
.status-logs-container {
  padding: 0; /* Remove padding as it's inside details area which has padding, or customize */
  /* border-bottom: 1px solid var(--border-color); -- remove bottom border */
  background-color: transparent; /* match parent */
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  max-height: none; /* Remove max-height constraint */
  height: 100%; /* Fill parent */
  overflow-y: auto;
  flex: 1; /* Split 50/50 with transpiler details */
  flex-shrink: 0;
}

.log-entry.success { color: var(--green); }
.log-entry.warning { color: var(--yellow); }
.log-entry.error { color: var(--red); }
.log-entry.error-detail { color: var(--base3); }

/* Ensure Tab Content can be flex container */
#tab-code.tab-content.active {
  display: flex !important; /* Force flex over block */
  flex-direction: column;
}

.output-code-div .buttons-panel {
  position: sticky;
  top: 0;
  right: 0;
  width: calc(100% + 30px);
  /* Full width including parent padding (15px * 2) */
  z-index: 10;
  margin: -15px -15px 10px -15px;
  /* Negate parent padding */
  pointer-events: auto;
  display: flex;
  justify-content: flex-end;
}

.details-area pre {
  color: var(--text-muted);
  font-size: 11px;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}


@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

.spin {
  animation: spin 2s linear infinite;
}

/* Animations and Polish */
.sidebar-icon,
.nav-link,
.convert-btn,
.tab {
  transition: all 0.2s ease-in-out;
}

.sidebar-icon:active {
  transform: scale(0.9);
}

.convert-btn:active {
  transform: translateY(1px);
}

.tab:hover {
  background-color: var(--bg-main);
  opacity: 0.8;
}

.status-dot.online {
  box-shadow: 0 0 5px var(--blue);
}

/* Selection color */
::selection {
  background: var(--base02);
  color: var(--base1);
}

/* Control Flow Visualization Styles */
.flow-table {
  font-family: Arial, Helvetica, sans-serif;
  color: black;
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.flow-table small {
  color: var(--text-muted);
}

.step-status {
  color: var(--cyan);
  font-weight: bold;
  font-size: smaller;
  padding-left: 2px;
}

.flow-td {
  width: 20%;
  border-left: 2px solid var(--cyan);
  border-right: 2px solid var(--cyan);
  padding: 8px;
  overflow: hidden;
  vertical-align: top;
}

.flow-td-omit-right {
  width: 20%;
  border-left: 2px solid var(--cyan);
  border-right: 0;
  padding: 8px;
  vertical-align: top;
}

.flow-td-omit-left {
  width: 20%;
  border-left: 0;
  border-right: 2px solid var(--cyan);
  padding: 8px;
  vertical-align: top;
}

.flow-td-empty {
  padding: 8px;
}

.flow-active {
  /* Adapted for dark mode */
  background: linear-gradient(to bottom, #CCEFC4 0%, #f5f5f5 100%);
  border-top: 4px solid #71d25b;
}

.flow-pill {
  width: 90%;
  color: var(--base3);
  background-color: var(--cyan);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.flow-pill-success {
  width: 90%;
  color: var(--base3);
  background-color: var(--green);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}