/* Version Number API - Styles */
/* Enhancement: Added styling for "now" links next to datepickers */
/* Fixed CSS compatibility issues with mask property */
/* Enhancement: Adjusted "now" links positioning and font weight */
/* Enhancement: Updated styling to place "now" links inside the date-time picker fields */

:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #dbeafe;
  --success-color: #10b981;
  --success-light: #d1fae5;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --bg-color: #ffffff;
  --bg-secondary: #f8fafc;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 0 10px rgba(0, 0, 0, 0.1);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --gradient-border: linear-gradient(to right, #a855f7, #eab308, #f97316);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  padding: 0;
  margin: 0;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

main {
  padding: 40px 0 120px;
}

section {
  background-color: var(--bg-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2em;
  margin-top: 30px;
  margin-bottom: 40px;
  position: relative;
}

section:last-child {
  margin-bottom: 80px;
}

section > h1:first-child,
section > h2:first-child,
section > h3:first-child,
section > h4:first-child {
  margin-top: 0;
}

section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: var(--gradient-border);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
}

h1 {
  font-size: 2rem;
  margin-bottom: 16px;
}

h2 {
  font-size: 1.5rem;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

h3 {
  font-size: 1.25rem;
  margin: 24px 0 16px;
}

h4 {
  font-size: 1rem;
  margin: 20px 0 12px;
}

p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

code {
  background-color: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

pre {
  background-color: var(--bg-secondary);
  padding: 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  margin: 16px 0;
}

pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: inherit;
}

ul, ol {
  margin: 16px 0;
  padding-left: 24px;
}

li {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.parameter {
  font-weight: 600;
  color: var(--text-primary);
}

.live-example {
  background-color: var(--bg-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.example-header {
  margin-bottom: 1rem;
}

.example-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--primary-color);
}

.example-grid {
  display: grid;
  gap: 1rem;
}

.field-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 1rem;
}

.field-label {
  font-weight: 500;
  color: var(--text-primary);
}

.field-value {
  width: 100%;
}

.example-footer {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-start;
}

.button-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.button-secondary svg {
  width: 16px;
  height: 16px;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--primary-color);
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background-color: var(--primary-light);
  transition: all 0.2s ease;
}

.icon-link:hover {
  background-color: rgba(59, 130, 246, 0.2);
  text-decoration: none;
}

.icon-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.field-container {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

@media (min-width: 640px) {
  .field-container {
    flex-direction: row;
    align-items: center;
  }
}

.field-label {
  font-weight: 500;
  margin-bottom: 8px;
  width: 120px;
  color: var(--text-primary);
}

@media (min-width: 640px) {
  .field-label {
    margin-bottom: 0;
  }
}

.field-value {
  flex: 1;
}

.field-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9rem;
  background-color: var(--bg-color);
  transition: border-color 0.2s ease;
}

/* Date input container for positioning the now link */
.date-input-container {
  position: relative;
  display: inline-block;
  width: auto;
}

.date-input-container .field-input {
  padding-right: 50px; /* Add extra padding on the right to make room for the "now" link */
}

/* Make date inputs shorter by removing whitespace and adjust calendar icon position */
input[type="datetime-local"] {
  width: auto;
  min-width: 200px;
  position: relative;
}

/* Move calendar icon 3px to the left */
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  position: relative;
  left: -3px;
}

.field-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

#versionDisplay {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9rem;
  background-color: var(--bg-color);
  min-width: 100px;
  height: 38px;
  line-height: 20px;
  box-sizing: border-box;
  text-align: left;
}

.api-endpoint {
  display: flex;
  align-items: center;
  background-color: var(--bg-secondary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin: 16px 0;
  border: 1px solid var(--border-color);
}

.http-method {
  font-weight: 600;
  color: var(--primary-color);
  margin-right: 12px;
}

.endpoint-path {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9rem;
}

.response-container {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin: 16px 0;
  overflow: hidden;
}

.response-header {
  background-color: var(--bg-secondary);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.response-body {
  padding: 16px;
}

.response-body pre {
  margin: 0;
  border: none;
  background: none;
  padding: 0;
}

footer {
  background-color: var(--bg-color);
  border-top: 1px solid var(--border-color);
  padding: 20px 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 10;
}

.footer-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.footer-content {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.footer-content p {
  margin: 0;
}

.menu-icon {
  width: 24px;
  height: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  position: relative;
}

.menu-dropdown {
  position: absolute;
  bottom: 32px;
  right: 0;
  background-color: var(--bg-color);
  border: 1px solid #E2E8F1;
  border-radius: var(--radius-md);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
  min-width: 150px;
  z-index: 100;
  display: none;
}

.menu-dropdown.active {
  display: block;
}

.menu-item {
  padding: 12px 16px;
  display: block;
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.menu-item:hover {
  background-color: var(--bg-secondary);
  text-decoration: none;
}

.menu-item:first-child {
  border-top-left-radius: calc(var(--radius-md) - 1px);
  border-top-right-radius: calc(var(--radius-md) - 1px);
}

.menu-item:last-child {
  border-bottom-left-radius: calc(var(--radius-md) - 1px);
  border-bottom-right-radius: calc(var(--radius-md) - 1px);
}

.menu-icon-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: -3px;
  position: relative;
  top: -1px;
}

.menu-icon-small svg {
  display: block;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0);
  z-index: 50;
  display: none;
}

.overlay.active {
  display: block;
}

.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  background-color: var(--bg-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.15), 0 0 30px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 0, 0, 0.05);
  padding: 24px;
  max-width: 400px;
  width: 90%;
  z-index: 101;
  display: none;
  backface-visibility: hidden;
  -webkit-font-smoothing: subpixel-antialiased;
}

.popup::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: var(--gradient-border);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.6);
  border: none;
}

.popup.active {
  display: block;
  animation: popupAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  transform-origin: center bottom;
}

@keyframes popupAppear {
  0% {
    opacity: 0;
    transform: translate(-50%, -45%) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.popup-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.popup-close {
  cursor: pointer;
  color: var(--text-secondary);
}

.popup-close:hover {
  color: #000;
}

.popup-content {
  padding: 16px 0 0;
  line-height: 1.6;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary-color);
  color: white;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-decoration: none;
  border: none;
  font-size: 0.9rem;
}

.button:hover {
  background-color: var(--primary-hover);
  text-decoration: none;
}

.button-secondary {
  background-color: white;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.button-secondary:hover {
  background-color: var(--primary-light);
  color: var(--primary-hover);
}

/* Style for the "now" links */
.now-link {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--primary-color);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
  position: absolute;
  right: 20px; /* Position from the right edge of the container */
  top: 50%;
  transform: translateY(-50%);
  z-index: 2; /* Ensure the link appears above the input */
}

.now-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}
