/* 
 * CSS Variables for consistent theming
 * 
 * Usage in CSS: background-color: var(--color-webex-blue);
 * Usage in JS: element.style.backgroundColor = 'var(--color-success)';
 * 
 * Available variables:
 * --color-success: Success state (green)
 * --color-success-hover: Success hover state
 * --color-danger: Error/danger state (red)
 * --color-danger-hover: Danger hover state
 * --color-error-bg: Error message background (light red)
 * --color-error-text: Error message text color
 * --color-webex-blue: Primary brand color
 * --color-webex-blue-hover: Primary brand hover color
 * --color-background: Page background color (light gray)
 *
 * Units: Use rem for font-size, padding, margin, gap, border-radius (scales with root).
 *        Use px for 1px borders, box-shadow blur/spread, sticky offsets, scrollbar size (crisp, consistent).
 */
:root {
  --color-success: #28a745;
  --color-success-hover: #218838;
  --color-danger: #dc3545;
  --color-danger-hover: #c82333;
  --color-error-bg: #fee;
  --color-error-text: #721c24;
  --color-webex-blue: #00bceb;
  --color-webex-blue-hover: #0099ba;
  --color-background: #f5f5f5;
}

* {
  box-sizing: border-box;
}

::-webkit-scrollbar {
  -webkit-appearance: none;
  width: 7px;
}

::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--color-background);
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header_anchor {
  text-decoration: none;
}

#header {
  position: sticky;
  top: 0;
  background-color: var(--color-webex-blue);
  color: white;
  padding: 1.25rem;
  /* 20px */
  margin: 0;
  text-align: left;
  /* Align the title text to the left */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  font-size: 1.5rem;
  z-index: 1000;
  /* Ensure the header is above other content */
}

#body {
  flex: 1;
  padding: 1.25rem;
  /* 20px */
}

#footer {
  background-color: var(--color-background);
  text-align: center;
  padding: 0.625rem;
  /* 10px */
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2);
}

#footer a {
  color: var(--color-webex-blue);
  text-decoration: none;
  font-weight: bold;
}

#footer a:hover {
  text-decoration: underline;
}

/* Rest of the CSS for form and results remains the same */

form#search-form {
  padding: 0.625rem;
  /* 10px */
}

label {
  display: block;
  margin-bottom: 0.5rem;
  /* 8px */
  color: #333;
}

input[type='text'],
select {
  width: 100%;
  padding: 0.625rem;
  margin-bottom: 1.25rem;
  border: 1px solid #ccc;
  border-radius: 0.25rem;
  box-sizing: border-box;
}

button {
  background-color: var(--color-webex-blue);
  color: white;
  padding: 0.625rem 1.25rem;
  /* 10px 20px */
  border: none;
  border-radius: 0.25rem;
  /* 4px */
  cursor: pointer;
  font-size: 1rem;
  /* 16px */
  transition: background-color 0.3s;
}

button:hover {
  background-color: var(--color-webex-blue-hover);
}

table {
  width: 100%;
  border-collapse: collapse;
}

table,
th,
td {
  border: 1px solid #ccc;
}

th,
td {
  padding: 0.625rem;
  /* 10px */
  text-align: left;
}

th {
  background-color: var(--color-background);
}

.search-container {
  background: white;
  border-radius: 0.5rem;
  /* 8px */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: auto;
  width: 100%;
  padding: 1.25rem;
  /* 20px */
  box-sizing: border-box;
  /* Include padding in the width calculation */
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  /* 20px */
}

.form-group {
  flex: 1 1 25%;
  /* Each form group will take up half the width of the form-row */
  padding: 0 0.625rem;
  /* 10px */
  box-sizing: border-box;
}

.full-width {
  margin: 0 0.625rem;
  /* 10px */
}

.results-container {
  width: 100%;
  background: white;
  padding: 1.25rem;
  /* 20px */
  border-radius: 0.5rem;
  /* 8px */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: auto;
  margin-top: 1.25rem;
  /* 20px */
}

