/* Styles for Reverse Scheduler extension */

/* Overlay */
#reverseSchedulerOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Modal */
#reverseSchedulerModal {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  font-family: Roboto, Arial, sans-serif;
  font-size: 14px;
}

/* Main Button */
#reverseSchedulerBtn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  padding: 10px 20px;
  background-color: #4285F4;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: background-color 0.2s;
}

#reverseSchedulerBtn:hover {
  background-color: #3367d6;
}

/* Modal Content Layout */
#mainContainer {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  min-width: 0;
}

#leftPanel {
  flex: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#leftPanel > * {
  width: 100%;
  align-self: stretch;
}

#rightPanel {
  flex: 1;
  min-width: 160px;
  box-sizing: border-box;
}

/* Headers */
#reverseSchedulerModal h1 {
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 500;
}

.alpha-disclaimer {
  margin: 0 0 12px 0;
  font-size: 12px;
  font-style: italic;
  color: #666;
  line-height: 1.3;
}

#reverseSchedulerModal h2 {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Roboto', Arial, sans-serif;
}

#rightPanel h2 {
  text-align: center;
}

#reverseSchedulerModal h3 {
  font-size: 14px;
  font-weight: normal;
  margin-bottom: 8px;
}

/* Primary Event Section */
.primary-event-section h2 {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 500;
  align-items: baseline;
}

.input-group {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding-top: 4px;
}

.primary-event-container {
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  margin-bottom: 25px;
  width: 100%;
  box-sizing: border-box;
  gap: 10px;
  align-items: flex-end !important;
}

#primaryNameInput {
  width: 100%;
  border-right: none !important;
  border-top: none !important;
  border: 1px solid transparent;
  border-bottom: 1px solid #ccc;
}

#primaryDateInput {
  width: 100px;
  min-width: 80px;
  flex-shrink: 1;
}

#primaryNameInput, 
#primaryDateInput, 
#inlineTimePicker .flatpickr-time {
  height: 32px;
  box-sizing: border-box;
}

/* Base styles to prevent layout shifts */
#primaryNameInput, #primaryDateInput, #inlineTimePicker .flatpickr-time {
    border: 1px solid transparent;
    background-color: transparent;
    border-radius: 0;
}

/* 1. Primary Event Name Input */
#primaryNameInput {
  border-bottom: 1px solid #ccc; /* Default grey bottom border */
}
#primaryNameInput:focus {
  border-bottom-color: #4285f4; /* Blue on focus */
}

/* 2. Date Input */
#primaryDateInput {
    border-bottom: 1px solid #ccc;
}
#primaryDateInput:focus {
  border-bottom-color: #4285f4; /* Blue bottom border on focus */
}

/* 3. Time Picker - definitive rules */
#inlineTimePicker .flatpickr-time {
  border: 1px solid transparent; /* Reserve space, default transparent */
  border-bottom-color: #ccc;
  width: 102px;
  min-width: 80px;
  height: var(--input-height);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 4px 4px 8px 4px;
  flex-shrink: 1;
}
#inlineTimePicker .flatpickr-time:focus-within {
  border-bottom-color: #4285f4 !important; /* Blue on focus */
}

#inlineTimePicker .flatpickr-time {
  pointer-events: none;
}

#inlineTimePicker .flatpickr-time .numInputWrapper,
#inlineTimePicker .flatpickr-time .flatpickr-am-pm {
  pointer-events: auto;
}

/* Mobile time input styling to match other inputs */
.time-input-wrapper {
  position: relative;
  min-width: 80px;
  margin-left: 8px;
}

#reverseSchedulerModal input[type="time"] {
  width: 100%;
  min-width: 80px;
  font-family: inherit;
  color: #333;
  border: none;
  border-radius: 0;
  padding: 4px;
  height: 32px;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
  background-color: transparent;
  font-size: 14px;
  border-bottom: var(--input-border-bottom);
  outline: none !important;
}

#reverseSchedulerModal input[type="time"]:focus {
  border-bottom: 1px solid #4285f4 !important;
}

