/* Reusable Component Classes for Datneat Design System */

/* CSS Variables for consistent theming */
:root {
  --primary: #4f8cff;
  --primary-dark: #3b82f6;
  --text: #374151;
  --surface-2: #f9fafb;
  --surface-3: #f3f4f6;
  --border: #e5e7eb;
}

.dark {
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --text: #f9fafb;
  --surface-2: #374151;
  --surface-3: #4b5563;
  --border: #6b7280;
}

/* ===== NAVIGATION COMPONENTS ===== */

/* Navigation Container */
.nav-container {
  background-color: white;
  padding: 0.5rem 0.5rem;
  transition: all 0.2s;
}

/* Navigation Items Container */
.nav-items-container {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.dark .nav-container {
  background-color: #1f2937;
}

/* Navigation Brand/Logo */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  transition: color 0.2s;
}

.dark .nav-brand {
  color: #f9fafb;
}

.nav-brand:hover {
  color: var(--primary);
}

/* Navigation Items */
.nav-item {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.nav-item-primary {
  background-color: var(--primary);
  color: white;
}

.nav-item-secondary {
  color: #6b7280;
}

.dark .nav-item-secondary {
  color: #9ca3af;
}

.nav-item-secondary:hover {
  color: #111827;
  background-color: #f3f4f6;
}

.dark .nav-item-secondary:hover {
  color: #f9fafb;
  background-color: #374151;
}

/* Navigation Actions */
.nav-action {
  padding: 0.5rem;
  color: #6b7280;
  border-radius: 9999px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-action:hover {
  color: #374151;
  background-color: #f3f4f6;
}

/* ===== BUTTON COMPONENTS ===== */

.feedback-btn {
  background-color: #ef4444;
}
/* Primary Button */
.btn-primary {
  padding: 0.375rem 0.75rem !important;
  font-size: 0.7rem !important;
  min-height: 32px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  background-color: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
}

.btn-primary:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--primary), 0 0 0 3px rgba(79, 140, 255, 0.1);
}

/* Secondary Button */
.btn-secondary {
  background-color: #f3f4f6;
  color: #374151;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.dark .btn-secondary {
  background-color: #374151;
  color: #f9fafb;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
}

.dark .btn-secondary:hover {
  background-color: #4b5563;
}

.btn-secondary:focus {
  outline: none;
  box-shadow: 0 0 0 1px #d1d5db, 0 0 0 3px rgba(209, 213, 219, 0.1);
}

/* Outline Button - Higher specificity to override style.css */
button.btn-outline,
.btn-outline {
  padding: 0.375rem 0.75rem !important;
  font-size: 0.7rem !important;
  min-height: 32px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  background-color: transparent !important;
  color: #374151 !important;
  border-radius: 9999px !important;
  font-weight: 500 !important;
  transition: all 0.2s !important;
  border: 1px solid #d1d5db !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

.dark button.btn-outline,
.dark .btn-outline {
  color: #f9fafb !important;
  border-color: #6b7280 !important;
}

button.btn-outline:hover,
.btn-outline:hover {
  background-color: #f9fafb !important;
  border-color: #9ca3af !important;
}

.dark button.btn-outline:hover,
.dark .btn-outline:hover {
  background-color: #374151 !important;
  border-color: #9ca3af !important;
}

button.btn-outline:focus,
.btn-outline:focus {
  outline: none !important;
  box-shadow: 0 0 0 1px #d1d5db, 0 0 0 3px rgba(209, 213, 219, 0.1) !important;
}

/* Disabled button states - Higher specificity to override style.css */
button.btn-primary:disabled,
button.btn-secondary:disabled,
button.btn-outline:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-outline:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

button.btn-primary:disabled:hover,
button.btn-secondary:disabled:hover,
button.btn-outline:disabled:hover,
.btn-primary:disabled:hover,
.btn-secondary:disabled:hover,
.btn-outline:disabled:hover {
  background-color: inherit !important;
  transform: none !important;
}

/* Message Actions - Small buttons below chat messages */
.message-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.5rem;
}

