/* =====================================================
   Retell AI Agent Configuration Page
   ===================================================== */

/* --- Layout --- */
.retell-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  min-height: 600px;
}

.retell-topbar {
  background: #fff;
  border-bottom: 1px solid #e7e7e8;
  padding: 0.75rem 1.25rem;
  border-radius: 0.375rem 0.375rem 0 0;
  flex-shrink: 0;
}

.retell-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.retell-agent-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #566a7f;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.retell-agent-name .edit-icon {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  font-size: 0.9rem;
}

.retell-agent-name .edit-icon:hover {
  opacity: 1;
}

.retell-agent-name span[contenteditable="true"] {
  outline: 2px solid #696cff;
  outline-offset: 2px;
  border-radius: 0.25rem;
  padding: 0.15rem 0.4rem;
  margin: -0.15rem -0.4rem;
  background: rgba(105, 108, 255, 0.05);
  cursor: text;
}

.retell-agent-name span[contenteditable="true"]:focus {
  outline: 2px solid #696cff;
  background: rgba(105, 108, 255, 0.08);
}

.retell-agent-name span.editing {
  user-select: text;
}

.retell-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: #a1acb8;
}

.retell-meta .meta-separator {
  margin: 0 0.15rem;
}

.retell-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
}

.retell-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.retell-autosave {
  font-size: 0.75rem;
  color: #a1acb8;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.retell-autosave .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #71dd37;
}

/* --- Tabs (Create / Simulation) --- */
.retell-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid #e7e7e8;
  background: #fff;
  padding: 0 1.25rem;
  flex-shrink: 0;
}

.retell-tab {
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #a1acb8;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.retell-tab:hover {
  color: #566a7f;
}

.retell-tab.active {
  color: #696cff;
  border-bottom-color: #696cff;
}

/* --- Main Content Area (Two Panels) --- */
.retell-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: #fff;
  border-radius: 0 0 0.375rem 0.375rem;
}

/* --- Left Panel (System Prompt) --- */
.retell-panel-left {
  flex: 3;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e7e7e8;
  overflow-y: auto;
  min-width: 0;
}

.retell-model-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid #f0f0f0;
  flex-wrap: wrap;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}

.retell-model-bar .model-select,
.retell-model-bar .voice-select,
.retell-model-bar .lang-select {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid #e7e7e8;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  color: #566a7f;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.retell-model-bar .model-select:hover,
.retell-model-bar .voice-select:hover,
.retell-model-bar .lang-select:hover {
  border-color: #696cff;
  box-shadow: 0 0 0 2px rgba(105, 108, 255, 0.08);
}

.retell-model-bar .voice-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #696cff 0%, #8592ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 600;
}

.retell-model-bar .icon-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e7e7e8;
  border-radius: 0.375rem;
  color: #a1acb8;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.retell-model-bar .icon-btn:hover {
  border-color: #696cff;
  color: #696cff;
}

.retell-model-bar .lang-flag {
  font-size: 1rem;
  line-height: 1;
}

/* System Prompt Area */
.retell-prompt-area {
  flex: 1;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.retell-prompt-textarea {
  flex: 1;
  width: 100%;
  min-height: 250px;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.875rem;
  line-height: 1.7;
  color: #566a7f;
  background: transparent;
}

.retell-prompt-textarea::placeholder {
  color: #313335;
}

/* Welcome Message Section */
.retell-welcome {
  border-top: 1px solid #e7e7e8;
  padding: 1rem 1.25rem;
  flex-shrink: 0;
}

.retell-welcome-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.retell-welcome-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #566a7f;
}

.retell-welcome .pause-setting {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: #a1acb8;
}

.retell-welcome .pause-setting .bx {
  font-size: 0.85rem;
}

.retell-welcome .form-select-sm {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  width: auto;
  min-width: 60px;
}