/* Time input placeholder overlay */
.time-placeholder-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px;
  color: var(--rs-placeholder-color);
  font-size: 14px;
  pointer-events: none;
  display: flex;
  align-items: center;
  z-index: 1;
}

/* Preceding Events Section */
.preceding-events-section h2 {
  margin: 16px 0 8px 0;
  font-size: 16px;
  font-weight: 500;
}

/* Options Panel */
.options-panel {
  margin-bottom: 12px;
}

.options-panel label {
  font-size: 14px;
  margin-right: 16px;
}

.options-panel input[type="checkbox"] {
  margin-right: 6px;
}

/* Sample List */
#sampleList {
  padding: 0;
  margin: 0;
  border: 1px solid #ccc;
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
}

#sampleList li {
  list-style: none;
  display: flex;
  align-items: center;
  padding: 8px;
  background: transparent;
  position: relative;
  gap: 8px;
  box-sizing: border-box;
  border-bottom: 1px solid #ccc;
}

.event-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

#sampleList li:last-child {
  border-bottom: none;
}

#sampleList li:hover {
  /* background-color: #f0f0f0; */
}

#sampleList input {
  color: black;
  font-family: 'Roboto', sans-serif;
  border: none;
  border-radius: 0;
  padding: 4px;
  height: 32px;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
  background-color: transparent;
  font-size: 14px;
  pointer-events: auto;
}

#reverseSchedulerModal #sampleList input:focus {
  border-bottom: 1px solid #4285f4 !important;
  outline: none !important;
  border-radius: 0;
}

/* Placeholder styling inherits from global rule; keep other attributes */
#sampleList input::placeholder {
  font-size: 14px;
  background: transparent;
}



