/**
 * Component styles for reusable UI components
 */

/* Fix for no-underline utility - override global a:hover rule */
.no-underline,
.no-underline:hover,
.no-underline:focus {
  text-decoration: none !important;
}

/* Custom Utility Classes for CSS Variables */

/* Background Color Utilities */
.bg-color-primary {
  background-color: var(--color-primary);
}

.bg-color-primary-light {
  background-color: var(--color-primary-light);
}

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

.bg-color-success {
  background-color: var(--color-success);
}

.bg-color-warning {
  background-color: var(--color-warning);
}

.bg-color-error {
  background-color: var(--color-error);
}

.bg-background-primary {
  background-color: var(--background-primary);
}

.bg-background-secondary {
  background-color: var(--background-secondary);
}

/* Background CSS Variable Utilities */
.bg-bg-primary {
  background-color: var(--bg-primary);
}

.bg-bg-secondary {
  background-color: var(--bg-secondary);
}

.bg-bg-tertiary {
  background-color: var(--bg-tertiary);
}

.bg-bg-quaternary {
  background-color: var(--bg-quaternary);
}

/* Text Color Utilities */
.text-text-primary {
  color: var(--text-primary);
}

.text-text-secondary {
  color: var(--text-secondary);
}

.text-text-tertiary {
  color: var(--text-tertiary);
}

.text-color-primary {
  color: var(--color-primary);
}

.text-color-primary-light {
  color: var(--color-primary-light);
}

.text-color-primary-dark {
  color: var(--color-primary-dark);
}

.text-color-success {
  color: var(--color-success);
}

.text-color-warning {
  color: var(--color-warning);
}

.text-color-error {
  color: var(--color-error);
}

.text-color-info {
  color: var(--color-info);
}

.text-color-accent {
  color: var(--color-accent);
}

/* Additional background color utilities */
.bg-color-info {
  background-color: var(--color-info);
}

.bg-color-accent {
  background-color: var(--color-accent);
}

.bg-color-secondary {
  background-color: var(--color-secondary);
}

.bg-color-secondary-light {
  background-color: var(--color-secondary-light);
}

.bg-color-secondary-dark {
  background-color: var(--color-secondary-dark);
}

/* Border color utilities */
.border-color-success {
  border-color: var(--color-success);
}

.border-color-warning {
  border-color: var(--color-warning);
}

.border-color-error {
  border-color: var(--color-error);
}

.border-color-info {
  border-color: var(--color-info);
}

.border-color-secondary {
  border-color: var(--color-secondary);
}

.border-color-accent {
  border-color: var(--color-accent);
}

/* Border Color Utilities */
.border-color-primary {
  border-color: var(--color-primary);
}

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

.border-border-secondary {
  border-color: var(--border-secondary);
}

/* Ring Color Utilities */
.ring-color-primary {
  --tw-ring-color: var(--color-primary);
}

.ring-color-primary\/20 {
  --tw-ring-color: rgba(215, 119, 6, 0.2); /* Fallback for older browsers */
}

/* Additional utility classes matching the component usage */
.bg-color-success\/10 {
  background-color: rgba(5, 150, 105, 0.1);
}

.border-color-error\/20 {
  border-color: rgba(220, 38, 38, 0.2);
}

.bg-color-error\/10 {
  background-color: rgba(220, 38, 38, 0.1);
}

/* Enhanced Bakery-Specific Utility Classes */
.bg-color-sourdough {
  background-color: var(--color-sourdough);
}

.bg-color-whole-wheat {
  background-color: var(--color-whole-wheat);
}

.bg-color-brioche {
  background-color: var(--color-brioche);
}

.text-color-sourdough {
  color: var(--color-sourdough);
}

.text-color-croissant {
  color: var(--color-croissant);
}

.text-color-danish {
  color: var(--color-danish);
}

/* Enhanced Chart Color Utilities */
.bg-chart-primary {
  background-color: var(--chart-primary);
}

.bg-chart-secondary {
  background-color: var(--chart-secondary);
}

.bg-chart-tertiary {
  background-color: var(--chart-tertiary);
}

.text-chart-primary {
  color: var(--chart-primary);
}

.text-chart-secondary {
  color: var(--chart-secondary);
}

.text-chart-tertiary {
  color: var(--chart-tertiary);
}