.retell-welcome-label {
  font-size: 0.8rem;
  color: #697a8d;
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.retell-welcome .custom-msg-input {
  border: none;
  border-bottom: 1px solid #e7e7e8;
  border-radius: 0;
  padding: 0.4rem 0;
  font-size: 0.85rem;
  transition: border-color 0.2s;
}

.retell-welcome .custom-msg-input:focus {
  border-bottom-color: #696cff;
  box-shadow: none;
}

/* --- Right Panel (Settings + Test) --- */
.retell-panel-right {
  flex: 2;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-width: 0;
}

/* Settings Accordion */
.retell-settings {
  flex: 1;
  overflow-y: auto;
}

.retell-accordion-item {
  border-bottom: 1px solid #f0f0f0;
}

.retell-accordion-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.75rem 1.25rem;
  gap: 0.6rem;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s;
  text-align: left;
}

.retell-accordion-btn:hover {
  background-color: #f5f5f9;
}

.retell-accordion-btn .acc-icon {
  font-size: 1.1rem;
  color: #696cff;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.retell-accordion-btn .acc-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #566a7f;
  flex: 1;
}

.retell-accordion-btn .acc-chevron {
  font-size: 1rem;
  color: #a1acb8;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.retell-accordion-btn[aria-expanded="true"] .acc-chevron {
  transform: rotate(180deg);
}

.retell-accordion-body {
  padding: 0 1.25rem 1rem;
}

.retell-accordion-body .placeholder-text {
  font-size: 0.8rem;
  color: #a1acb8;
  font-style: italic;
}

/* --- Test Panel --- */
.retell-test-panel {
  border-top: 1px solid #e7e7e8;
  padding: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.retell-test-icon {
  font-size: 2.5rem;
  color: #e7e7e8;
  margin-bottom: 0.5rem;
}

.retell-test-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: #566a7f;
  margin-bottom: 0.75rem;
}

.retell-test-tabs {
  display: inline-flex;
  border: 1px solid #e7e7e8;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1rem;
}

.retell-test-tab {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #a1acb8;
  background: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.retell-test-tab+.retell-test-tab {
  border-left: 1px solid #e7e7e8;
}

.retell-test-tab:hover {
  color: #566a7f;
  background: #f5f5f9;
}

.retell-test-tab.active {
  background: #f5f5f9;
  color: #696cff;
}

.retell-test-btn {
  padding: 0.5rem 2.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}

/* --- Responsive --- */
@media (max-width: 991.98px) {
  .retell-content {
    flex-direction: column;
  }

  .retell-panel-left {
    border-right: none;
    border-bottom: 1px solid #e7e7e8;
    min-height: 400px;
    max-height: 50vh;
  }

  .retell-panel-right {
    min-height: 300px;
  }

  .retell-page {
    height: auto;
    min-height: auto;
  }
}

@media (max-width: 575.98px) {
  .retell-topbar-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .retell-topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .retell-model-bar {
    overflow-x: auto;
  }

  .retell-meta {
    font-size: 0.7rem;
  }
}

/* --- Model Dropdown --- */
.model-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 220px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  padding: 0.25rem 0;
}

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

.model-dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  border-left: 2px solid transparent;
}

.model-dropdown-item:hover {
  background-color: rgba(105, 108, 255, 0.08);
}

.model-dropdown-item.selected {
  background-color: rgba(105, 108, 255, 0.12);
  border-left: 2px solid #696cff;
}