/* Duration inputs (Hr and Min) have a flexible width */
.event-inputs .duration-input {
  flex: 0 0 auto;
  width: 35px;
  min-width: 0;
  text-align: center;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

/* Text inputs (Event Name) flex to fill available space */
.event-inputs input[type="text"]:not(.duration-input) {
  flex: 1 1 auto;
  min-width: 0;
}

/* Sample handle and clear icon */
.sample-handle {
  cursor: move;
  width: 40px !important;
  height: 32px !important; /* reduced height */
  line-height: 32px !important; /* vertical centering */
  font-size: 24px !important; /* smaller icon size */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding-bottom: 5px !important; /* new bottom padding */
  color: grey !important; /* grey icon */
  flex-shrink: 0;
}

.sample-handle:hover {
  transform: scale(1.2);
}

.clear-icon {
  cursor: pointer;
  position: absolute;
  right: -32px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: red;
  font-size: 18px;
  visibility: visible;
  transition: transform 0.2s ease;
  user-select: none;
  z-index: 10;
  background-color: #fff;
  border-radius: 50%;
  padding: 2px;
}

.clear-icon:hover {
  transform: translateY(-50%) scale(1.2);
}

/* Sortable drag and drop styles */
.sortable-ghost {
  background-color: #f5f5f5 !important;
  border: none !important;
  opacity: 0.8 !important;
  /* Remove all transitions from ghost/preview item */
  transition: none !important;
  animation: none !important;
}

.sortable-chosen {
  background-color: #fff !important;
  border: 2px solid #2196f3 !important;
  border-radius: 10px !important;
  opacity: 0.7 !important;
  /* Remove transitions from chosen item */
  transition: none !important;
  animation: none !important;
}

/* Change shadow back to grey when drag starts */
.sortable-chosen.drag-started {
  background-color: #c4c4c4 !important;
  border: none !important;
}

/* Hide form fields in the shadow when drag starts */
.sortable-chosen.drag-started input,
.sortable-chosen.drag-started .sample-handle,
.sortable-chosen.drag-started .clear-icon {
  visibility: hidden !important;
  opacity: 0 !important;
}

.sortable-drag {
  background-color: #fff !important;
  border: 2px solid #2196f3 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3) !important;
  margin-bottom: 4px !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
  /* Remove transitions from dragged item */
  transition: none !important;
  animation: none !important;
  /* Ensure dragged element is always visible */
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 9999 !important;
}

.sortable-drag * {
  visibility: visible !important;
  opacity: 1 !important;
}

/* Drop target indicators */
.drop-target-before {
  border-top: 2px solid #4285f4 !important;
  background-color: #e3f2fd !important;
}

.drop-target-after {
  border-bottom: 2px solid #4285f4 !important;
  background-color: #e3f2fd !important;
}

/* Buttons */
.action-buttons {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

/* Schedule and Close Buttons */
.schedule-btn {
  background-color: #4285F4;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  margin-right: 8px;
  transition: background-color 0.2s ease;
}

.schedule-btn:hover {
  background-color: #3367d6;
}

.close-btn {
  background-color: #f1f3f4;
  color: #3c4043;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.close-btn:hover {
  background-color: #e8eaed;
}

.add-row-btn {
  background-color: #f1f3f4;
  color: #3c4043;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 0; /* Align with Confirm button */
  transition: background-color 0.2s ease;
}

.add-row-btn:hover {
  background-color: #e8eaed;
}

.remove-row-btn {
  background: none;
  border: none;
  color: red;
  font-weight: bold;
  cursor: pointer;
  width: 20px;
  display: inline-block;
  text-align: center;
}

/* Timeline */
#timelinePreview {
  margin-bottom: 12px;
}

.timeline {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-event {
  position: relative;
  padding-bottom: 8px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.timeline-event.visible {
  opacity: 1;
  margin-bottom: 4px;
}

.event-details {
  position: relative;
  text-align: center;
  padding: 0 40px; /* space for retry button */
}

.event-info {
  display: inline-block;
  text-align: center;
}

#reverseSchedulerModal.post-confirmation .event-details {
  /* These properties are no longer needed */
}

.event-name {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 4px;
}

.event-time {
  font-size: 14px;
  color: #555;
}

.event-status {
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #ccc;
  display: none; /* Hidden by default */
}

.event-status.loading {
  border-color: #ccc;
  border-top-color: #4285f4; /* Google Blue for the spinner part */
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.timeline-arrow {
  width: 2px;
  background-color: #ccc;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* Orientation modifiers */
.timeline-arrow.arrow-down::after {
  bottom: -5px;
  top: auto;
  border-top: 6px solid #a5a5a5; /* triangle pointing down */
  border-bottom: none;
}

.timeline-arrow.arrow-up::after {
  top: -5px;
  bottom: auto;
  border-bottom: 6px solid #a5a5a5; /* triangle pointing up */
  border-top: none;
}

.primary-event {
  font-weight: bold;
  color: #4285F4;
}

.preceding-event {
  color: #555;
}

.no-events {
  color: #666;
  font-style: italic;
  text-align: center;
}

/* Error highlighting */
.error-highlight {
  border-color: #d93025 !important;
  background-color: #fce8e6 !important;
}

/* Options container */
#optionsContainer {
  display: none;
  margin-top: 16px;
  background: #f7f7f7;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #ddd;
}

/* Test controls */
#testControls {
  margin-bottom: 12px;
}

#testControls label {
  font-size: 14px;
}

/* Inputs (including date and time) */
#reverseSchedulerModal input,
#reverseSchedulerModal select,
#reverseSchedulerModal textarea {
  font-family: 'Roboto', Arial, sans-serif;
}

/* Unified focus border style for all inputs within modal */
#reverseSchedulerModal input:focus,
#reverseSchedulerModal select:focus,
#reverseSchedulerModal textarea:focus {
  /* This general rule is now overridden by more specific ones, but we'll keep it as a fallback */
  outline: none !important;
}

/* This rule is no longer needed and was causing the width to change.
#inlineTimePicker .flatpickr-calendar .flatpickr-time:focus-within {
  background: #fff;
  width: 121px;
}
*/

/* Responsive adjustments */
@media (max-width: 720px) {
  #reverseSchedulerModal {
    width: 95vw;
    max-width: 95vw;
  }
}

@media (max-width: 550px) {
  #mainContainer {
    gap: 12px;
  }
  #primaryDateInput {
    width: 80px;
    min-width: 60px;
  }
  #inlineTimePicker .flatpickr-time {
    width: 80px;
    min-width: 60px;
  }
  #rightPanel {
    min-width: 140px;
  }
}