/* Gradient Background Utilities */
.bg-gradient-primary {
  background: var(--gradient-primary);
}

.bg-gradient-secondary {
  background: var(--gradient-secondary);
}

.bg-gradient-warm {
  background: var(--gradient-warm);
}

.bg-gradient-cool {
  background: var(--gradient-cool);
}

/* Map the different variable names used in the app */
:root {
  --background-primary: var(--bg-primary, #ffffff);
  --background-secondary: var(--bg-secondary, #f8fafc);
}

/* Button Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  min-height: 2.5rem;
  white-space: nowrap;
}

.btn:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Variants */
.btn-primary {
  background-color: var(--color-primary);
  color: var(--text-inverse);
  border-color: var(--color-primary);
}

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

.btn-secondary {
  background-color: var(--color-secondary);
  color: var(--text-inverse);
  border-color: var(--color-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-secondary-dark);
  border-color: var(--color-secondary-dark);
}

.btn-outline {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--color-primary);
  color: var(--text-inverse);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-success {
  background-color: var(--color-success);
  color: var(--text-inverse);
  border-color: var(--color-success);
}

.btn-success:hover:not(:disabled) {
  background-color: var(--color-success-dark);
  border-color: var(--color-success-dark);
}

.btn-error {
  background-color: var(--color-error);
  color: var(--text-inverse);
  border-color: var(--color-error);
}

.btn-error:hover:not(:disabled) {
  background-color: var(--color-error-dark);
  border-color: var(--color-error-dark);
}

.btn-warning {
  background-color: var(--color-warning);
  color: var(--text-inverse);
  border-color: var(--color-warning);
}

.btn-warning:hover:not(:disabled) {
  background-color: var(--color-warning-dark);
  border-color: var(--color-warning-dark);
}

/* Button Sizes */
.btn-sm {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: var(--font-size-xs);
  min-height: 2rem;
}

.btn-lg {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: var(--font-size-base);
  min-height: 3rem;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  padding: var(--spacing-sm);
  min-width: 2.5rem;
  min-height: 2.5rem;
}

/* Card Components */
.card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-primary);
  background-color: var(--bg-secondary);
}

.card-body {
  padding: var(--spacing-lg);
}

.card-footer {
  padding: var(--spacing-lg);
  border-top: 1px solid var(--border-primary);
  background-color: var(--bg-secondary);
}

.card-compact .card-header,
.card-compact .card-body,
.card-compact .card-footer {
  padding: var(--spacing-md);
}

/* Badge Components */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 0.25rem 0.5rem;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-full);
  line-height: 1;
}

.badge-primary {
  background-color: rgb(217 119 6 / 0.1);
  color: var(--color-primary-dark);
}

.badge-secondary {
  background-color: rgb(15 118 110 / 0.1);
  color: var(--color-secondary-dark);
}

.badge-success {
  background-color: rgb(5 150 105 / 0.1);
  color: var(--color-success-dark);
}

.badge-error {
  background-color: rgb(220 38 38 / 0.1);
  color: var(--color-error-dark);
}

.badge-warning {
  background-color: rgb(217 119 6 / 0.1);
  color: var(--color-warning-dark);
}

.badge-info {
  background-color: rgb(37 99 235 / 0.1);
  color: var(--color-info-dark);
}

.badge-neutral {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Alert Components */
.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  margin-bottom: var(--spacing-md);
}

.alert-success {
  background-color: rgb(5 150 105 / 0.05);
  border-color: rgb(5 150 105 / 0.2);
  color: var(--color-success-dark);
}

.alert-error {
  background-color: rgb(220 38 38 / 0.05);
  border-color: rgb(220 38 38 / 0.2);
  color: var(--color-error-dark);
}

.alert-warning {
  background-color: rgb(217 119 6 / 0.05);
  border-color: rgb(217 119 6 / 0.2);
  color: var(--color-warning-dark);
}

.alert-info {
  background-color: rgb(37 99 235 / 0.05);
  border-color: rgb(37 99 235 / 0.2);
  color: var(--color-info-dark);
}

/* Loading Components */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border-secondary);
  border-radius: 50%;
  border-top: 2px solid var(--color-primary);
  animation: spin 1s linear infinite;
}

.spinner-sm {
  width: 0.75rem;
  height: 0.75rem;
  border-width: 1.5px;
}