.model-dropdown-item .model-icon {
  font-size: 0.875rem;
  color: #6c757d;
  flex-shrink: 0;
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.model-dropdown-item:hover .model-icon {
  color: #696cff;
}

.model-dropdown-item .model-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.model-dropdown-item .model-name {
  font-size: 0.8125rem;
  font-weight: 400;
  color: #495057;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.model-dropdown-item:hover .model-name {
  color: #212529;
  font-weight: 500;
}

.model-dropdown-item .model-price {
  font-size: 0.75rem;
  color: #868e96;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.model-dropdown-item:hover .model-price {
  color: #6c757d;
}

.model-dropdown-item .model-arrow {
  font-size: 0.875rem;
  color: #696cff;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.model-dropdown-item:hover .model-arrow {
  opacity: 1;
}

.model-select-wrapper {
  position: relative;
  display: inline-block;
}

/* --- Scrollbar styling --- */
.retell-panel-left::-webkit-scrollbar,
.retell-panel-right::-webkit-scrollbar,
.retell-settings::-webkit-scrollbar,
.model-dropdown::-webkit-scrollbar {
  width: 4px;
}

.retell-panel-left::-webkit-scrollbar-thumb,
.retell-panel-right::-webkit-scrollbar-thumb,
.retell-settings::-webkit-scrollbar-thumb,
.model-dropdown::-webkit-scrollbar-thumb {
  background: #d4d8dd;
  border-radius: 4px;
}

.retell-panel-left::-webkit-scrollbar-track,
.retell-panel-right::-webkit-scrollbar-track,
.retell-settings::-webkit-scrollbar-track,
.model-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

/* --- Settings Dropdown --- */
.settings-wrapper {
  position: relative;
  display: inline-block;
}

.settings-dropdown {
  position: fixed;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  width: 280px;
  z-index: 1001;
  display: none;
  padding: 0;
  max-height: 400px;
  overflow-y: auto;
}

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

.settings-dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #dee2e6;
  font-size: 0.875rem;
  font-weight: 600;
  color: #495057;
}

.settings-dropdown-header i {
  font-size: 1rem;
  color: #696cff;
}

.settings-dropdown-section {
  padding: 1rem;
  border-bottom: 1px solid #f0f0f0;
}

.settings-dropdown-section:last-child {
  border-bottom: none;
}

.settings-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.3rem;
}

.temperature-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.5rem;
  background: rgba(105, 108, 255, 0.12);
  color: #696cff;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.settings-description {
  font-size: 0.75rem;
  color: #868e96;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.settings-range {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e9ecef;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.settings-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #696cff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 4px rgba(105, 108, 255, 0.15);
}

.settings-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #696cff;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.settings-range::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 4px rgba(105, 108, 255, 0.15);
}

.settings-range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: #adb5bd;
}

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Custom Toggle Switch */
.settings-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.settings-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #e9ecef;
  transition: 0.3s;
  border-radius: 24px;
}

.settings-switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.settings-switch input:checked + .settings-switch-slider {
  background-color: #696cff;
}

.settings-switch input:checked + .settings-switch-slider:before {
  transform: translateX(20px);
}

.settings-switch-slider:hover {
  box-shadow: 0 0 0 4px rgba(105, 108, 255, 0.08);
}

/* --- Language Dropdown --- */
.lang-select-wrapper {
  position: relative;
  display: inline-block;
}

.lang-dropdown {
  position: fixed;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  width: 260px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  padding: 0.25rem 0;
}

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

.lang-dropdown-section-title {
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #868e96;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.25rem;
}

.lang-dropdown-section-title:first-child {
  margin-top: 0;
}

.lang-dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  border-left: 2px solid transparent;
}

.lang-dropdown-item:hover {
  background-color: rgba(105, 108, 255, 0.08);
}

.lang-dropdown-item.selected {
  background-color: rgba(105, 108, 255, 0.12);
  border-left: 2px solid #696cff;
}

.lang-dropdown-item .lang-flag {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.lang-dropdown-item .lang-name {
  font-size: 0.8125rem;
  font-weight: 400;
  color: #495057;
  white-space: nowrap;
  flex: 1;
  transition: color 0.15s ease;
}

.lang-dropdown-item:hover .lang-name {
  color: #212529;
  font-weight: 500;
}

.lang-dropdown::-webkit-scrollbar {
  width: 4px;
}

.lang-dropdown::-webkit-scrollbar-thumb {
  background: #d4d8dd;
  border-radius: 4px;
}

.lang-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

/* --- Functions Dropdown --- */
.functions-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 280px;
  z-index: 1000;
  display: none;
  padding: 0.25rem 0;
}

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

.functions-dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.875rem;
  gap: 0.65rem;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  border-left: 2px solid transparent;
}

.functions-dropdown-item:hover {
  background-color: rgba(105, 108, 255, 0.08);
  border-left: 2px solid #696cff;
}