/* Compact Button Variant - Optimized for undo/redo buttons */
button.btn-compact,
.btn-compact {
  padding: 0.375rem 0.75rem !important;
  font-size: 0.7rem !important;
  min-height: 32px !important;
  min-width: 80px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Specific styling for undo/redo buttons */
#undoBtn,
#redoBtn {
  min-width: 85px !important;
  justify-content: center !important;
  text-align: center !important;
  line-height: 1.2 !important;
}

/* ===== CARD COMPONENTS ===== */

/* Basic Card */
.card {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: all 0.2s;
}

.dark .card {
  background-color: #1f2937;
  border-color: #374151;
}

.card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dark .card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

/* Card Header */
.card-header {
  padding: 1rem;
  border-bottom: 1px solid #f3f4f6;
  background-color: #f9fafb;
}

.dark .card-header {
  border-bottom-color: #374151;
  background-color: #374151;
}

/* Card Body */
.card-body {
  padding: 1rem;
}

/* ===== FORM COMPONENTS ===== */

/* Input Field */
.input-field {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: all 0.2s;
  background-color: white;
  color: #374151;
}

.dark .input-field {
  background-color: #374151;
  border-color: #6b7280;
  color: #f9fafb;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 0 0 3px rgba(79, 140, 255, 0.1);
}

/* ===== UTILITY CLASSES ===== */

/* Width utilities */
.w-full {
  width: 100% !important;
}

/* Text utilities */
.text-sm {
  font-size: 0.875rem !important;
}

.text-gray-600 {
  color: #6b7280 !important;
}

.mb-0 {
  margin-bottom: 0 !important;
}

/* Margin utilities */
.me-2 {
  margin-right: 0.5rem !important;
}

/* Transitions */
.transition-all {
  transition: all 0.2s;
}

/* Focus States */
.focus-ring {
  outline: none;
  box-shadow: 0 0 0 1px var(--primary), 0 0 0 3px rgba(79, 140, 255, 0.1);
}

/* Hover Effects */
.hover-lift:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Interactive Page Specific Utilities */
.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.875rem;
}

.text-base {
  font-size: 1rem;
}

.text-lg {
  font-size: 1.125rem;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.rounded-sm {
  border-radius: 0.125rem;
}

.rounded-md {
  border-radius: 0.375rem;
}

.rounded-lg {
  border-radius: 0.5rem;
}

.rounded-xl {
  border-radius: 0.75rem;
}

/* ===== INTERACTIVE PAGE COMPONENTS ===== */

/*
/* Chat Interface */
.chat-interface {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
}

.dark .chat-interface {
  background: #1f2937;
  border-color: #374151;
}

.chat-header {
  padding: 0.25rem 1rem;
  background: transparent;
  border: none;
}

.dark .chat-header {
  background: transparent;
  border: none;
}

.chat-header h3 {
  font-size: 1rem;
  font-weight: 500;
  color: #111827;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
}

.dark .chat-header h3 {
  color: #f9fafb;
}

.chat-header p {
  font-size: 0.75rem;
  color: #6b7280;
}

.dark .chat-header p {
  color: #9ca3af;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  /* Ensure smooth scrolling works well with auto-scroll */
  scroll-behavior: smooth;
  scroll-padding: 1rem;
  /* Prevent scroll jumping on content changes */
  contain: layout style;
}



/* Data Toolbar */
.data-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .data-toolbar {
  background: #1f2937;
  border-color: #374151;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Stat Items */
.stat-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: #f8f9fa;
  border-radius: 0.375rem;
  border: 1px solid #e5e7eb;
  transition: all 0.2s;
  min-width: fit-content;
  height: 32px;
}

.dark .stat-item {
  background: #374151;
  border-color: #6b7280;
}

.stat-item:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark .stat-item:hover {
  background: #4b5563;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  line-height: 1;
  margin: 0;
}

.dark .stat-value {
  color: #f9fafb;
}

.stat-label {
  font-size: 0.625rem;
  color: #6b7280;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  margin: 0;
}

.dark .stat-label {
  color: #9ca3af;
}

.grid-container {
  height: 500px;
}
/* Grid Container */
.grid-container {
  flex: 1;
  height: 100%;
  width: 100%;
  position: relative;
  min-height: 0;
  overflow: visible;
  background: #ffffff;
  border-radius: 0.375rem;
}

.dark .grid-container {
  background: #1f2937;
}

/* Connection Status */
.connection-status-wrapper {
  display: flex;
  align-items: center;
  margin-left: 0.5rem;
}

.connection-status {
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  position: relative;
}

.connection-status.connected {
  background-color: #10b981;
  box-shadow: 0 0 5px #10b981;
}

.connection-status.disconnected {
  background-color: #ef4444;
  box-shadow: 0 0 5px #ef4444;
}

.connection-status.connecting {
  background-color: #f59e0b;
  box-shadow: 0 0 5px #f59e0b;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}


/* Compact Stats Bar */
.compact-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border-radius: 0.375rem 0.375rem 0 0;
  margin-bottom: 0.5rem;
  min-height: 2.5rem;
}

.dark .compact-stats-bar {
  background: transparent;
}

.compact-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.compact-stat-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  padding: 0.25rem 0.5rem;
  min-width: 2rem;
  text-align: center;
}

