/* execute_section.css */
.workflow-floating-section {
  position: fixed;
  bottom: 0;
  left: var(--nav-width-expanded);
  right: var(--assistant-width-expanded);
  width: calc(100vw - var(--nav-width-expanded) - var(--assistant-width-expanded));
  z-index: 1010;

  /* Layout for the two main columns (Controls Left, Button Right) */
  display: flex;
  align-items: stretch;
  gap: 0;

  /* Appearance */
  padding: 20px 24px;
  background-color: #ffffff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

/* Execute section specific styles */
.execute-controls-wrapper {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  min-width: 0;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 100px;
  width: 100%;
}

.control-group-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 0.6;
}

.control-group-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.control-label {
  font-weight: 500;
  color: #003681;
  white-space: nowrap;
  font-family: Arial, sans-serif;
  font-size: 15px;
  min-width: 120px;
  text-align: left;
}

.date-input-container {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 300px;
}

.calendar-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  pointer-events: none;
}

.execute-button-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding-left: 32px;
  border-left: 1px solid #e5e7eb;
}

.input-with-prefix,
.input-with-select {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 300px;
}

.input-with-prefix .form-control,
.input-with-select .form-control {
  width: 100%;
}

.input-with-select .form-control {
  min-width: 80px;
}

.form-control,
.form-select {
  box-sizing: border-box;
  height: 40px;
  font-family: Arial, sans-serif;
  font-size: 15px;
  padding: 8px 12px;
  border: 1px solid #e5e7eb !important;
  border-radius: 4px;
  background: #fff !important;
  color: #374151 !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.form-control:hover,
.form-select:hover {
  border-color: #9ca3af;
}

.workflow-floating-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 15px;
  font-family: Arial, sans-serif !important;
  transition: all 0.2s;
  cursor: pointer;
  height: 40px;
  min-width: 120px;
  white-space: nowrap;
  align-self: center;
}

/* 按钮悬停效果 */
.workflow-floating-button:hover {
  background-color: #f8f9fa;
  border-color: #6c757d;
}



.workflow-floating-button__text {
  text-align: center;
  font-family: Arial, sans-serif !important;
}

@media screen and (max-width: 782px) {
  .workflow-floating-section {
    padding: 12px 24px;
  }
}

.workflow-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: calc(100vw / 36);
  flex: 1;
}

.workflow-input-group__label {
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: var(--color-text);
  white-space: nowrap;
}

.workflow-input-group__select-wrapper {
  position: relative;
  min-width: 150px;
  flex: 1;
  max-width: 200px;
}

/* Select wrapper with custom dropdown arrow */
.workflow-input-group__select-wrapper::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--color-text);
  pointer-events: none;
}

/* Adjust select padding to accommodate the arrow */
.workflow-input-group__select {
  padding-right: 32px; /* Increased right padding to prevent text overlap with arrow */
}

.workflow-input-group__select {
  width: 100%;
  height: 40px;
  padding: 8px 32px 8px 16px; /* Changed padding-right to 32px */
  border: 1px solid #e5e7eb;
  border-radius: 0;
  background: #fff;
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: var(--color-text);
  appearance: none;
  cursor: pointer;
}

.workflow-input-group__select:hover {
  border-color: var(--color-border-hover);
}

.workflow-input-group__select:focus {
  outline: none;
  border-color: var(--color-border-focus);
}

.workflow-search-container {
  display: flex;
  align-items: stretch;
  flex: 1;
  max-width: 300px;
  position: relative;
}

.workflow-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-right: none;
  border-radius: 4px 0 0 4px;
}

.workflow-search-icon svg {
  width: 14px;
  height: 14px;
  color: var(--color-text);
  opacity: 0.5;
}

.workflow-input-group__search {
  flex: 1;
  height: 40px;
  padding: 8px 12px;
  border: 1px solid #e5e7eb !important;
  border-left: none !important;
  border-radius: 0 4px 4px 0;
  background: #fff !important;
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: #374151 !important;
  outline: none;
}

.workflow-input-group__search:hover {
  border-color: var(--color-border-hover);
}

.workflow-input-group__search:focus {
  outline: none;
  border-color: var(--color-border-focus);
}

/* Search results dropdown container - positioned upward */
.workflow-search-results {
  position: absolute;
  bottom: calc(100% + 1px); /* Position above the search input with 1px gap */
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-bottom: none;
  max-height: 300px;
  overflow-y: auto;
  z-index: 51;
  display: none;
  /* Add top border radius to match design */
  border-radius: 4px 4px 0 0;
  /* Add shadow for better visibility */
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

/* Show state remains the same */
.workflow-search-results.show {
  display: block;
}

/* Search result items */
.workflow-search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: var(--color-text);
}

.workflow-search-result-item:hover {
  background-color: var(--color-bg-hover);
}

/* Search container positioning */
.workflow-search-container {
  position: relative;
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 200px;
}

