/* =====================================================
   MODERN DESIGN TAB LAYOUT - DEDICATED STYLESHEET
   ===================================================== */

/* Design Cards - Main containers - Ultra Compact */
#design-tab .design-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

#design-tab .design-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Card Headers - Ultra Compact */
#design-tab .design-card-header {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#design-tab .design-card-icon {
  color: #3b82f6;
  font-size: 14px;
}

#design-tab .design-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

#design-tab .design-card-content {
  padding: 10px 12px;
}

/* Modern Button System */
#design-tab .design-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  justify-content: center;
  min-height: 28px;
  box-sizing: border-box;
}

#design-tab .design-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Variants */
#design-tab .design-btn-primary {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}
#design-tab .design-btn-primary:hover:not(:disabled) {
  background: #2563eb;
  border-color: #2563eb;
}

#design-tab .design-btn-secondary {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}
#design-tab .design-btn-secondary:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
}

#design-tab .design-btn-success {
  background: #10b981;
  border-color: #10b981;
  color: white;
}
#design-tab .design-btn-success:hover:not(:disabled) {
  background: #059669;
  border-color: #059669;
}

#design-tab .design-btn-warning {
  background: #f59e0b;
  border-color: #f59e0b;
  color: white;
}
#design-tab .design-btn-warning:hover:not(:disabled) {
  background: #d97706;
  border-color: #d97706;
}

/* Drawing Toolbar - Ultra Compact Layout */
#design-tab .drawing-toolbar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

#design-tab .tool-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

/* Base design tool - applies to all toolbar icons */
#design-tab .design-tool {
  width: 32px;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  color: #6b7280;
}

#design-tab .design-tool:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #374151;
  transform: translateY(-1px);
}

#design-tab .design-tool:hover i {
  color: #374151;
}

#design-tab .design-tool.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

/* Primary tool - Draw button - most prominent (more specific, comes after general rules) */
#design-tab .design-tool-primary {
  width: 44px;
  height: 44px;
  border: 2px solid #3b82f6;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white !important;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  position: relative;
}

#design-tab .design-tool-primary i {
  color: white !important;
}

#design-tab .design-tool-primary::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 6px;
  padding: 2px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  pointer-events: none;
}

#design-tab .design-tool-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border-color: #2563eb !important;
  color: white !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
}

#design-tab .design-tool-primary:hover i {
  color: white !important;
}

#design-tab .design-tool-primary.active {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
  border-color: #1d4ed8 !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5), inset 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

#design-tab .design-tool-primary.active i {
  color: white !important;
}

/* Enforcing state - when waiting for user to click near main drain */
#design-tab .design-tool.enforcing {
  background: #f59e0b;
  border-color: #f59e0b;
  color: white;
  animation: enforcing-pulse 2s infinite;
}

@keyframes enforcing-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

#design-tab .design-tool-danger {
  color: #dc2626;
}

#design-tab .design-tool-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

#design-tab .design-tool[data-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
  /* Note: removing pointer-events: none to allow tooltips */
}

/* Settings Toggle */
#design-tab .tool-settings {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

#design-tab .design-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

#design-tab .design-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

#design-tab .toggle-label {
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}

/* Profile Controls */
#design-tab .profile-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#design-tab .profile-selector-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#design-tab .profile-label {
  font-size: 13px;
  font-weight: 500;
  color: #475569;
}

#design-tab .profile-selector {
  display: flex;
  gap: 8px;
  align-items: center;
}

#design-tab .profile-dropdown {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  font-size: 13px;
  color: #374151;
}

#design-tab .profile-action-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 12px;
}

#design-tab .profile-action-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #374151;
}

#design-tab .profile-tools {
  display: flex;
  gap: 8px;
}

/* Parameter Sections - Ultra Compact */
#design-tab .param-section {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

#design-tab .param-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

#design-tab .param-section-header {
  margin-bottom: 6px;
}

#design-tab .param-section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

#design-tab .param-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

#design-tab .param-input-row:last-child {
  margin-bottom: 0;
}

#design-tab .param-label {
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  white-space: nowrap;
}

#design-tab .param-input {
  width: 80px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

#design-tab .param-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Depth Constraints */
#design-tab .depth-constraints {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 10px;
}

#design-tab .depth-input-pair {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  justify-content: center;
}

#design-tab .depth-input-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#design-tab .depth-label {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  text-align: center;
}

/* Grade Analysis */
#design-tab .grade-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

#design-tab .grade-primary-actions,
#design-tab .grade-secondary-actions {
  display: flex;
  gap: 4px;
}

#design-tab .grade-primary-actions .design-btn {
  flex: 1;
  font-size: 11px;
  padding: 6px 4px;
}

#design-tab .grade-secondary-actions .design-btn {
  flex: 1;
}

#design-tab .grade-display {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px;
  margin-top: 10px;
  max-height: none;
  overflow-y: visible;
}

#design-tab .grade-display:empty::before {
  content: "Grade analysis results will appear here...";
  color: #9ca3af;
  font-style: italic;
  font-size: 12px;
}

/* Profile Statistics Display */
#design-tab .stats-header {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e5e7eb;
}

#design-tab .stats-grid {
  display: grid;
  grid-template-columns: auto minmax(70px, 1fr);
  gap: 6px 12px;
  align-items: baseline;
}

#design-tab .stat-label {
  font-weight: 500;
  color: #6b7280;
  font-size: 12px;
}

#design-tab .stat-value {
  font-weight: 600;
  color: #111827;
  font-size: 12px;
  text-align: right;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

#design-tab .stats-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

#design-tab .stats-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}