/* ==========================
   Skeletons & Loading States
   ========================== */

/* Shimmer animation for skeleton loaders */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Base skeleton style */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--skeleton-bg, rgba(0, 0, 0, 0.08)) 25%,
    var(--skeleton-light, rgba(0, 0, 0, 0.12)) 50%,
    var(--skeleton-bg, rgba(0, 0, 0, 0.08)) 75%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: 0.5rem;
  height: 1rem;
  margin-bottom: 0.75rem;
}

/* Dark mode skeleton */
body.dark .skeleton {
  --skeleton-bg: rgba(255, 255, 255, 0.08);
  --skeleton-light: rgba(255, 255, 255, 0.15);
}

/* Skeleton variations */
.skeleton-text {
  height: 1rem;
  margin-bottom: 0.75rem;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-heading {
  height: 1.5rem;
  margin-bottom: 1rem;
  width: 70%;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin-bottom: 0.5rem;
}

.skeleton-image {
  width: 100%;
  height: 200px;
  border-radius: 0.75rem;
  margin-bottom: 1rem;
}

.skeleton-card {
  padding: 1rem;
  border-radius: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
}

/* Skeleton group layout */
.skeleton-group {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.skeleton-group-content {
  flex: 1;
  min-width: 0;
}

/* Table skeleton */
.skeleton-table tbody tr {
  animation: fadeIn 0.3s ease-in;
}

/* ==========================
   Micro-interactions
   ========================== */

/* Button press animation */
button,
.btn,
input[type="submit"],
input[type="button"],
.clickable {
  transition: transform 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.15s ease,
              background-color 0.2s ease,
              color 0.2s ease;
  position: relative;
}

button:active,
.btn:active,
input[type="submit"]:active,
input[type="button"]:active,
.clickable:active {
  transform: scale(0.98);
}

button:active,
.btn:active,
input[type="submit"]:active,
input[type="button"]:active {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Form field focus animation */
.form-control,
.form-select,
textarea {
  transition: border-color 0.2s ease,
              box-shadow 0.2s ease,
              background-color 0.15s ease;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
  animation: focusGlow 0.3s ease-out;
}

@keyframes focusGlow {
  from {
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.5);
  }
  to {
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
  }
}

/* Page transition animation */
@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-main {
  animation: pageEnter 0.3s ease-out;
}

/* Card hover lift */
.card {
  transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.2s ease,
              border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
}

/* Smooth color transitions */
body,
.card,
.btn,
.form-control,
a {
  transition: background-color 0.3s ease,
              color 0.3s ease,
              border-color 0.3s ease;
}

/* Link hover effect */
a {
  position: relative;
}

a:not(.btn):not(.nav-link)::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.3s ease;
}

a:not(.btn):not(.nav-link):hover::after {
  width: 100%;
}

/* Smooth badge animations */
.badge {
  transition: transform 0.2s ease,
              box-shadow 0.2s ease;
}

.badge:active {
  transform: scale(0.95);
}

/* Icon animations */
.bi {
  transition: transform 0.3s ease,
              color 0.3s ease;
}

button:hover .bi,
.btn:hover .bi,
a:hover .bi {
  animation: iconBounce 0.4s ease-out;
}

@keyframes iconBounce {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
  100% {
    transform: translateY(0);
  }
}

/* Pulse for attention */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==========================
   Status Badges (Enhanced)
   ========================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Status badges */
.badge-pending,
.status-pending {
  background: linear-gradient(135deg, #fff3cd 0%, #ffe5a6 100%);
  color: #856404;
  border: 1px solid rgba(133, 100, 4, 0.2);
  box-shadow: 0 2px 4px rgba(133, 100, 4, 0.1);
}

body.dark .badge-pending,
body.dark .status-pending {
  background: linear-gradient(135deg, #5d4d1f 0%, #6d5d2f 100%);
  color: #ffc107;
}

.badge-approved,
.status-approved {
  background: linear-gradient(135deg, #d4edda 0%, #c7e5d0 100%);
  color: #155724;
  border: 1px solid rgba(21, 87, 36, 0.2);
  box-shadow: 0 2px 4px rgba(21, 87, 36, 0.1);
}

body.dark .badge-approved,
body.dark .status-approved {
  background: linear-gradient(135deg, #204d27 0%, #2d5a35 100%);
  color: #6fc97f;
}

.badge-cancelled,
.status-cancelled {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c2c7 100%);
  color: #721c24;
  border: 1px solid rgba(114, 28, 36, 0.2);
  box-shadow: 0 2px 4px rgba(114, 28, 36, 0.1);
}

body.dark .badge-cancelled,
body.dark .status-cancelled {
  background: linear-gradient(135deg, #5d2d34 0%, #6d3d44 100%);
  color: #f8a5ad;
}

.badge-processing,
.status-processing {
  background: linear-gradient(135deg, #d1ecf1 0%, #c5dfe7 100%);
  color: #0c5460;
  border: 1px solid rgba(12, 84, 96, 0.2);
  box-shadow: 0 2px 4px rgba(12, 84, 96, 0.1);
}

body.dark .badge-processing,
body.dark .status-processing {
  background: linear-gradient(135deg, #1d4d56 0%, #2d5d68 100%);
  color: #6dd5e0;
}

.badge-completed,
.status-completed {
  background: linear-gradient(135deg, #d1e7dd 0%, #c3dfd5 100%);
  color: #0f5132;
  border: 1px solid rgba(15, 81, 50, 0.2);
  box-shadow: 0 2px 4px rgba(15, 81, 50, 0.1);
}

body.dark .badge-completed,
body.dark .status-completed {
  background: linear-gradient(135deg, #1f5d3d 0%, #2f6d4d 100%);
  color: #7ce5a0;
}

.badge-warning,
.status-warning {
  background: linear-gradient(135deg, #fff3cd 0%, #ffe5a6 100%);
  color: #664d03;
  border: 1px solid rgba(102, 77, 3, 0.2);
  box-shadow: 0 2px 4px rgba(102, 77, 3, 0.1);
}

body.dark .badge-warning,
body.dark .status-warning {
  background: linear-gradient(135deg, #5d4d1f 0%, #6d5d2f 100%);
  color: #ffc107;
}

.badge-danger,
.status-danger {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c2c7 100%);
  color: #842029;
  border: 1px solid rgba(132, 32, 41, 0.2);
  box-shadow: 0 2px 4px rgba(132, 32, 41, 0.1);
}

body.dark .badge-danger,
body.dark .status-danger {
  background: linear-gradient(135deg, #5d2d34 0%, #6d3d44 100%);
  color: #f8a5ad;
}

/* ==========================
   Empty States
   ========================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  border-radius: 1rem;
  background: var(--card-bg);
  border: 2px dashed var(--border);
  min-height: 300px;
}

.empty-state-icon {
  font-size: 4rem;
  color: var(--text-muted);
  opacity: 0.4;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.empty-state-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.empty-state-description {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  max-width: 300px;
}

.empty-state-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.empty-state-actions .btn {
  min-width: 150px;
}

/* ==========================
   Form Validation Feedback
   ========================== */

.form-control,
.form-select,
textarea {
  position: relative;
}

/* Validation states */
.form-control.is-valid,
.form-select.is-valid,
textarea.is-valid {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
  padding-right: calc(1.5em + 0.75rem);
  border-color: #198754;
}

.form-control.is-valid:focus,
.form-select.is-valid:focus,
textarea.is-valid:focus {
  border-color: #198754;
  box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25);
}

.form-control.is-invalid,
.form-select.is-invalid,
textarea.is-invalid {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.9h-.4z'/%3E%3Ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
  padding-right: calc(1.5em + 0.75rem);
  border-color: #dc3545;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus,
textarea.is-invalid:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Validation feedback messages */
.valid-feedback,
.invalid-feedback {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875em;
  font-weight: 500;
}

.valid-feedback {
  color: #198754;
}

.invalid-feedback {
  color: #dc3545;
}

body.dark .valid-feedback {
  color: #6fc97f;
}

body.dark .invalid-feedback {
  color: #f8a5ad;
}

/* Validation icon animations */
.form-control.is-valid + .valid-feedback,
.form-control.is-invalid + .invalid-feedback {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================
   Breadcrumbs (Enhanced)
   ========================== */

.breadcrumb {
  background: transparent;
  padding: 0.5rem 1.5rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  display: inline-block;
  margin: 0 0.6rem;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1;
}

nav[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
  content: '/' !important;
}

[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
  content: '/' !important;
}

.breadcrumb-item a {
  color: var(--rose);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
  color: var(--rose-dark);
}

.breadcrumb-item.active {
  color: var(--text-muted);
}

body.dark .breadcrumb {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.dark .breadcrumb-item + .breadcrumb-item::before {
  color: rgba(255, 255, 255, 0.5);
}

body.dark .breadcrumb-item.active {
  color: rgba(255, 255, 255, 0.5);
}

/* ==========================
   Responsive Adjustments
   ========================== */

@media (max-width: 576px) {
  .empty-state {
    min-height: 250px;
    padding: 2rem 1rem;
  }

  .empty-state-icon {
    font-size: 3rem;
  }

  .empty-state-title {
    font-size: 1.25rem;
  }

  .skeleton-group {
    flex-direction: column;
  }

  .badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }
}

/* ==========================
   Dark Mode Specific
   ========================== */

body.dark .empty-state {
  background: rgba(40, 40, 40, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark .breadcrumb {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.dark .form-control.is-valid,
body.dark .form-select.is-valid,
body.dark textarea.is-valid {
  background-color: #2a2a2a;
  color: #fff;
}

body.dark .form-control.is-invalid,
body.dark .form-select.is-invalid,
body.dark textarea.is-invalid {
  background-color: #2a2a2a;
  color: #fff;
}
