/* ==================== WORKFLOW COMMAND PANEL ==================== */

.workflow-command-panel {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.command-panel-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e2e8f0;
}

.command-panel-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.3);
}

.command-panel-icon svg {
  width: 24px;
  height: 24px;
  color: white;
}

.command-panel-text {
  flex: 1;
}

.command-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}

.command-panel-desc {
  font-size: 14px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

/* Command Actions Grid */
.command-panel-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

/* Command Button Styles */
.command-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.command-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.3) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.command-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.command-btn:hover::before {
  opacity: 1;
}

.command-btn:active {
  transform: translateY(0);
}

.command-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Command Button Icon */
.command-btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.command-btn-icon svg {
  width: 22px;
  height: 22px;
}

/* Test Lead Button */
.command-btn-test {
  border-color: #0f766e;
}

.command-btn-test:hover {
  border-color: #0d9488;
  background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
}

.command-btn-test .command-btn-icon {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
}

.command-btn-test .command-btn-icon svg {
  color: white;
}

.command-btn-test:hover .command-btn-icon {
  transform: rotate(-10deg) scale(1.05);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.35);
}

/* Send Previous Leads Button */
.command-btn-batch {
  border-color: #2563eb;
}

.command-btn-batch:hover {
  border-color: #1d4ed8;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.command-btn-batch .command-btn-icon {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.command-btn-batch .command-btn-icon svg {
  color: white;
}

.command-btn-batch:hover .command-btn-icon {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

/* Create Workflow Button */
.command-btn-create {
  border-color: #16a34a;
}

.command-btn-create:hover {
  border-color: #15803d;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.command-btn-create .command-btn-icon {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}

.command-btn-create .command-btn-icon svg {
  color: white;
}

.command-btn-create:hover .command-btn-icon {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.35);
}

/* Button Content */
.command-btn-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  flex: 1;
}

.command-btn-title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  display: block;
  letter-spacing: -0.01em;
}

.command-btn-subtitle {
  font-size: 12px;
  color: #64748b;
  display: block;
  font-weight: 400;
}

/* Status Messages */
.command-panel-status {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.command-panel-status.success {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #15803d;
}

.command-panel-status.error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #dc2626;
}

.command-panel-status.loading {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
}

.command-panel-status.warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #d97706;
}

.status-message {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
}

.status-message::before {
  content: '';
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background-size: contain;
}

.command-panel-status.success .status-message::before {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%2315803d' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='20,6 9,17 4,12'/%3E%3C/svg%3E");
}

.command-panel-status.error .status-message::before {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='15' y1='9' x2='9' y2='15'/%3E%3Cline x1='9' y1='9' x2='15' y2='15'/%3E%3C/svg%3E");
}

.command-panel-status.loading .status-message::before {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%231d4ed8' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 6v6l4 2'/%3E%3C/svg%3E");
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .command-panel-actions {
    grid-template-columns: 1fr;
  }

  .command-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .command-btn {
    padding: 14px 16px;
  }

  .command-btn-icon {
    width: 40px;
    height: 40px;
  }

  .command-btn-icon svg {
    width: 20px;
    height: 20px;
  }
}

/* Loading State */
.command-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.command-btn.loading .command-btn-icon {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(0.95);
  }
}

/* ==================== BUTTON HOVER TOOLTIPS ====================
   Rendered as a single fixed-position element appended to <body> (see
   command-panel.js) rather than an absolutely-positioned child of the
   button, because the command panel lives inside .modal-body
   (overflow-y: auto) and .modal (overflow: hidden) — a child tooltip
   would get silently clipped by those ancestors no matter its z-index. */
.command-tooltip-fixed {
  position: fixed;
  max-width: 260px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.3);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 9600;
}

.command-tooltip-fixed.visible {
  opacity: 1;
  visibility: visible;
}

/* ==================== WORKING POPUP ==================== */
.command-working-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9500;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.command-working-overlay.open {
  opacity: 1;
  visibility: visible;
}

.command-working-box {
  position: relative;
  background: white;
  border-radius: 14px;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  max-width: 320px;
  text-align: center;
  transform: translateY(8px);
  transition: transform 0.2s ease;
}

.command-working-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.command-working-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.command-working-overlay.open .command-working-box {
  transform: translateY(0);
}

.command-working-spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid #e2e8f0;
  border-top-color: #0f766e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.command-working-text {
  font-size: 14.5px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.5;
}