/* Responsive styles */
@media (max-width: 48rem) {

  /* 768px */
  .form-group {
    flex: 1 1 100%;
    /* Each form group will take up the full width on smaller screens */
    padding: 0 0.625rem;
    /* 10px */
  }
}

.changelog-item {
  padding-bottom: 1.25rem;
  /* 20px */
  margin-bottom: 1.25rem;
  /* 20px */
  border-bottom: 0.1875rem solid #e4e5e6;
  /* 3px */
}

.changelog-item h2,
.changelog-item h3 {
  color: #333;
  margin-bottom: 0.625rem;
  /* 10px */
}

.changelog-item .commits {
  margin-top: 1.25rem;
  /* 20px */
  margin-bottom: 1.25rem;
  /* 20px */
}

.changelog-item .commits ul {
  margin-top: 0.625rem;
  /* 10px */
  list-style-type: none;
  padding: 0;
  max-height: 12.5rem;
  /* 200px */
  overflow: scroll;
}

.changelog-item .commits ul li {
  background-color: #eee;
  margin-bottom: 0.3125rem;
  /* 5px */
  padding: 0.625rem;
  /* 10px */
  border-radius: 0.1875rem;
  /* 3px */
  word-wrap: break-word;
}

.changelog-item .commit-hash {
  font-family: monospace;
}

.changelog-item .related-packages {
  position: relative;
}

.changelog-item .related-packages .table-wrapper {
  max-height: 12.5rem;
  overflow: scroll;
  border: 1px solid #ddd;
  margin-top: 0.625rem;
}

.changelog-item .related-packages table {
  width: 100%;
  border-collapse: collapse;
}

.changelog-item table thead {
  position: sticky;
  top: -1px;
}

.changelog-item th,
.changelog-item td {
  border: 1px solid #ddd;
}

.changelog-item th,
.changelog-item td {
  padding: 0.625rem;
  /* 10px */
  text-align: left;
}

.changelog-item th {
  background-color: #f7f7f7;
}

.changelog-item tbody tr:nth-child(odd) {
  background-color: #f9f9f9;
}

.changelog-item tbody tr:hover {
  background-color: #f1f1f1;
}

.copy-button {
  display: inline;
  position: absolute;
  margin-left: 0.3125rem;
  /* 5px */
  cursor: pointer;
  right: 0;
}

.copy-button img {
  width: 1.25rem;
  /* 20px */
  height: auto;
  margin-right: 0.3125rem;
  /* 5px */
}

footer {
  margin: 1.25rem 0;
  /* 20px 0px */
}

footer .copyright {
  text-align: center;
  margin: 0 auto;
}

.alert-info {
  background-color: #f0f9ff;
  border-left: 0.375rem solid var(--color-webex-blue);
  /* 6px */
  color: #333;
  padding: 0.625rem;
  /* 10px */
  margin-bottom: 1.25rem;
  /* 20px */
}

.alert-info p.note {
  font-weight: bold;
  color: var(--color-webex-blue);
}

.alert-info p.warning {
  font-weight: bold;
  color: #ff7f0e;
  display: inline;
}

/* ============================================
   VERSION COMPARISON STYLES
   ============================================ */

/* Mode Toggle Buttons */
.mode-toggle {
  display: flex;
  gap: 0.625rem;
  /* 10px */
  margin-bottom: 1.25rem;
  /* 20px */
}

.mode-toggle button {
  flex: 1;
  padding: 0.75rem 1.25rem;
  border: 2px solid var(--color-webex-blue);
  background-color: white;
  color: var(--color-webex-blue);
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 0.25rem;
  /* 4px */
  font-weight: 500;
}

.mode-toggle button:hover {
  background-color: #e6f7fb;
}

.mode-toggle button.active {
  background-color: var(--color-webex-blue);
  color: white;
}

/* Hide utility class */
.hide {
  display: none !important;
}

/* Version Comparison: make form box full width (equal to Note box above) and expand height */
#changelog-form-row.comparison-view-active #comparison-form-column {
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 100%;
}