@media (max-width: 480px) {
  /* Prevent any background scrolling */
  body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    overscroll-behavior: none !important;
  }
  
  /* Overlay takes full viewport, no scrolling */
  #reverseSchedulerOverlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: stretch !important;
    padding: 0 !important;
    overflow: hidden !important;
    z-index: 1000 !important;
    overscroll-behavior: none !important;
  }
  
  /* Modal becomes the single scrollable container */
  #reverseSchedulerModal {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    transform: none !important;
    padding: 16px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    background: white !important;
    overscroll-behavior: contain !important;
  }
  
  /* Simplify to basic block layout - no flex containers */
  #mainContainer {
    display: block !important;
    width: 100% !important;
    padding-bottom: 32px !important;
  }
  
  #leftPanel {
    display: block !important;
    width: 100% !important;
    margin-bottom: 24px !important;
  }
  
  #rightPanel {
    display: block !important;
    width: 100% !important;
    margin-bottom: 24px !important;
  }
  
  #reverseSchedulerModal h2 {
    font-size: 13px;
  }
}



@media (max-width: 400px) {
  .input-group {
    gap: 6px;
  }
  #primaryDateInput {
    width: 125px;
    min-width: 100px;
  }
  #inlineTimePicker .flatpickr-time {
    width: 102px;
    min-width: 80px;
  }
  #nativeTimeInput,
  input[type="time"] {
    width: 102px;
    min-width: 80px;
    border-radius: 0;
  }
  #sampleList li {
    gap: 4px;
    padding: 12px;
  }
  .event-inputs {
    flex-wrap: wrap;
    gap: 4px;
    row-gap: 0px;
  }
  .event-inputs input[type="text"] {
    width: 100%;
    min-width: 0;
    border-bottom: 1px solid #ccc !important;
  }
  .event-inputs input[type="text"]:focus {
    border-bottom-color: #4285f4 !important;
  }

  .sample-handle {
    width: 32px !important;
    font-size: 20px !important;
  }

  /* Tighter constraints for very small screens */
  .action-bottom #scheduleBtn {
    max-width: 65% !important;
  }
  
  .action-bottom #optionsBtn {
    max-width: 30% !important;
  }
}

/* Extra small screens - tightest constraints */
@media (max-width: 360px) {
  .action-buttons {
    padding: 8px !important;
  }

  .action-bottom #scheduleBtn {
    max-width: 68% !important;
  }
  
  .action-bottom #optionsBtn {
    max-width: 28% !important;
  }
}

/* Prevent zoom on mobile when focusing inputs */
@media (max-width: 768px) {
  #reverseSchedulerModal input,
  #reverseSchedulerModal input[type="text"],
  #reverseSchedulerModal input[type="number"],
  #reverseSchedulerModal input[type="date"],
  #reverseSchedulerModal input[type="time"],
  #reverseSchedulerModal textarea,
  #reverseSchedulerModal select {
    font-size: 16px !important;
  }
  
  /* Ensure Flatpickr inputs also have proper font size */
  #inlineTimePicker .flatpickr-time input,
  #inlineTimePicker .flatpickr-calendar .flatpickr-time input {
    font-size: 16px !important;
  }
}

