@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

body {
    font-family: 'Poppins', sans-serif;  
    line-height: 1.6;
    color: #222;                         
    margin: 0;
    background-color: #f4f7f9;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}


header {
  background-color: #3498db; /* vibrant blue */
  color: #ffffff;
  text-align: center;
  padding: 1rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.15);
  font-family: 'Poppins', sans-serif;
}


.container {
  display: flex;
  /* flex-wrap: wrap; REMOVED to prevent panels from stacking */
  /* flex-grow: 1; REMOVED to allow container to shrink-wrap content height */
  padding: 20px;
  gap: 0; /* REMOVED gap to place handle directly between panels */
}

.editor-panel, .visual-panel {
  /* flex: 1; REPLACED with flex-basis for JS control */
  flex-basis: 50%; /* Initial width */
  min-width: 535px;
  background-color: #f0f8ff; /* soft light blue */
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevents content from spilling during resize */
}

/* The draggable divider between panels */
#drag-handle {
    width: 10px;
    cursor: col-resize; /* Indicates this is a horizontal resizer */
    background-color: #e0e0e0;
}


/* 🧩 Panel header layout */

/* Panel header: keep title, dropdown and controls on a single row */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid #e0e0e0;
  flex-wrap: nowrap; /* prevent the controls from dropping to the next line */
  gap: 12px;
}

/* 🧭 Left side: Code Editor title + Dropdown */
.panel-left {
  display: flex;
  align-items: center;
  gap: 6px; /* compact spacing between title and dropdown */
  flex-wrap: nowrap; /* ensure title and dropdown stay together */
}

/* 🎨 Dropdown and label */
.example-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Ensure the heading aligns vertically with the select */
.panel-left h3 {
  margin: 0;
  line-height: 36px; /* match #exampleSelector height */
  font-size: 1.05rem;
  font-family: 'Poppins', sans-serif;
}

.example-selector-wrapper label {
  font-weight: 600;
  color: #2c3e50;
  font-size: 15px;
  margin: 0;
  font-family: 'Poppins', sans-serif;
}

#exampleSelector {
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background-color: #fff;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  outline: none;
  height: 36px;
  font-family: 'Poppins', sans-serif;
}

#exampleSelector:hover,
#exampleSelector:focus {
  border-color: #3498db;
  box-shadow: 0 0 4px rgba(52, 152, 219, 0.3);
}

/* 🖲️ Right side: Buttons stay aligned */
.panel-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* 🔒 Hidden but accessible label */
.sr-only {
  /* Accessible visually-hidden utility: keeps content available for
     screen readers but removes it visually across browsers. */
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

h3 {
  margin: 0;
  color: #34495e;
  font-family: 'Poppins', sans-serif;
}

.animated-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.25s ease;
  background-color: white;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.8s ease forwards;
  font-family: 'Poppins', sans-serif;
}


.run-btn {
  background: linear-gradient(145deg, #2ecc71 0%, #27ae60 100%); /* vibrant green */
  color: #fff;
  border: none;
  box-shadow: 0 4px 8px rgba(46, 204, 113, 0.25);
  position: relative;
  overflow: hidden;
  font-family: 'Poppins', sans-serif;
}


.run-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.run-btn:hover::after {
  transform: translateX(100%);
}

.run-btn:hover {
  background: linear-gradient(145deg, #2ecc71 0%, #27ae60 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 14px rgba(46, 204, 113, 0.35);
}

.run-btn:active {
  background: linear-gradient(145deg, #1e8449 0%, #145a32 100%);
  transform: translateY(0) scale(0.98);
  box-shadow: 0 3px 6px rgba(39, 174, 96, 0.2);
}

.help-btn {
  background-color: #fdfefe;
  color: #3498db;
  border: 2px solid #3498db;
  border-radius: 10px;
  box-shadow: 0 3px 6px rgba(52, 152, 219, 0.15);
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
  font-family: 'Poppins', sans-serif;
}

.help-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(173, 216, 230, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.help-btn:hover::after {
  transform: translateX(100%);
}

.help-btn:hover {
  background-color: #3498db;
  color: white;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 12px rgba(52, 152, 219, 0.3);
}

.help-btn:active {
  background-color: #2e86c1;
  transform: translateY(0) scale(0.98);
  box-shadow: 0 3px 6px rgba(52, 152, 219, 0.25);
}

/* Font Awesome Icon Styling */
.button-icon {
  font-size: 1.15rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease;
}

.button-icon i {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, color 0.25s ease;
}

.run-btn:hover i {
  transform: scale(1.15);
  color: #eafaf1;
}

.help-btn:hover i {
  transform: scale(1.15);
  color: #fefefe;
}

/* Space Between Buttons */

.panel-header > div {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Fade-in animation */
@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

#code-editor {
  flex-grow: 1;
  border: none;
  padding: 15px;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

#drawing-canvas {
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  align-self: center;
  margin: 20px;
}

footer {
  padding: 20px;
}

.output-log {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#output-area {
  background-color: #ecf0f1;
  min-height: 100px;
  padding: 15px;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  font-family: 'Poppins', sans-serif;
}

/* 🪟 Help Modal Styling */
.modal {
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: #fefefe;
  padding: 20px 40px;
  border: 1px solid #888;
  width: 80%;
  max-width: 800px;
  border-radius: 8px;
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
}

.close-button {
  color: #aaa;
  position: absolute;
  top: 10px;
  right: 25px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-button:hover,
.close-button:focus {
  color: black;
}

/* 📖 Help Docs Styling */
#help-docs h2, #help-docs h3 {
  border-bottom: 2px solid #eee;
  padding-bottom: 5px;
  margin-top: 25px;
}

#help-docs code {
  background-color: #ecf0f1;
  padding: 2px 5px;
  border-radius: 4px;
}

#help-docs pre > code {
  display: block;
  padding: 10px;
}

#help-docs table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

#help-docs th, #help-docs td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

#help-docs th {
    background-color: #f2f2f2;
} 



#download-btn {
  background: linear-gradient(145deg, #f1c40f 0%, #f39c12 100%); /* bright yellow-orange */
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(241, 196, 15, 0.25);
  transition: all 0.25s ease;
  font-family: 'Poppins', sans-serif;
}


#download-btn:hover {
  background: linear-gradient(145deg, #f1c40f 0%, #f39c12 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 14px rgba(241, 196, 15, 0.35);
}

#download-btn:active {
  background: linear-gradient(145deg, #d68910 0%, #b9770e 100%);
  transform: translateY(0) scale(0.98);
  box-shadow: 0 3px 6px rgba(243, 156, 18, 0.2);
}


#clear-btn {
  background: linear-gradient(145deg, #74b9ff 0%, #0984e3 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(9, 132, 227, 0.25);
  transition: all 0.25s ease;
  font-family: 'Poppins', sans-serif;
}

#clear-btn:hover {
  background: linear-gradient(145deg, #82ccff 0%, #0a74d3 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 14px rgba(9, 132, 227, 0.35);
}

#clear-btn:active {
  background: linear-gradient(145deg, #0a6acb 0%, #0756b0 100%);
  transform: translateY(0) scale(0.98);
  box-shadow: 0 3px 6px rgba(9, 132, 227, 0.2);
}

#speedLabel {
  display: inline-block;
  min-width: 125px;
  text-align: left;
}