.compact-stat-value {
  font-size: 0.775rem;
  font-weight: 600;
}

.dark .compact-stat-value {
  color: #f1f5f9;
}

.compact-stat-label {
  font-size: 0.625rem;
  color: #64748b;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.dark .compact-stat-label {
  color: #94a3b8;
}

.compact-stats-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.compact-stats-actions .btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  height: 1.75rem;
}

/* Chat View Container */
.chat-view-container {
  width: 20rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  height: 100%;
  background-color: transparent;
  overflow: hidden;
}

.dark .chat-view-container {
  background-color: transparent;
}

/* File Drop Area */
.file-drop-area {
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 80%;
  max-width: 500px;
  border-radius: 0.5rem;
  position: relative;
  z-index: 1;
}

.file-drop-area:hover {
  background: rgba(79, 140, 255, 0.05);
  transform: translateY(-4px);
}

.dark .file-drop-area:hover {
  background: rgba(79, 140, 255, 0.1);
}

.file-drop-area.highlight {
  border-color: #4f8cff;
  background: rgba(79, 140, 255, 0.1);
  transform: scale(1.02);
}

.dark .file-drop-area.highlight {
  background: rgba(79, 140, 255, 0.2);
}

.file-drop-area i {
  color: #4f8cff;
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  transition: transform 0.3s ease;
}

.dark .file-drop-area i {
  color: #60a5fa;
}

.file-drop-area:hover i {
  transform: scale(1.1) rotate(5deg);
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 10;
  border-radius: 0.75rem;
}

.loading-overlay .spinner-border {
  color: var(--primary);
  width: 3rem;
  height: 3rem;
}

.loading-overlay .loading-text {
  margin-top: 1rem;
  color: var(--text);
  font-weight: 500;
  transition: opacity 0.3s ease;
}

/* Hidden utility class */
.hidden {
  display: none !important;
}

/* Message Styles */
.message {
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  max-width: 90%;
  word-wrap: break-word;
  font-size: 0.875rem;
  line-height: 1.4;
}

.message.user {
  background: #4f8cff !important;
  color: white !important;
  align-self: flex-end;
  border-bottom-right-radius: 0.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

.dark .message.user {
  background: #60a5fa !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

.message.system {
  background-color: #f8f9fa;
  color: #374151;
  align-self: flex-start;
  border-bottom-left-radius: 0.25rem;
  border: 1px solid #e5e7eb;
}
.message.system.typing-indicator .typing-content {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.message.system.typing-indicator #typingText {
  transition: opacity 0.2s ease;
}

.spinner-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-block;
  animation: pulse 0.9s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.6; }
  50% { transform: scale(1); opacity: 1; }
}