.functions-dropdown-item i {
  font-size: 1rem;
  color: #696cff;
  flex-shrink: 0;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.functions-dropdown-item:hover i {
  color: #5f63ff;
}

.functions-dropdown-item span {
  font-size: 0.8125rem;
  font-weight: 400;
  color: #495057;
  flex: 1;
  transition: color 0.15s ease, font-weight 0.15s ease;
}

.functions-dropdown-item:hover span {
  color: #212529;
  font-weight: 500;
}

/* --- Function Items List --- */
.functions-list {
  max-height: 300px;
  overflow-y: auto;
}

.function-item {
  transition: all 0.2s ease;
}

.function-item:hover {
  background-color: #f5f5f9;
  border-color: #d4d8dd !important;
}

.function-item .btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.function-item .btn-outline-secondary {
  border-color: #e7e7e8;
  color: #a1acb8;
}

.function-item .btn-outline-secondary:hover {
  border-color: #696cff;
  color: #696cff;
  background-color: rgba(105, 108, 255, 0.08);
}

.function-item .btn-outline-danger {
  border-color: #e7e7e8;
  color: #a1acb8;
}

.function-item .btn-outline-danger:hover {
  border-color: #ff3e1d;
  color: #ff3e1d;
  background-color: rgba(255, 62, 29, 0.08);
}

.functions-list::-webkit-scrollbar {
  width: 4px;
}

.functions-list::-webkit-scrollbar-thumb {
  background: #d4d8dd;
  border-radius: 4px;
}

.functions-list::-webkit-scrollbar-track {
  background: transparent;
}

/* ==================================================
   Function Configuration Modals
   ================================================== */

/* Modal Overlay */
.function-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

.function-modal.active {
  display: flex;
}

.function-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

/* Modal Content */
.function-modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 0.75rem;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.2s ease-out;
}

.function-modal-wide {
  max-width: 640px;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal Header */
.function-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8f9fa;
}

.function-modal-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
}

.function-modal-title i {
  font-size: 1.5rem;
  color: #696cff;
}

.function-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
}

.function-modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1e293b;
}

.function-modal-close i {
  font-size: 1.5rem;
}

/* Modal Body */
.function-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  background: #ffffff;
}

.function-modal-body::-webkit-scrollbar {
  width: 6px;
}

.function-modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.function-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

/* Form Groups */
.function-form-group {
  margin-bottom: 1.25rem;
}

.function-form-group:last-child {
  margin-bottom: 0;
}

.function-form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.function-form-label .text-muted {
  font-weight: 400;
  color: #64748b;
}

.function-form-label .text-danger {
  color: #ff3e1d;
}

.function-form-input,
.function-form-textarea,
.function-form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: #f8f9fa;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  color: #1e293b;
  font-size: 0.875rem;
  transition: all 0.15s ease;
  font-family: inherit;
}

.function-form-input:focus,
.function-form-textarea:focus,
.function-form-select:focus {
  outline: none;
  border-color: #696cff;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(105, 108, 255, 0.1);
}

.function-form-textarea {
  resize: vertical;
  min-height: 80px;
}

.function-form-hint {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: #64748b;
}

/* Checkbox */
.function-form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.function-form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: #696cff;
}

.function-form-checkbox label {
  flex: 1;
  cursor: pointer;
  margin: 0;
}

.function-form-checkbox label strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.function-checkbox-hint {
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}

/* Execution Section */
.function-execution-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

/* Tabs */
.function-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.25rem;
  background: #f8f9fa;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
}

.function-tab {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.function-tab:hover {
  color: #1e293b;
  background: rgba(0, 0, 0, 0.03);
}

.function-tab.active {
  background: #696cff;
  color: #ffffff;
}

/* Modal Footer */
.function-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  background: #f8f9fa;
}

.btn-function-secondary,
.btn-function-primary {
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-function-secondary {
  background: #ffffff;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.btn-function-secondary:hover {
  background: #f8f9fa;
  color: #1e293b;
  border-color: #cbd5e1;
}

.btn-function-primary {
  background: #696cff;
  color: #ffffff;
}

.btn-function-primary:hover {
  background: #5f63ff;
  box-shadow: 0 4px 12px rgba(105, 108, 255, 0.3);
}