/* 在小屏幕上优化布局 */
@media screen and (max-width: 1200px) {
  .workflow-date-range {
    flex: 1 0 100%;
    margin-top: 8px;
    justify-content: flex-start;
  }

  .workflow-floating-section--with-input {
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

/******************************************/
/* 新增容器来包装输入组 */
.workflow-input-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 12px;
  position: relative;
}

/* 添加分隔线 */
.workflow-input-wrapper::after {
  content: '';
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  height: 80%; /* 调整分隔线高度 */
  width: 1px;
  background-color: #e5e7eb;
}

/* 调整日期行与第一行对齐 */

/* 确保两行使用相同的宽度 */
.workflow-input-group-first,
.workflow-input-group-second {
  width: 100%;
}

/* 确保间距一致性 */
.workflow-input-group-second {
  gap: 0; /* 移除默认间距，我们使用明确的百分比 */
}

/* 将各元素按照指定百分比分配空间 */
.date-label {
  white-space: nowrap;
  box-sizing: border-box;
}

/* 百分比分配 */
.start-label {
  width: 22%;
  padding-right: 5px;
}

.workflow-input-group__date.start-date {
  width: 17%;
  box-sizing: border-box;
}

.date-spacer {
  width: 2%;
  display: inline-block;
}

.end-label {
  width: 22%;
  padding-right: 5px;
  box-sizing: border-box;
}

.workflow-input-group__date.end-date {
  width: 17%;
  box-sizing: border-box;
}

/* 调整Timeframe标签和下拉框 */
.timeframe-label {
  width: 11%; /* 减少宽度使标签和下拉框更靠近 */
  padding-right: 15px;
  box-sizing: border-box;
  text-align: right;
}

/* 移除原来的timeframe-wrapper箭头 */
.workflow-input-group__timeframe-wrapper::after {
  display: none;
}

/* 为timeframe容器添加相对定位 */
.workflow-input-group__timeframe-wrapper {
  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 200px;
}

/* 在timeframe select元素的父容器上添加箭头 */
.workflow-input-group__timeframe-wrapper .workflow-input-group__timeframe {
  position: relative;
  /* 修正：让select元素占用剩余空间而不是固定宽度 */
  flex: 1;
  min-width: 80px; /* 设置最小宽度确保可读性 */
}

.workflow-input-group__timeframe-wrapper
  .workflow-input-group__timeframe::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--color-text);
  pointer-events: none;
  z-index: 1000;
}

.workflow-input-group__timeframe {
  width: 100% !important;
  height: 40px;
  padding: 8px 32px 8px 8px; /* 调整右侧内边距以容纳下拉箭头 */
  border: 1px solid #e5e7eb;
  border-radius: 0;
  background: #fff;
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: var(--color-text);
  appearance: none; /* 移除默认下拉箭头 */
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

.workflow-input-group__timeframe:hover {
  border-color: var(--color-border-hover);
}

.workflow-input-group__timeframe:focus {
  outline: none;
  border-color: var(--color-border-focus);
}

/* 日期输入框样式 */
.workflow-input-group__date {
  height: 40px;
  padding: 8px 32px 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 0;
  background: #fff;
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: var(--color-text);
  box-sizing: border-box;
}

.workflow-input-group__date:hover {
  border-color: var(--color-border-hover);
}

.workflow-input-group__date:focus {
  outline: none;
  border-color: var(--color-border-focus);
}

/* 调整带有日期输入的浮动部分的宽度和高度 */
.workflow-floating-section--with-input {
  width: calc(100vw - var(--nav-width-expanded) - var(--assistant-width-expanded));
  min-height: 135px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.workflow-floating-section .flatpickr-input {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px 10px;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
  font-size: 15px;
  background-color: #fff;
  width: 100%;
  transition: all 0.3s ease;
}

.workflow-floating-section .flatpickr-input:hover {
  border-color: #aaa;
}

.workflow-floating-section .flatpickr-input:focus {
  border-color: #0066cc;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

.workflow-floating-section .flatpickr-calendar {
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: none;
  background: #fff;
  margin-top: -4px;
}

.workflow-floating-section .flatpickr-day.selected,
.workflow-floating-section .flatpickr-day.startRange,
.workflow-floating-section .flatpickr-day.endRange,
.workflow-floating-section .flatpickr-day.selected.inRange,
.workflow-floating-section .flatpickr-day.startRange.inRange,
.workflow-floating-section .flatpickr-day.endRange.inRange {
  background: #0066cc;
  border-color: #0066cc;
}

.workflow-floating-section .flatpickr-day.selected:hover,
.workflow-floating-section .flatpickr-day.startRange:hover,
.workflow-floating-section .flatpickr-day.endRange:hover {
  background: #004c99;
  border-color: #004c99;
}

.workflow-floating-section .flatpickr-day.today {
  border-color: #0066cc;
}

.workflow-floating-section .flatpickr-day:hover {
  background: #f0f8ff;
}

.workflow-floating-section .flatpickr-current-month,
.workflow-floating-section .flatpickr-monthDropdown-months {
  font-weight: 600;
  color: #333;
}

.workflow-floating-section .flatpickr-time input:hover,
.workflow-floating-section .flatpickr-time .flatpickr-am-pm:hover,
.workflow-floating-section .flatpickr-time input:focus,
.workflow-floating-section .flatpickr-time .flatpickr-am-pm:focus {
  background: #f0f8ff;
}

.date-updated {
  transition: background-color 0.5s ease;
  background-color: rgba(0, 102, 204, 0.1) !important;
}

.calendar-above {
  transform: translateY(0) !important;
  z-index: 1000 !important;
}

.flatpickr-calendar {
  max-height: 300px;
  overflow-y: auto;
}