.spinner-lg {
  width: 1.5rem;
  height: 1.5rem;
  border-width: 3px;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-quaternary) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1rem;
  margin-bottom: var(--spacing-xs);
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
}

/* Form Components */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
}

.form-label-required::after {
  content: " *";
  color: var(--color-error);
}

.form-control {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgb(217 119 6 / 0.1);
}

.form-control:disabled {
  background-color: var(--bg-quaternary);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.form-control.error {
  border-color: var(--color-error);
}

.form-control.error:focus {
  box-shadow: 0 0 0 3px rgb(220 38 38 / 0.1);
}

.form-error {
  font-size: var(--font-size-xs);
  color: var(--color-error);
  margin-top: var(--spacing-xs);
}

.form-help {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin-top: var(--spacing-xs);
}

/* Table Components */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background-color: var(--bg-primary);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table th {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: var(--font-weight-semibold);
  text-align: left;
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border-primary);
}

.table td {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border-primary);
  color: var(--text-primary);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover {
  background-color: var(--bg-secondary);
}

.table-striped tbody tr:nth-child(odd) {
  background-color: var(--bg-secondary);
}

.table-compact th,
.table-compact td {
  padding: var(--spacing-sm);
}

/* Modal Components */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgb(0 0 0 / 0.5);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
}

.modal {
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 32rem;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  z-index: var(--z-modal);
}

.modal-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  padding: var(--spacing-xs);
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}

.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
}

.modal-footer {
  padding: var(--spacing-lg);
  border-top: 1px solid var(--border-primary);
  display: flex;
  gap: var(--spacing-sm);
  justify-content: flex-end;
}

/* Toast Components */
.toast-container {
  position: fixed;
  z-index: var(--z-toast);
  pointer-events: none;
  padding: var(--spacing-md);
}

.toast-container.top-left {
  top: 0;
  left: 0;
}

.toast-container.top-center {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.toast-container.top-right {
  top: 0;
  right: 0;
}

.toast-container.bottom-left {
  bottom: 0;
  left: 0;
}

.toast-container.bottom-center {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.toast-container.bottom-right {
  bottom: 0;
  right: 0;
}

.toast {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  pointer-events: auto;
  min-width: 20rem;
  max-width: 24rem;
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
}

.toast-success {
  border-left: 4px solid var(--color-success);
}

.toast-error {
  border-left: 4px solid var(--color-error);
}

.toast-warning {
  border-left: 4px solid var(--color-warning);
}

.toast-info {
  border-left: 4px solid var(--color-info);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
}

.toast-message {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
}

.toast-close {
  padding: var(--spacing-xs);
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.toast-close:hover {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}

/* Dropdown Components */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 10rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  padding: var(--spacing-xs);
  margin-top: var(--spacing-xs);
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  background: none;
  color: var(--text-primary);
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  text-decoration: none;
  font-size: var(--font-size-sm);
}

.dropdown-item:hover {
  background-color: var(--bg-tertiary);
}

.dropdown-item:focus {
  outline: none;
  background-color: var(--bg-tertiary);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-primary);
  margin: var(--spacing-xs) 0;
}

/* Tab Components */
.tabs {
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: var(--spacing-lg);
}

.tab-list {
  display: flex;
  gap: var(--spacing-md);
}

.tab-item {
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  background: none;
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.tab-item:hover {
  color: var(--text-primary);
}

.tab-item.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Progress Components */
.progress {
  width: 100%;
  height: 0.5rem;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
}

.progress-bar.success {
  background-color: var(--color-success);
}

.progress-bar.error {
  background-color: var(--color-error);
}

.progress-bar.warning {
  background-color: var(--color-warning);
}

/* Pagination Components */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  justify-content: center;
}

.pagination-item {
  padding: var(--spacing-sm);
  border: 1px solid var(--border-secondary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  min-width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
}

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

.pagination-item.active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--text-inverse);
}

.pagination-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================================
   ENTERPRISE DASHBOARD ANIMATIONS
   ============================================================================ */

/* Shimmer effect for top performers and highlights */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.animate-shimmer {
  animation: shimmer 3s infinite linear;
}

/* Pulse glow effect for status indicators */
@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.animate-pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

/* Dashboard card hover effects */
.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}