/* Reset & basics */
html, body {
  height: 100%;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
}

/* Cairo Play font class with weight 600 */
.cairo-play-v12 {
  font-family: 'Cairo Play', sans-serif;
  font-weight: 600;
  font-optical-sizing: auto;
  font-style: normal;
  font-variation-settings: "slnt" 0;
  font-size: 2em;
}

/* Navbar styles */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 50px;
  background: #222;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  box-sizing: border-box;
  z-index: 1000;
  user-select: none;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
}

/* Left side V12 js */
.nav-left {
  user-select: text;
}

/* Right side nav links container */
.nav-right {
  display: flex;
  gap: 12px;
}

/* Nav links minimalist boxy style */
.nav-link {
  color: white;
  background: transparent;
  padding: 6px 12px;
  border: 2px solid white;
  border-radius: 5px;
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1;
  transition: background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* On hover & focus: invert colors */
.nav-link:hover,
.nav-link:focus {
  background: white;
  color: #222;
  outline: none;
}

/* Container grid below navbar */
#container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 2fr 1fr;
  gap: 6px;
  height: calc(100vh - 50px);
  margin-top: 50px; /* push below navbar */
  padding: 6px;
  box-sizing: border-box;
}

/* Panes styling */
#editorPane {
  grid-column: 1;
  grid-row: 1 / 2;
  border: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#outputPane {
  grid-column: 2;
  grid-row: 1 / 2;
  border: 1px solid #ccc;
  background: #1a1a1a;
  color: white;
  padding: 10px;
  overflow: auto;
  box-sizing: border-box;
}

#flowchartPane {
  grid-column: 1 / 3;
  grid-row: 2;
  border: 1px solid #aaaaaa;
  background: #f9f9f9;
  padding: 10px;
  overflow: auto;
  box-sizing: border-box;
}

/* Headings */
h3 {
  margin: 0 0 8px 0;
  font-weight: 600;
  font-size: 1rem;
}

/* CodeMirror editor fills editorPane */
.CodeMirror {
  flex-grow: 1;
  font-family: monospace;
  font-size: 15px;
  background: rgb(255, 255, 255);
  overflow: hidden;
}

/* Scroll inside CodeMirror */
.CodeMirror-scroll {
  height: 100%;
  overflow: auto !important;
}

/* Error message styling */
#errorMsg {
  color: red;
  white-space: pre-wrap;
  font-weight: bold;
}

/* Highlight error lines in editor */
.cm-errorLine {
  background-color: #fffa8c !important; /* bright yellow */
}

#flowchart-wrapper {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  background: rgba(219, 211, 60, 0.2); /* frosty white */
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: grab;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); /* for Safari */
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}


#flowchart-wrapper:active {
  cursor: grabbing;
}

#flowchartContent {
  transform-origin: 0 0;
  transition: transform 0.1s ease-out;
}

/* Dark theme styles */
body.dark {
  background: #181818;
  color: #e0e0e0;
}

body.dark #navbar {
  background: #181818;
  color: #e0e0e0;
}

body.dark .nav-link {
  color: #e0e0e0;
  border-color: #e0e0e0;
  background: transparent;
}

body.dark .nav-link:hover,
body.dark .nav-link:focus {
  background: #e0e0e0;
  color: #181818;
}

body.dark #outputPane {
  background: #23272e;
  color: #e0e0e0;
}

body.dark #flowchartPane {
  background: #23272e;
  color: #e0e0e0;
}

body.dark #editorPane {
  background: #23272e;
}

body.dark .CodeMirror {
  background: #23272e;
  color: #e0e0e0;
}

body.dark .cm-errorLine {
  background-color: #fffa8c !important;
}

body.dark #flowchart-wrapper {
  background: rgba(60, 60, 60, 0.2);
  border-color: rgba(255,255,255,0.1);
}

/* Theme toggle slider styles */
.theme-toggle-slider {
  position: relative;
  width: 52px;
  height: 28px;
  background: #444;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 10px;
  transition: background 0.2s;
}

.theme-toggle-slider .slider {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.2s, background 0.2s;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.theme-toggle-slider .icon {
  position: absolute;
  font-size: 1.1em;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.2s;
}

.theme-toggle-slider .icon.sun {
  left: 7px;
  color: #f7d51d;
  opacity: 1;
}

.theme-toggle-slider .icon.moon {
  right: 7px;
  color: #4a90e2;
  opacity: 0.7;
}

body.dark .theme-toggle-slider {
  background: #222;
}

body.dark .theme-toggle-slider .slider {
  left: 27px;
  background: #333;
}

body.dark .theme-toggle-slider .icon.sun {
  opacity: 0.5;
}

body.dark .theme-toggle-slider .icon.moon {
  opacity: 1;
}