/* General body styles */
body {
  font-family: 'Poppins', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: #f1f1f1;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100vh; /* Full viewport height */
  transition: background-color 0.3s ease, color 0.3s ease;
  box-sizing: border-box;
}

/* Dark theme */
body.dark-theme {
  background-color: #121212;
  color: #f1f1f1;
}

h3 {
  margin-top: 0;
  color: inherit;
}

/* Buttons Container */
.buttons-container {
  background-color: #f8f8f8; 
  border-radius: 8px; 
  box-shadow: var(--shadow-light);
  margin: 20px auto; 
  width: 90%; 
  max-width: 1200px; 
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box; 
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Dark Theme Buttons Container */
body.dark-theme .buttons-container {
  background-color: #333; 
  box-shadow: 0px 4px 6px rgba(255, 255, 255, 0.1);  
}

/* Control Buttons */
.toggle-buttons {
  display: flex;
  justify-content: space-between;
  width: 100%; 
}

/* Right Buttons Layout */
.right-buttons {
  display: flex;
  gap: 15px;
}

/* Individual Button Styles */
.toggle-buttons button {
  padding: 10px 20px;
  font-size: 1em;
  background-color: #6542be;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

button:hover {
  transform: scale(1.05);
}

.toggle-buttons button:hover,
#run-button:hover,
#clear-button:hover,
#hint-button:hover,
#answer-button:hover,
#see-solution-button:hover {
  background-color: #5933a4;
}

#cancel-button:hover {
  background-color: #c0392b;
}

.toggle-buttons i {
  font-size: 1.2em;
}

/* Dark Theme Button Styles */
body.dark-theme .toggle-buttons button {
  background-color: #555;
  color: #f1f1f1;
}

body.dark-theme button:hover {
  background-color: #444;
}

body.dark-theme button {
  background-color: #555;
  color: white;
}

/* Header Styles */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100px;
    padding: 20px 20px;
    background-color: #6542be;
    color: white;
    box-shadow: var(--shadow-light);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
    border-radius: 0;
}

/* Left Section: Logo */
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
}

.logo {
    height: 60px;
    width: auto;
}

/* Right Section: Buttons */
.header-right {
    display: flex;
    gap: 15px;
    margin-right: 20px;
}

.header-right button {
    padding: 10px 20px;
    font-size: 1em;
    background-color: #ede7ff;
    color: #6542be;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Dark Theme Styles */
body.dark-theme .header-container {
    background-color: #222;
}

body.dark-theme .header-right button {
    background-color: #555;
    color: white;
}

/* Add padding to the body to avoid overlap with the fixed header */
body {
    padding-top: calc(var(--header-padding) * 6);
    margin: 0;
}

/* Responsive styles for smaller devices */
@media (max-width: 768px) {
  .buttons-container {
    padding: 15px 20px;
  }

  .toggle-buttons {
    flex-direction: column; 
    gap: 10px;
  }

  .right-buttons {
    justify-content: center;
    width: 100%;
  }
}


/* Define the three text sizes using CSS variables */
:root {
  --container-padding: 20px;
  --header-padding: 20px;
  --editor-font-size: 1em;
  --output-font-size: 1em;
}

.container {
  flex-grow: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: flex-direction 0.3s ease;
  box-sizing: border-box;
}

.container.side-by-side {
  flex-direction: row;
  gap: 20px;
  overflow-x: hidden;
  height: auto;
}

.buttons-container,
.modal-content,
.instruction-container,
.editor-container,
.output-container {
  padding: var(--container-padding);
}

.instruction-container,
.editor-container,
.output-container {
  background-color: white;
  border-radius: 8px;
  box-shadow: var(--shadow-medium);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  box-sizing: border-box;
  max-height: 500px;
}

/* Instruction Container (30% width) */
.instruction-container {
  width: 20%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%; /* Increase height */
  min-height: 800px; /* Adjust minimum height */
}

/* Style each section */
.instruction-container .section {
    flex: 1;
    display: flex;
    justify-content: left;
    align-items: left;
    padding: 10px;
}

/* Specific styles for each section */
.title-section {
    flex-direction: column;
    text-align: left;
}

.challenge-section {
    text-align: left;
}

.hint-section {
	display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.buttons-section {
    flex-direction: row;
    gap: 10px;
}

/* Code Editor and Output Containers (35% width each) */
.editor-container, .output-container {
  width: 40%;
  min-width: 0;
  height: 100%; /* Ensure they fill the parent */
  min-height: 800px; /* Adjust minimum height */
}

/* Code editor area */
#editor {
  height: 100%;
  min-height: 300px;
  background-color: #1e1e1e;
  border-radius: 8px;
  color: #f1f1f1;
  font-size: var(--editor-font-size);
}

/* Ensure CodeMirror adjusts to the height change */
.CodeMirror {
  height: 100% !important;
  min-height: 300px;
  font-size: var(--editor-font-size);
}

#output {
  background-color: #f4f4f9;
  padding: 10px;
  border-radius: 8px;
  color: #333;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
  flex-grow: 1;
  font-size: var(--output-font-size);
}

