/* UI Enhancements for ToastToQB */

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in-prepare {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* Enhanced Hover Effects */
.dashboard-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

/* Smooth Focus States */
.form-control:focus {
  transform: scale(1.02);
  transition: all 0.2s ease;
}

.btn {
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  border: none;
  margin-bottom: 1rem;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  min-width: 300px;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  border-left: 4px solid var(--success-color);
}

.toast-error {
  border-left: 4px solid var(--danger-color);
}

.toast-warning {
  border-left: 4px solid var(--warning-color);
}

.toast-info {
  border-left: 4px solid var(--primary-color);
}

.toast-body {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast-body i {
  font-size: 1.25rem;
}

.toast-success .toast-body i {
  color: var(--success-color);
}

.toast-error .toast-body i {
  color: var(--danger-color);
}

.toast-warning .toast-body i {
  color: var(--warning-color);
}

.toast-info .toast-body i {
  color: var(--primary-color);
}

/* Enhanced Table Sorting */
th[data-sortable] {
  position: relative;
  user-select: none;
}

th[data-sortable]::after {
  content: '\f0dc';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 1rem;
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

th[data-sortable]:hover::after {
  opacity: 0.7;
}

th.sort-asc::after {
  content: '\f0de';
  opacity: 1;
}

th.sort-desc::after {
  content: '\f0dd';
  opacity: 1;
}

/* Enhanced Form Validation */
.form-control.is-valid {
  border-color: var(--success-color);
  box-shadow: 0 0 0 0.2rem rgba(16, 185, 129, 0.1);
}

.form-control.is-invalid {
  border-color: var(--danger-color);
  box-shadow: 0 0 0 0.2rem rgba(239, 68, 68, 0.1);
}

.invalid-feedback {
  color: var(--danger-color);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.invalid-feedback::before {
  content: '\f071';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

.valid-feedback {
  color: var(--success-color);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.valid-feedback::before {
  content: '\f058';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  border-radius: inherit;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f4f6;
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Empty States */
.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.empty-state-content {
  max-width: 400px;
  margin: 0 auto;
}

.empty-state i {
  opacity: 0.5;
  margin-bottom: 1rem;
}

.empty-state h4 {
  margin-bottom: 0.5rem;
}

.empty-state p {
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* Loading States */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f4f6;
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Form Enhancements */
.form-section {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
  border: 1px solid #e2e8f0;
}

.form-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--secondary-color);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 0;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group-inline {
  display: flex;
  gap: 1rem;
  align-items: end;
}

.form-group-inline .form-group {
  margin-bottom: 0;
  flex: 1;
}

.form-control {
  border-radius: 6px;
  border: 1px solid #d1d5db;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  width: 100%;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
  outline: none;
}

.form-label {
  font-weight: 500;
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
  display: block;
  font-size: 0.875rem;
}

.form-text {
  color: #6b7280;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* Status Indicators */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
}

.status-indicator.connected {
  background: #dcfce7;
  color: #166534;
}

.status-indicator.disconnected {
  background: #fee2e2;
  color: #991b1b;
}

.status-indicator.pending {
  background: #fef3c7;
  color: #92400e;
}

.status-indicator i {
  font-size: 0.75rem;
}

/* Progress Bars */
.progress-container {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}

.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.875rem;
  color: #64748b;
  display: flex;
  justify-content: between;
}

/* Action Groups */
.action-group {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 1rem 0;
  border-top: 1px solid #e2e8f0;
  margin-top: 1.5rem;
}

.action-group.left {
  justify-content: flex-start;
}

.action-group.center {
  justify-content: center;
}

.action-group.space-between {
  justify-content: space-between;
}

/* Data Tables Enhancements */
.data-table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.data-table-search {
  position: relative;
  max-width: 300px;
}

.data-table-search input {
  padding-left: 2.5rem;
}

.data-table-search i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
}

.data-table-filters {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-tag {
  background: var(--primary-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.filter-tag .remove {
  cursor: pointer;
  margin-left: 0.25rem;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
  .page-header {
    text-align: left;
  }
  
  .page-header .d-flex {
    flex-direction: column;
    align-items: flex-start !important;
  }
  
  .page-actions {
    width: 100%;
    justify-content: flex-start;
    margin-top: 1rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .form-group-inline {
    flex-direction: column;
    gap: 0;
  }
  
  .form-group-inline .form-group {
    margin-bottom: 1rem;
  }
  
  .btn-group {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn-group .btn {
    width: 100%;
    justify-content: center;
  }
  
  .content-area {
    padding: 1rem;
  }
  
  .form-section {
    padding: 1rem;
  }
  
  .dashboard-card {
    height: auto;
    min-height: 120px;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 1.5rem;
  }
  
  .form-section-title {
    font-size: 1rem;
  }
  
  .btn {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
  }
}

@media (min-width: 1200px) {
  .content-area {
    padding: 2rem;
  }
}

/* Alerts Container */
.alerts-container {
  margin-bottom: 1.5rem;
}

.alerts-container .alert {
  margin-bottom: 0.75rem;
}

.alerts-container .alert:last-child {
  margin-bottom: 0;
}

/* Card Enhancements */
.card-modern {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: none;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-modern .card-header {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid #e2e8f0;
  padding: 1.5rem;
}

.card-modern .card-body {
  padding: 1.5rem;
}

.card-modern .card-footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 1rem 1.5rem;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.quick-action-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.quick-action-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  text-decoration: none;
  color: inherit;
}

.quick-action-card i {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.quick-action-card h5 {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.quick-action-card p {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0;
}

/* Breadcrumb Enhancement */
.breadcrumb-modern {
  background: transparent;
  padding: 0;
  margin-bottom: 1rem;
}

.breadcrumb-modern .breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.breadcrumb-modern .breadcrumb-item + .breadcrumb-item::before {
  content: "\f054";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: #9ca3af;
  margin-right: 0.5rem;
}

/* Override excessive animations */
.dashboard-card:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}

.form-control:focus {
  transform: none !important;
}

.btn::before {
  display: none !important;
}

/* Fix layout width constraints */
.container-fluid {
  max-width: 1400px;
  margin: 0 auto;
}

/* Better table responsiveness */
.table-responsive {
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.table {
  margin-bottom: 0;
}