body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background-color: #f4f4f4;
}

.ribbon {
  background-color: #1e1e1e;
  color: white;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.ribbon h1 {
  margin: 0;
  font-size: 22px;
}

.compare-btn {
  background-color: #007acc;
  color: white;
  border: none;
  padding: 8px 14px;
  margin: 6px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}

.compare-btn:hover {
  background-color: #005fa3;
}

.container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 20px;
  justify-content: space-around;
}

.code-box {
  flex: 1;
  min-width: 320px;
  display: flex;
  flex-direction: column;
}

.code-box label {
  font-weight: bold;
  margin-bottom: 5px;
}

.CodeMirror {
  height: 500px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: white;
}

#result {
  padding: 20px;
  margin: 20px;
  background: #ffffff;
  border-left: 5px solid #61dafb;
  border-radius: 6px;
  display: none;
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 14px;
}

/* Optional responsive tweak */
@media screen and (max-width: 768px) {
  .container {
    flex-direction: column;
    padding: 10px;
  }

  .code-box {
    width: 100%;
  }
}

#history-container {
  background: #ffffff;
  padding: 20px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  font-size: 14px;
}

.history-item {
  border-bottom: 1px solid #ccc;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: monospace;
  flex: 1;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-actions input[type="checkbox"] {
  transform: scale(1.2);
  cursor: pointer;
}
/* Tooltip wrapper */
.history-tooltip-wrapper {
  position: relative;
  display: inline-block;
}

/* Tooltip wrapper */
.tooltip-wrapper {
  position: relative;
  display: inline-block;
}

/* Tooltip box */
.tooltip-reminder {
  display: none;
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #fff8e1;
  color: #8a6d3b;
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid #ffe58f;
  border-radius: 5px;
  white-space: nowrap;
  z-index: 999;
  box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.1);
}

/* Show on hover */
.tooltip-wrapper:hover .tooltip-reminder {
  display: block;
}

/* Dark mode base */
body.dark-mode {
  background-color: #121212;
  color: #ffffff;
}

/* === Dark mode for the main comparison result area === */
body.dark-mode #result {
  background-color: #1f1f1f !important;
  color: #e0e0e0 !important;
}

/* Correct lines (green) */
body.dark-mode #result div[style*="background-color:#e7fbe7"] {
  background-color: #2a3b2a !important;
  color: #b9fbc0 !important;
}

/* Incorrect lines (red) */
body.dark-mode #result div[style*="background-color:#ffe6e6"] {
  background-color: #5c1e1e !important;
  color: #ffcfcf !important;
}

/* === Dark mode for the history page === */
body.dark-mode #history-container {
  background-color: #1e1e1e;
  color: #ffffff;
}

body.dark-mode .history-item {
  background-color: #2a2a2a;
  border: 1px solid #444;
  margin-bottom: 15px;
  padding: 10px;
  border-radius: 5px;
}

body.dark-mode .history-item pre {
  background-color: #1a1a1a;
  color: #e6e6e6;
}

body.dark-mode #history-container hr {
  border-color: #444;
}

/* === Logo + Tagline Styling === */
.logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* keeps aligned with buttons as now */
}

.logo-text h1 {
  margin: 0;
}

.tagline {
  font-size: 0.8em;
  margin: 0;
  color: #ccc; /* lighter shade for subtle look */
  margin-top: -5px; /* bring closer to 'Ferens' */
}


/* Ensure both code blocks in each history item match heights */
.history-item {
  align-items: stretch; /* Make children stretch to same height */
}

.history-item pre {
  display: flex;
  flex-direction: column;
  flex: 1; /* Equal width */
  background-color: #f5f5f5; /* Light mode background */
}

/* Dark mode version */
body.dark-mode .history-item pre {
  background-color: #1e1e1e; /* Match dark mode editor bg */
  color: #d4d4d4; /* Light text for contrast */
}


/* === Diff Highlighting in History Page === */
.history-diff {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.history-code {
  width: 48%;
  background: #f5f5f5; /* light mode background */
  color: #000;
  padding: 10px;
  border-radius: 5px;
  overflow-x: auto;
}

.diff-added {
  background-color: rgba(0, 255, 0, 0.3);
}

.diff-removed {
  background-color: rgba(255, 0, 0, 0.3);
}

/* Dark mode for side-by-side diff */
body.dark-mode .history-code {
  background-color: #1e1e1e;
  color: #d4d4d4;
}

body.dark-mode .diff-added {
  background-color: rgba(0, 128, 0, 0.4);
}

body.dark-mode .diff-removed {
  background-color: rgba(128, 0, 0, 0.4);
}
/* === Fix history diff layout === */
.history-item {
  display: block; /* reset old flex */
  margin-bottom: 20px;
}

.history-diff {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.history-code {
  flex: 1;
  min-width: 0; /* prevents overflow */
  max-width: 50%;
  background: #f5f5f5;
  color: #000;
  padding: 10px;
  border-radius: 5px;
  overflow-x: auto;
  white-space: pre-wrap;
  font-family: monospace;
}

/* Dark mode override */
body.dark-mode .history-code {
  background-color: #1e1e1e;
  color: #d4d4d4;
}