#changelog-form-row.comparison-view-active #comparison-helper-column {
  display: none;
}

#changelog-form-row.comparison-view-active #comparison-form-column .search-container {
  min-height: 20rem;
  padding: 1.75rem 1.5rem;
  overflow: visible;
}

#changelog-form-row.comparison-view-active #comparison-form-column {
  overflow: visible;
}

/* Let the package dropdown list show all options (avoid clipping) */
#comparison-form #comparison-package-row {
  overflow: visible;
}

#comparison-form select#comparison-package-select {
  max-height: none;
}

#comparison-form-column select {
  position: relative;
  z-index: 10;
}

#comparison-form-column select:focus {
  z-index: 11;
}

/* Comparison form: package first, version row with clear buttons */
#comparison-form .comparison-package-full-width {
  flex: 1 1 100%;
}

#comparison-form .required-asterisk {
  color: var(--color-danger);
}

#comparison-form .select-with-clear {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#comparison-form .select-with-clear select.full-width {
  flex: 1;
  margin: 0;
}

.btn-clear-circle {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #ccc;
  background-color: #f5f5f5;
  color: var(--color-danger);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s;
}

.btn-clear-circle:hover:not(:disabled) {
  background-color: #ffe0e0;
  color: var(--color-danger-hover);
}

.btn-clear-circle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Comparison Form */
#comparison-form {
  margin-top: 1.25rem;
  /* 20px */
}

/* Comparison Results Table */
#comparison-results .table-wrapper {
  max-height: 31.25rem;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid #ddd;
  border-radius: 0.25rem;
  margin-top: 0.625rem;
  position: relative;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  font-size: 0.875rem;
  /* 14px */
}

.comparison-table th,
.comparison-table td {
  padding: 0.75rem;
  text-align: left;
  border: 1px solid #ddd;
}

.comparison-table th {
  background-color: var(--color-webex-blue);
  color: white;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 10;
}

.comparison-table tbody tr {
  transition: background-color 0.2s;
}

.comparison-table tbody tr:hover {
  background-color: var(--color-background) !important;
}

/* Color Coding for Changes */
.comparison-table tr.version-changed {
  background-color: #fff3cd;
  /* Yellow - version changed */
  border-left: 0.25rem solid #ffc107;
  /* 4px */
}

.comparison-table tr.only-in-a {
  background-color: #f8d7da;
  /* Red - removed in B */
  border-left: 0.25rem solid #dc3545;
  /* 4px */
}

.comparison-table tr.only-in-b {
  background-color: #d4edda;
  /* Green - added in B */
  border-left: 0.25rem solid #28a745;
  /* 4px */
}

.comparison-table tr.unchanged {
  background-color: #ffffff;
  /* White - no change */
}

/* Comparison Summary */
.comparison-summary {
  background: linear-gradient(135deg, #e7f3ff 0%, #f0f9ff 100%);
  padding: 1.5625rem;
  /* 25px */
  border-radius: 0.5rem;
  /* 8px */
  margin-bottom: 1.25rem;
  /* 20px */
  border-left: 0.3125rem solid var(--color-webex-blue);
  /* 5px */
}

.comparison-summary h3 {
  margin-top: 0;
  margin-bottom: 0.9375rem;
  /* 15px */
  color: var(--color-webex-blue);
  font-size: 1.5em;
}

.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9375rem;
  /* 15px */
  margin-top: 0.9375rem;
  /* 15px */
}

.stat-item {
  padding: 0.625rem 1.25rem;
  background-color: white;
  border-radius: 0.3125rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-size: 0.875rem;
}

.stat-item.changed {
  border-left: 0.25rem solid #ffc107;
  /* 4px */
}

.stat-item.unchanged {
  border-left: 0.25rem solid #6c757d;
  /* 4px */
}

.stat-item.added {
  border-left: 0.25rem solid #28a745;
  /* 4px */
}

.stat-item.removed {
  border-left: 0.25rem solid #dc3545;
  /* 4px */
}

.stat-item strong {
  font-size: 1.2em;
  color: #333;
}