/* Mobile-specific improvements for better scrolling */
@media (max-width: 480px) {
  /* Ensure smooth scrolling within the modal */
  #reverseSchedulerModal {
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
  }
  
  /* Remove all flex layouts and complex containers */
  #mainContainer,
  #leftPanel,
  #rightPanel,
  .preceding-events-section,
  #sampleList,
  #timelinePreview,
  .timeline {
    display: block !important;
    overflow: visible !important;
    max-height: none !important;
    overscroll-behavior: none !important;
  }
  
  /* Ensure event inputs maintain their flex layout on mobile */
  .event-inputs {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }
  
  /* Event name takes full width on mobile, Hr and Min stay together */
  .event-inputs input[type="text"]:not(.duration-input) {
    flex: 1 1 100% !important;
    min-width: 0 !important;
    margin-bottom: 4px !important;
  }
  
  /* Duration inputs stay on same row */
  .event-inputs .duration-input {
    flex: 0 0 auto !important;
    width: 60px !important;
    min-width: 0 !important;
    text-align: center !important;
  }
  
  /* Timeline flows naturally with content */
  #timelinePreview {
    margin-bottom: 24px !important;
  }
  
  /* Action buttons sticky at bottom of page */
  .action-buttons {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    padding: 12px !important;
    background: white !important;
    border-top: 1px solid #eee !important;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1) !important;
    z-index: 1001 !important;
    box-sizing: border-box !important;
  }

  /* Ensure action-bottom container stays within bounds */
  .action-bottom {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* Ensure buttons don't overflow on very small screens */
  .action-bottom button {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
    flex-shrink: 1 !important;
  }

  /* Reasonable constraints for mobile buttons */
  .action-bottom #scheduleBtn {
    max-width: 60% !important;
  }
  
  .action-bottom #optionsBtn {
    max-width: 35% !important;
  }
  
  /* Add padding to modal content to prevent content from being hidden behind sticky buttons */
  #reverseSchedulerModal {
    padding-bottom: 120px !important; /* Adjust based on action buttons height */
  }
  
  /* Ensure timeline events flow naturally */
  .timeline-event {
    display: block !important;
    margin-bottom: 16px !important;
  }
}

/* Landscape Mobile */
@media (max-height: 480px) and (orientation: landscape) {
  body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    overscroll-behavior: none !important;
  }

  #reverseSchedulerOverlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: white !important; /* Use solid background */
    display: flex !important;
    align-items: stretch !important;
    padding: 0 !important;
    overflow: hidden !important;
    z-index: 1000 !important;
    overscroll-behavior: none !important;
  }

  #reverseSchedulerModal {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    transform: none !important;
    padding: 16px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    background: white !important;
    overscroll-behavior: contain !important;
    box-shadow: none;
  }

  #mainContainer {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
  }

  #leftPanel {
    flex: 2;
    display: block; /* Keep children flowing normally */
  }

  #rightPanel {
    flex: 1;
    display: block; /* Keep children flowing normally */
  }

  /* Match mobile portrait widths for date and time inputs */
  #primaryDateInput {
    width: 125px;
    min-width: 100px;
  }
  
  #inlineTimePicker .flatpickr-time {
    width: 102px;
    min-width: 80px;
  }
  
  #nativeTimeInput,
  input[type="time"] {
    width: 102px;
    min-width: 80px;
    border-radius: 0;
  }
}

/* Flatpickr customization */
/* This is the container for the time picker, which we want to look like an input */
#inlineTimePicker .flatpickr-calendar .flatpickr-time {
  padding: 0;
  margin: 0;
  display: inline-flex; /* Use inline-flex for better alignment */
  align-items: baseline; /* Align children to their baseline */
  border-bottom: 1px solid #ccc;
  height: auto; /* Let content determine height */
}

/* This is the outer container Flatpickr creates, which we need to make invisible */
#inlineTimePicker .flatpickr-calendar.inline {
  box-shadow: none;
  background: transparent;
  border: none;
  position: relative;
  top: 0;
  padding: 0;
  margin: 0;
  width: auto;
}

#inlineTimePicker .flatpickr-calendar .flatpickr-time {
  white-space: nowrap; /* Prevent wrapping */
  height: auto;
}

.flatpickr-time input {
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 14px;
  color: #333;
  font-weight: normal;
}

/* Custom focus style for flatpickr AM/PM toggle */
.flatpickr-time .flatpickr-am-pm:focus {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
  border: none;
  opacity: 0.9;
}

/* New CSS for timeline elements and animations */
.fade-highlight {
  animation: highlight 0.5s ease-out;
  background-color: transparent;
}
@keyframes highlight {
  0% { background-color: rgba(255, 255, 0, 0.5); }
  100% { background-color: transparent; }
}

/* Inline time picker acts like an inline-block element so it occupies
   the expected space but doesn’t affect overall flow */
#inlineTimePicker {
  display: inline-block;
}