/* Dark theme styles for editor and output */
body.dark-theme .instruction-container,
body.dark-theme .editor-container,
body.dark-theme .output-container {
  background-color: #333;
  color: #f1f1f1;
}

body.dark-theme #output {
  background-color: #2e2e2e;
  color: #d3d3d3;
}

/* Footer */
footer {
  background-color: #472e85;
  color: white;
  text-align: center;
  padding: 10px;
  font-size: 14px;
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
}

footer p {
  margin: 0;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    padding: 10px;
  }

  .instruction-container,
  .editor-container,
  .output-container {
    width: 100%;
	height: 50px;
  }

  .instruction-container {
    margin-bottom: 20px;
  }
}

/* Align the editor and output header content */
.editor-header,
.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* Section Title Styling */
.section-title {
    margin: 0;
    font-size: 1.2em;
    font-weight: bold;
    color: inherit;
}

/* Run and Clear Button Styling */
#run-button,
#clear-button {
    padding: 8px 15px;
    font-size: 0.9em;
    background-color: #6f42c1;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Dark Theme Styling for Buttons */
body.dark-theme #run-button,
body.dark-theme #clear-button {
    background-color: #555;
    color: white;
}

/* Style for the container holding Hint and Answer buttons */
.centered-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 10px;
}

/* Align Hint Text */
#hint-container {
  background-color: #f8f8f8;
  padding: 10px;
  border-radius: 8px;
  box-shadow: var(--shadow-light);
  margin-bottom: 10px;
  color: #333;
}

/* Dark theme for hint text */
body.dark-theme #hint-container {
  background-color: #333;
  color: #f1f1f1;
}

/* Style for Hint and Answer buttons */
#hint-button, #answer-button {
  padding: 10px 20px;
  font-size: 1em;
  background-color: #6542be;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

/* Icon styling */
#hint-button i, #answer-button i {
  font-size: 1.2em;
}

/* Dark theme button styling */
body.dark-theme #hint-button, body.dark-theme #answer-button {
  background-color: #555;
}

/* Ensuring the hint and answer buttons stay at the bottom */
#hint-answer-buttons {
	flex-direction: row;
    gap: 10px;
  margin-top: auto;
  padding-top: 20px;
}

/* Styling the challenge dropdown */
.challenge-dropdown {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    background-color: #f4f4f9;
    color: #000000;
    border: 1px solid #c9c9c9;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.challenge-dropdown:active,
.challenge-dropdown:focus {
    box-shadow: none;
    outline: none;
}

/* Modal Background */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

/* Modal Content */
.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-dark);
  width: 300px;
  text-align: center;
}

/* Dark Theme for Modal */
body.dark-theme .modal-content {
  background-color: #333;
  color: #f1f1f1;
}

/* Modal Close Button */
.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 20px;
  cursor: pointer;
}

/* Modal Buttons */
.modal-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

/* Style for Cancel and See Solution Buttons */
#cancel-button, #see-solution-button {
  padding: 10px 15px;
  font-size: 1em;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  width: 45%;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

#cancel-button {
  background-color: #e74c3c;
  color: white;
}

#see-solution-button {
  background-color: #6542be;
  color: white;
}

/* Dark Theme Button Styles */
body.dark-theme #cancel-button {
  background-color: #a33;
}

/* Dark theme footer styles */
body.dark-theme footer {
  background-color: #222222;
  color: #d3d3d3;
}
