/* Loading Spinner */
.spinner {
  display: inline-block;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spinner-rotate 0.6s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-md { width: 24px; height: 24px; border-width: 2.5px; }
.spinner-lg { width: 48px; height: 48px; border-width: 3px; }
.spinner-white { color: #fff; }

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 0.5rem;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card { height: 280px; }
.skeleton-row { height: 64px; margin-bottom: 8px; }
.skeleton-text { height: 16px; margin-bottom: 8px; }
.skeleton-text-sm { height: 12px; width: 60%; margin-bottom: 8px; }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 50%; }
.skeleton-thumb { height: 160px; border-radius: 0.75rem 0.75rem 0 0; }

/* Button loading */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}
.btn-loading .btn-text { visibility: hidden; }
.btn-loading .spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  text-align: center;
}
.empty-state-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1.5rem;
  background: #f1f5f9;
  margin-bottom: 1.5rem;
  font-size: 2rem;
  color: #94a3b8;
}
.empty-state-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
}
.empty-state-desc {
  font-size: 0.875rem;
  color: #6b7280;
  max-width: 320px;
  margin-bottom: 1.5rem;
}

/* Form validation */
.form-field--error input,
.form-field--error select,
.form-field--error textarea {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 1px #ef4444;
}
.form-field--error .form-error-message {
  display: block;
}
.form-error-message {
  display: none;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #ef4444;
}
.form-error-summary {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}
.form-error-summary ul {
  margin: 0;
  padding-left: 1.25rem;
  list-style: disc;
}
.form-field--valid input,
.form-field--valid select,
.form-field--valid textarea {
  border-color: #22c55e !important;
}

/* Error state page */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 4rem 1.5rem;
  text-align: center;
}
.error-state-code {
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
  color: #e2e8f0;
  margin-bottom: 0.5rem;
}
.error-state-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.75rem;
}
.error-state-message {
  font-size: 0.9375rem;
  color: #6b7280;
  max-width: 420px;
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* Mobile nav transition */
.mobile-nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  background: rgba(15, 23, 42, 0.55);
}
.mobile-nav-drawer.open {
  display: block;
}
.mobile-nav-drawer .drawer-panel {
  margin-left: auto;
  height: 100%;
  width: 22rem;
  max-width: calc(100vw - 1rem);
  background: #fff;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.mobile-nav-drawer.open .drawer-panel {
  transform: translateX(0);
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 50;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #F2483D;
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 4px 20px rgba(242, 72, 61, 0.3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.3s ease;
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(242, 72, 61, 0.4);
}

/* Touch target minimum: 44px — enforced on small interactive elements */
@media (max-width: 767px) {
  a, button, [role="button"], input[type="submit"], input[type="button"] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Prevent iOS auto-zoom on inputs */
@media (max-width: 767px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}