.dark .message.system {
  background-color: #374151;
  color: #f9fafb;
  border-color: #6b7280;
}

.message.system.explanation {
  background-color: #ffffff;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
}

.dark .message.system.explanation {
  background-color: #1f2937;
  border-color: #374151;
}

.explanation-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4f8cff;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dark .explanation-header {
  color: #60a5fa;
  border-bottom-color: #6b7280;
}

/* Chat Form Styling */
.chat-form {
  padding: 0.75rem;
  background-color: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.dark .chat-form {
  background-color: transparent;
}

.chat-form textarea {
  resize: none;
  height: 150px;
  border-radius: 0.5rem;
  border: none;
  background-color: transparent;
  color: #374151;
}

.dark .chat-form textarea {
  background-color: transparent;
  color: #f9fafb;
}

.chat-form textarea:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--primary), 0 0 0 3px rgba(79, 140, 255, 0.1);
}

.dark .chat-form textarea:focus {
  background-color: transparent;
  color: #f9fafb;
  box-shadow: 0 0 0 1px var(--primary), 0 0 0 3px rgba(79, 255, 140, 0.1);
}

/* ===== AUTH PAGES (LOGIN & SIGNUP) ===== */

/* Auth Container */
.auth-container {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
}

/* Auth Card */
.auth-card {
  width: 100%;
  max-width: 400px;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.auth-card.signup {
  max-width: 450px;
}

.dark .auth-card {
  background: #1f2937;
  border-color: #374151;
}

/* Auth Header */
.auth-header {
  background: linear-gradient(135deg, #4f8cff 0%, #2563eb 100%);
  color: white;
  padding: 0.5rem 0.5rem;
  text-align: center;
}

.auth-logo {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.auth-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: white;
}

/* Auth Body */
.auth-body {
  padding: 2rem 1.5rem;
}

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

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
}

.dark .form-label {
  color: #f9fafb;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: all 0.2s;
  background-color: white;
  color: #374151;
}

.dark .form-input {
  background-color: #374151;
  border-color: #6b7280;
  color: #f9fafb;
}

.form-input:focus {
  outline: none;
  border-color: #4f8cff;
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.1);
}

