/* DataTables Order Builder - Sidebar Version */
:root {
  --order-primary: #667eea;
  --order-secondary: #14c7f2;
  --order-success: #48bb78;
  --order-warning: #ed8936;
  --order-danger: #e53e3e;
  --order-light: #f8f9fa;
  --order-border: #e0e0e0;
  --order-text: #333;
  --order-muted: #999;
}

.datatables-order-builder-container {
  margin-bottom: 20px;
}

/* Sidebar Trigger Button */
.order-builder-trigger-btn {
  padding: 4px 20px;
  background: linear-gradient(
    135deg,
    var(--order-primary) 0%,
    var(--order-secondary) 100%
  );
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.order-builder-trigger-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.order-builder-trigger-btn i {
  font-size: 14px;
}

/* Sidebar & Overlay */
.order-builder-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.order-builder-overlay.active {
  display: block;
  opacity: 1;
}

.order-builder-sidebar {
  position: fixed;
  top: 0;
  right: -450px; /* Hidden by default */
  width: 450px;
  max-width: 100%;
  height: 100%;
  background: white;
  z-index: 10001;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  transition: right 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  display: flex;
  flex-direction: column;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.order-builder-sidebar.active {
  right: 0;
}

.order-builder-sidebar-header {
  padding: 16px 20px;
  background: var(--order-light);
  border-bottom: 1px solid var(--order-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-builder-sidebar-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--order-text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-builder-close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--order-muted);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.order-builder-close-btn:hover {
  color: var(--order-danger);
}

.order-builder-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.order-builder-sidebar-footer {
  padding: 16px 20px;
  background: var(--order-light);
  border-top: 1px solid var(--order-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* Rule Styles */
.order-builder-content {
  margin-top: 5px;
}

.order-builder-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--order-muted);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-builder-presets {
  margin-bottom: 25px;
}

.order-builder-presets-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.order-builder-preset-btn {
  background: #f0f0f0;
  color: #666;
  padding: 4px 12px;
  font-size: 11px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.order-builder-preset-btn:hover {
  background: var(--order-primary);
  color: white;
}

.order-builder-rules {
  min-height: 100px;
}

.order-builder-rule {
  background: #f9f9f9;
  border: 1px solid var(--order-border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s;
  position: relative;
}

.order-builder-rule:hover {
  background: white;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  border-color: var(--order-primary);
}

.order-builder-rule-handle {
  cursor: grab;
  color: var(--order-muted);
}

.order-builder-rule-priority {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--order-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.order-builder-rule-field {
  flex: 3;
}

.order-builder-rule-direction {
  flex: 2;
}

.order-builder-rule select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--order-border);
  border-radius: 4px;
  font-size: 13px;
  background: white;
}

.order-builder-btn-icon {
  padding: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--order-muted);
  border-radius: 4px;
}

.order-builder-btn-icon:hover {
  background: #eee;
}

.order-builder-btn-icon.btn-remove-rule:hover {
  color: var(--order-danger);
}

.order-builder-btn-icon.btn-duplicate-rule:hover {
  color: var(--order-primary);
}

/* Sidebar UI Buttons */
.order-builder-btn {
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.order-builder-btn-success {
  background: var(--order-success);
  color: white;
}
.order-builder-btn-success:hover {
  background: #38a169;
}

.order-builder-btn-warning {
  background: var(--order-warning);
  color: white;
}
.order-builder-btn-warning:hover {
  background: #dd6b20;
}

.order-builder-btn-secondary {
  background: #a0aec0;
  color: white;
}
.order-builder-btn-secondary:hover {
  background: #718096;
}

.order-builder-btn-primary {
  background: var(--order-primary);
  color: white;
}
.order-builder-btn-primary:hover {
  background: #5a67d8;
}

/* Badge and Preview */
.order-builder-badge {
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.order-builder-preview {
  margin-top: 20px;
  padding: 12px;
  background: #fffaf0;
  border-left: 4px solid var(--order-primary);
  border-radius: 4px;
  font-size: 12px;
}

.order-builder-preview ol {
  margin-top: 8px;
  padding-left: 20px;
}

.order-builder-preview li {
  margin-bottom: 4px;
}

/* DataTable Badge Improvements */
.datatables-order-badge {
  background: var(--order-primary);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  margin-left: 8px;
  vertical-align: middle;
}

.datatables-order-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 11000;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  border-left: 4px solid var(--order-success);
}

/* Animations */
@keyframes slideInRight {
  from {
    right: -450px;
    opacity: 0;
  }
  to {
    right: 0;
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .order-builder-sidebar {
    width: 100%;
    right: -100%;
  }
}

.order-builder-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.order-builder-confirm-dialog {
  background: white;
  border-radius: 12px;
  width: 400px;
  max-width: 90%;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: slideUp 0.2s ease;
  overflow: hidden;
}

.order-builder-confirm-header {
  padding: 20px 24px 0 24px;
}

.order-builder-confirm-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1a202c;
}

.order-builder-confirm-body {
  padding: 16px 24px;
}

.order-builder-confirm-body p {
  margin: 0;
  font-size: 14px;
  color: #4a5568;
  line-height: 1.5;
}

.order-builder-confirm-footer {
  padding: 16px 24px 20px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid #e2e8f0;
  background: #f7fafc;
}

.order-builder-confirm-btn {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.order-builder-confirm-btn-cancel {
  background: #e2e8f0;
  color: #4a5568;
}

.order-builder-confirm-btn-cancel:hover {
  background: #cbd5e0;
}

.order-builder-confirm-btn-confirm {
  background: #ed8936;
  color: white;
}

.order-builder-confirm-btn-confirm:hover {
  background: #dd6b20;
}

.order-builder-btn:disabled {
  background: #cbd5e0 !important;
  cursor: not-allowed;
  color: #718096 !important;
  transform: none !important;
  box-shadow: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