#inlineTimePicker > .flatpickr-calendar.noCalendar {
  /* Ensure inline time picker is visible and minimal */
  display: inline-block;
  position: static;
  background: transparent;
  box-shadow: none;
  border: none;
  width: auto;
  pointer-events: none; /* don’t obstruct other pop-ups */
}

#inlineTimePicker .flatpickr-calendar .flatpickr-time .numInputWrapper,
#inlineTimePicker .flatpickr-calendar .flatpickr-time .flatpickr-am-pm {
  display: inline-flex;
  align-items: center;
  padding-bottom: var(--input-v-padding);
}

#inlineTimePicker .flatpickr-calendar .flatpickr-time .numInputWrapper input {
  padding: var(--input-v-padding) 2px 0px 2px;
}

#inlineTimePicker .flatpickr-calendar .flatpickr-time .numInput {
  border: none;
}

#inlineTimePicker .flatpickr-calendar .flatpickr-time input[type="number"] {
  padding-bottom: 0; /* Override padding for number inputs if needed */
}

#inlineTimePicker .flatpickr-calendar .flatpickr-time input[type="number"]::-webkit-inner-spin-button,
#inlineTimePicker .flatpickr-calendar .flatpickr-time input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* end Flatpickr sub-field tweaks */

#optionsContainer label {
  display: block;
  margin-bottom: 4px;
}

/* #reverseSchedulerModal.post-confirmation h1,
#reverseSchedulerModal.post-confirmation #leftPanel,
#reverseSchedulerModal.post-confirmation #minimizeModalBtn,
#reverseSchedulerModal.post-confirmation #closeModalBtn {
  display: none;
} */

#reverseSchedulerModal.post-confirmation #mainContainer {
  display: flex;
  justify-content: center;
  width: 100%;
}

#reverseSchedulerModal.post-confirmation #rightPanel {
  border-left: none;
  padding: 20px;
  width: auto; /* Allow panel to size to its content */
  flex-shrink: 0;
}

#reverseSchedulerModal.post-confirmation {
  /* width: auto; */
  /* min-width: 300px; */
  height: auto;
  max-height: 80vh;
  overflow: auto;
}

/* Mobile-specific overrides for post-confirmation state */
@media (max-width: 480px) {
  #reverseSchedulerModal.post-confirmation {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    /* Use overflow: auto instead of overflow-x: hidden to preserve mobile Safari input handling */
    overflow: auto !important;
  }
  
  #reverseSchedulerModal.post-confirmation #mainContainer {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    /* Use overflow: visible to match original mobile behavior */
    overflow: visible !important;
  }
  
  #reverseSchedulerModal.post-confirmation #rightPanel {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    /* Use overflow: visible to match original mobile behavior */
    overflow: visible !important;
    padding: 16px !important;
  }
  
  #reverseSchedulerModal.post-confirmation .event-details {
    padding: 0 20px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    /* Use overflow: visible to match original mobile behavior */
    overflow: visible !important;
  }
  
  #reverseSchedulerModal.post-confirmation .event-info {
    max-width: 100% !important;
    /* Use overflow: visible to match original mobile behavior */
    overflow: visible !important;
    word-wrap: break-word !important;
  }
  
  #reverseSchedulerModal.post-confirmation .event-name,
  #reverseSchedulerModal.post-confirmation .event-time {
    max-width: 100% !important;
    /* Use overflow: visible to match original mobile behavior */
    overflow: visible !important;
    word-wrap: break-word !important;
  }
}

.retry-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 0 !important;
  background: #ffc107;
  border: none;
  color: black;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
}

.retry-btn:hover {
  background: #e0a800;
}

.retry-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  color: #666;
}

/* ---- Global Variables ---- */
:root {
  /* Unified placeholder text color */
  --rs-placeholder-color: #a8a8a8;
  --input-height: 32px;
  --input-v-padding: 4px;
  --input-border-bottom: 1px solid #ccc;
}

/* Header row layout */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.header-auth-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Sign-in button */
.sign-in-btn {
  background: #4285f4;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.sign-in-btn:hover {
  background: #3367d6;
}