.form-text {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.dark .form-text {
  color: #9ca3af;
}

.form-error {
  font-size: 0.75rem;
  color: #dc2626;
  margin-top: 0.25rem;
}

/* Auth Footer */
.auth-footer {
  padding: 1.5rem;
  text-align: center;
  background-color: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.dark .auth-footer {
  background-color: #374151;
  border-top-color: #6b7280;
}

.auth-link {
  color: #4f8cff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.auth-link:hover {
  color: #2563eb;
}

/* Auth Notifications - Unified with Error Notification System */
.alert {
  position: relative;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  animation: slideInDown 0.07s ease-out;
  line-height: 1.4;
}

.dark .alert {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Danger/Error Alerts */
.alert-danger {
  background: #fef2f2;
  color: #dc2626;
}

.dark .alert-danger {
  background: rgba(127, 29, 29, 0.2);
  color: #fca5a5;
}

/* Success Alerts */
.alert-success {
  background: #f0fdf4;
  color: #16a34a;
}

.dark .alert-success {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

/* Info Alerts */
.alert-info {
  background: #eff6ff;
  color: #2563eb;
}

.dark .alert-info {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

/* Warning Alerts */
.alert-warning {
  background: #fffbeb;
  color: #d97706;
}

.dark .alert-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

/* Alert Icons */
.alert::before {
  content: '';
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.alert-danger::before {
  background-color: #dc2626;
}

.dark .alert-danger::before {
  background-color: #fca5a5;
}

.alert-success::before {
  background-color: #16a34a;
}

.dark .alert-success::before {
  background-color: #6ee7b7;
}

.alert-info::before {
  background-color: #2563eb;
}

.dark .alert-info::before {
  background-color: #93c5fd;
}

.alert-warning::before {
  background-color: #d97706;
}

.dark .alert-warning::before {
  background-color: #fcd34d;
}

/* Additional Alert Types for Compatibility */
.alert-secondary {
  background: #f3f4f6;
  color: #6b7280;
}

.dark .alert-secondary {
  background: rgba(107, 114, 128, 0.2);
  color: #9ca3af;
}

.alert-secondary::before {
  background-color: #6b7280;
}

.dark .alert-secondary::before {
  background-color: #9ca3af;
}

.alert-primary {
  background: #eff6ff;
  color: #2563eb;
}

.dark .alert-primary {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

.alert-primary::before {
  background-color: #2563eb;
}

.dark .alert-primary::before {
  background-color: #93c5fd;
}

/* ===== ERROR NOTIFICATION SYSTEM ===== */

/* Error Container */
.error-notification {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999999;
  min-width: auto;
  max-width: 90vw;
  background: #fef2f2;
  border: none;
  border-radius: 9999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 0.375rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  animation: slideInDown 0.07s ease-out;
  white-space: nowrap;
}

.dark .error-notification {
  background: rgba(127, 29, 29, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Error Message */
.error-notification .error-message {
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 500;
  margin: 0;
  line-height: 1.2;
}

.dark .error-notification .error-message {
  color: #fca5a5;
}

/* Error Close Button */
.error-notification .error-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0.125rem;
  border-radius: 9999px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  min-height: 16px;
  flex-shrink: 0;
}

.error-notification .error-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.dark .error-notification .error-close:hover {
  background: #374151;
  color: #f9fafb;
}

/* Error Icon */
.error-notification .error-icon {
  color: #ef4444;
  margin-right: 0.25rem;
  font-size: 0.75rem;
}

.dark .error-notification .error-icon {
  color: #fca5a5;
}

/* Animation */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Success Notification Variant */
.notification-success {
  background: #f0fdf4 !important;
  border-color: #10b981;
}

.notification-success .error-message {
  color: #059669;
}

.dark .notification-success {
  background: rgba(16, 185, 129, 0.2) !important;
}

.dark .notification-success .error-message {
  color: #6ee7b7;
}

/* Warning Notification Variant */
.notification-warning {
  background: #fffbeb !important;
  border-color: #f59e0b;
}

.notification-warning .error-message {
  color: #d97706;
}

.dark .notification-warning {
  background: rgba(245, 158, 11, 0.2) !important;
}

.dark .notification-warning .error-message {
  color: #fcd34d;
}

/* Info Notification Variant */
.notification-info {
  background: #eff6ff !important;
  border-color: #3b82f6;
}

.notification-info .error-message {
  color: #1d4ed8;
}

.dark .notification-info {
  background: rgba(59, 130, 246, 0.2) !important;
}

.dark .notification-info .error-message {
  color: #93c5fd;
}

.notification-success .error-icon {
  color: #10b981;
}

.dark .notification-success .error-icon {
  color: #6ee7b7;
}

/* Warning Notification Variant */
.notification-warning {
  border-color: #f59e0b;
}

.notification-warning .error-message {
  color: #d97706;
}

.dark .notification-warning .error-message {
  color: #fcd34d;
}

.notification-warning .error-icon {
  color: #f59e0b;
}

.dark .notification-warning .error-icon {
  color: #fcd34d;
}

/* Upload Component */
.upload-component {
  border-radius: 0.5rem;
  padding: 2rem;
  text-align: center;
  transition: all 0.2s ease;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.upload-component:hover {
  background: #f9fafb;
}

.dark .upload-component {
  background: #111827;
}

.dark .upload-component:hover {
  background: #1f2937;
}

/* ===== CENTRALIZED MODAL SYSTEM ===== */

/* Override Bootstrap modal styles that interfere with our centering */
.modal-container,
.modal-container * {
  /* Reset any Bootstrap modal positioning */
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  float: none !important;
}

.modal-container {
  /* Restore our positioning */
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
}

/* Modal Backdrop - Dark overlay for sleek modals */
.modal-container .modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999998;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: auto;
}

/* Override any Bootstrap modal backdrop styles */
.modal-container .modal-backdrop.show {
  background: rgba(0, 0, 0, 0.5) !important;
}

/* Ensure no other modal backdrop styles interfere */
.modal-container .modal-backdrop,
.modal-container .modal-backdrop.show {
  background: rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.modal-container .modal-backdrop.show {
  display: block;
  opacity: 1;
}

/* Modal Container - Override Bootstrap */
.modal-container {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  /* Ensure hidden modals don't interfere with page interactions */
  visibility: hidden;
  user-select: none;
}

.modal-container.show {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  user-select: auto;
}

/* Modal Dialog - Override Bootstrap */
.modal-dialog {
  background: var(--surface-2, #ffffff) !important;
  border: 1px solid var(--border, #e5e7eb) !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
  max-width: 90vw !important;
  max-height: 90vh !important;
  overflow: hidden !important;
  transform: scale(0.95) !important;
  transition: transform 0.2s ease !important;
  position: relative !important;
  z-index: 10000000 !important;
  pointer-events: auto !important;
  /* Ensure dialog is centered in container */
  margin: 0 auto !important;
  /* Override Bootstrap's modal-dialog positioning */
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: scale(0.95) !important;
}

.modal-container.show .modal-dialog {
  transform: scale(1);
}

/* Ensure hidden modals are completely non-interactive */
.modal-container:not(.show) {
  /* Completely disable interactions when hidden */
  pointer-events: none !important;
  visibility: hidden !important;
  user-select: none !important;
  /* Ensure it doesn't block any page elements */
  z-index: -1 !important;
}

.modal-container:not(.show) .modal-dialog {
  /* Hide dialog content when modal is hidden */
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Ensure backdrop is also completely hidden when not shown */
.modal-container .modal-backdrop:not(.show) {
  /* Completely disable backdrop when hidden */
  pointer-events: none !important;
  visibility: hidden !important;
  z-index: -1 !important;
}

/* Specific fix for delete dataset modal to ensure it doesn't interfere when hidden */
#deleteDatasetModal:not(.show),
#deleteDatasetModalBackdrop:not(.show) {
  /* Completely disable when hidden */
  pointer-events: none !important;
  visibility: hidden !important;
  user-select: none !important;
  z-index: -1 !important;
  /* Ensure it doesn't take up space or block interactions */
  position: absolute !important;
  top: -9999px !important;
  left: -9999px !important;
}

/* Modal Sizes */
.modal-dialog.small {
  width: 320px;
}

.modal-dialog.medium {
  width: 480px;
}

.modal-dialog.large {
  width: 640px;
}

.modal-dialog.xlarge {
  width: 800px;
}

/* Modal Header */
.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
  background: var(--surface-3, #f9fafb);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-title i {
  color: var(--primary);
  font-size: 1.125rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.375rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.modal-close:hover {
  background: var(--surface-4);
  color: var(--text);
  transform: scale(1.1);
}

/* Modal Body */
.modal-body {
  padding: 1.25rem;
  background: var(--surface-2, #ffffff);
  overflow-y: auto;
  max-height: 70vh;
  font-size: 0.875rem;
  gap: 0.5rem;
}

/* Modal Footer */
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border, #e5e7eb);
  background: var(--surface-3, #f9fafb);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Modal Button Variants */
.modal-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  z-index: 10000001;
  pointer-events: auto;
}

.modal-btn-primary {
  background: var(--primary);
  color: white;
}

.modal-btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.modal-btn-secondary {
  background: var(--surface-4);
  color: var(--text);
  border: 1px solid var(--border);
}

.modal-btn-secondary:hover {
  background: var(--surface-5);
  transform: translateY(-1px);
}

.modal-btn-danger {
  background: #ef4444;
  color: white;
}

.modal-btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* Dark Mode Variants */
.dark .modal-dialog {
  background: var(--dark-surface);
  border-color: var(--dark-border);
}

.dark .modal-header {
  background: var(--dark-surface-2);
  border-color: var(--dark-border);
}

.dark .modal-body {
  background: var(--dark-surface);
}

.dark .modal-footer {
  background: var(--dark-surface-2);
  border-color: var(--dark-border);
}

/* ===== AG GRID CUSTOMIZATION ===== */

.ag-theme-balham .ag-header-cell-text {
  font-size: 0.7rem !important; /* Slightly smaller font */
  font-weight: 600 !important;
  line-height: 1.2 !important;
}

/* Also target the header container */
.ag-theme-balham .ag-header-container {
  /* revert to default to avoid hidden header rows */
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
}

/* Shared dtype label styling */
.mi-dtype-label {
  display: block;
  font-style: italic;
  color: #1d4ed8;
}

.dark .mi-dtype-label {
  color: #93c5fd;
}

/* Two-line header styling without extra markup: first line (name) vs second line (dtype) */
.ag-theme-balham .ag-header-cell-text {

}

.dark .ag-theme-balham .ag-header-cell-text {
  /* Removed blue color for new lines in dark mode */
}

.ag-theme-balham .ag-header-cell-text {
  font-style: normal; /* header name non-italic */
  color: #111827; /* dark gray for header name in light mode */
}

.dark .ag-theme-balham .ag-header-cell-text {
  color: #f9fafb; /* near white for header name in dark mode */
}

/* Make grouped header text match single header typography */
.ag-theme-balham .ag-header-group-cell .ag-header-group-text {
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  color: #111827 !important;
}

.dark .ag-theme-balham .ag-header-group-cell .ag-header-group-text {
  color: #f9fafb !important;
}

/* ===== MULTI-TASK TOGGLE STYLES ===== */

/* Multi-Task Toggle Styles */
.form-header-with-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-checkbox {
  display: none;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: #ccc;
  border-radius: 12px;
  transition: background-color 0.3s ease;
}

.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-checkbox:checked + .toggle-label .toggle-switch {
  background-color: var(--primary);
}

.toggle-checkbox:checked + .toggle-label .toggle-slider {
  transform: translateX(20px);
}

.toggle-checkbox:checked + .toggle-label .toggle-text {
  color: var(--primary);
  font-weight: 600;
}

/* Multi-Task Container Styles */
.multi-task-info {
  margin-bottom: 15px;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 6px;
  border-left: 4px solid var(--primary);
}

.multi-task-info .text-muted {
  color: #6c757d;
  font-size: 0.875rem;
}

.multi-task-info i {
  margin-right: 6px;
  color: var(--primary);
}

.tasks-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.task-item {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 15px;
  transition: border-color 0.2s ease;
}

.task-item:hover {
  border-color: var(--primary);
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.task-label {
  font-weight: 600;
  color: var(--primary);
  font-size: 0.95rem;
  margin: 0;
}

.btn-remove-task {
  background: none;
  border: none;
  color: #dc3545;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.btn-remove-task:hover {
  background-color: #ffe6e6;
}

.task-textarea {
  width: 100%;
  border: 1px solid #ced4da;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 60px;
}

.task-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.2);
}

.btn-add-task {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: transparent;
  border: 2px dashed var(--primary);
  color: var(--primary);
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-top: 10px;
  width: 100%;
  justify-content: center;
}

.btn-add-task:hover {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-add-task i {
  font-size: 0.8rem;
}