.sign-in-btn:active {
  background: #2a56c6;
}

/* Sign-out button */
.sign-out-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.sign-out-btn:hover {
  background: #c82333;
}

.sign-out-btn:active {
  background: #bd2130;
}

/* Auth status label */
.auth-status {
  font-size: 16px;
  pointer-events: none;
}

/* Debug version label */
.debug-version {
  font-size: 12px;
  color: #666;
  background: rgba(255,255,255,0.8);
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
}

/* Global placeholder styling */
#reverseSchedulerModal input::placeholder {
  color: var(--rs-placeholder-color);
}

/* Remove Flatpickr arrow controls */
#inlineTimePicker .flatpickr-calendar .flatpickr-time .arrowUp,
#inlineTimePicker .flatpickr-calendar .flatpickr-time .arrowDown {
  display: none;
}

/* --- Overrides for baseline alignment and input focus --- */

#inlineTimePicker .flatpickr-time {
  width: 102px;
  height: var(--input-height);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 4px 8px 4px;
}

#inlineTimePicker .flatpickr-time .flatpickr-time-separator {
    display: flex;
    align-items: center;
    height: 100%;
}

#inlineTimePicker .flatpickr-time input,
#inlineTimePicker .flatpickr-time .flatpickr-am-pm {
  height: 100%;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 2px;
}

#inlineTimePicker .flatpickr-time .flatpickr-am-pm {
  position: relative;
  top: 5px;
}

#inlineTimePicker .flatpickr-time .flatpickr-hour {
  color: #333 !important; /* match other input text */
  font-weight: normal !important;
}

#reverseSchedulerModal #primaryNameInput:focus {
  border-bottom-color: #4285f4 !important;
}

/* ------------------------------------------------------------------
   Ensure Flatpickr time picker matches 32px height of other inputs
   ------------------------------------------------------------------ */
#inlineTimePicker .flatpickr-time,
#inlineTimePicker .flatpickr-calendar .flatpickr-time {
  height: var(--input-height) !important; /* 32px */
  line-height: var(--input-height) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

#inlineTimePicker .flatpickr-time .numInputWrapper,
#inlineTimePicker .flatpickr-time .flatpickr-am-pm,
#inlineTimePicker .flatpickr-time .flatpickr-time-separator {
  height: var(--input-height) !important; /* 32px */
  display: inline-flex !important;
  align-items: center !important;
}

#inlineTimePicker .flatpickr-time input {
  height: 100% !important;
  line-height: var(--input-height) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* Increase bottom padding for AM/PM toggle */
#inlineTimePicker .flatpickr-time .flatpickr-am-pm,
#inlineTimePicker .flatpickr-calendar .flatpickr-time .flatpickr-am-pm {
  padding-bottom: 8px !important;
}

/* ---------------- UI Tweaks ---------------- */
/* 1. Bigger drag handle */
.sample-handle {
  width: 48px !important;
  height: 32px !important; /* reduced height */
  line-height: 32px !important; /* vertical centering */
  font-size: 32px !important; /* double original icon size */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding-bottom: 5px !important; /* new bottom padding */
  color: grey !important; /* grey icon */
}

/* 2. Adjust panel sizing */
#leftPanel {
  /* Removed fixed width to allow responsive behavior */
  box-sizing: border-box;
}
/* #rightPanel rules removed - using the 75%/25% layout defined above */

.event-status.saved {
  background-color: #28a745;
  border-color: #28a745;
  color: white;
  text-align: center;
  line-height: 18px; /* Adjust for border */
  animation: none !important; /* Stop any spinner animation */
  border-top-color: #28a745 !important; /* Reset spinner border color */
}

.event-status.saved::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.timeline-arrow::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

/* Calendar selector styling */
.calendar-select {
  min-width: 180px;
  max-width: 100%;
}

#leftPanel.left-panel-disabled {
  filter: blur(3px);
  pointer-events: none;
  user-select: none;
  opacity: 0.7;
  transition: filter 0.2s, opacity 0.2s;
}

.timeline-event.primary-event .event-name {
  color: #4285F4;
}