/* ============================================
   STANDIGO COMPONENT LIBRARY
   Reusable UI Components
   ============================================ */

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Skip Link - visible only on focus */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  color: white;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  outline: none;
}

/* Screen Reader Only - visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for better visibility */
*:focus-visible {
  outline: 2px solid #6366F1;
  outline-offset: 2px;
}

/* Remove focus outline for mouse users */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Ensure interactive elements have visible focus */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #6366F1;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
  .btn {
    border: 2px solid currentColor;
  }

  .card {
    border: 2px solid #1E293B;
  }
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1;
  border-radius: var(--radius-xl);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-all);
  text-decoration: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-primary-200);
}

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

/* Button Sizes */
.btn-xs {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  border-radius: var(--radius-lg);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
  border-radius: var(--radius-2xl);
}

.btn-xl {
  padding: var(--space-5) var(--space-8);
  font-size: var(--text-lg);
  border-radius: var(--radius-2xl);
}

/* Primary Button */
.btn-primary {
  background: var(--gradient-primary);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary-lg);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--color-slate-50);
  border-color: var(--color-slate-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Accent Button */
.btn-accent {
  background: var(--gradient-accent);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-accent);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -5px rgba(16, 185, 129, 0.35);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-ghost:hover {
  background: var(--color-slate-100);
  color: var(--color-text-primary);
}

/* Outline Variants */
.btn-outline-primary {
  background: transparent;
  color: var(--color-primary-600);
  border-color: var(--color-primary-300);
}

.btn-outline-primary:hover {
  background: var(--color-primary-50);
  border-color: var(--color-primary-500);
}

.btn-outline-accent {
  background: transparent;
  color: var(--color-accent-600);
  border-color: var(--color-accent-300);
}

.btn-outline-accent:hover {
  background: var(--color-accent-50);
  border-color: var(--color-accent-500);
}

/* Danger Button */
.btn-danger {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  color: var(--color-text-inverse);
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -5px rgba(239, 68, 68, 0.35);
}

/* Icon Button */
.btn-icon {
  padding: var(--space-3);
  border-radius: var(--radius-full);
}

.btn-icon.btn-sm {
  padding: var(--space-2);
}

.btn-icon.btn-lg {
  padding: var(--space-4);
}

/* Button with Loading State */
.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition-all);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* Card Variants */
.card-interactive {
  cursor: pointer;
}

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

.card-elevated {
  box-shadow: var(--shadow-lg);
}

.card-elevated:hover {
  box-shadow: var(--shadow-xl);
}

/* Glass Card */
.card-glass {
  background: var(--glass-background);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
}

/* Card with Gradient Border */
.card-gradient {
  position: relative;
  background: var(--color-surface);
  border: none;
}

.card-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 2px;
  background: var(--gradient-primary);
  border-radius: inherit;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* Card Parts */
.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  background: var(--color-slate-50);
  border-top: 1px solid var(--color-border-light);
}

.card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

/* ============================================
   INPUTS & FORMS
   ============================================ */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
}

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

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-xl);
  transition: var(--transition-all);
}

.form-input::placeholder {
  color: var(--color-text-disabled);
}

.form-input:hover {
  border-color: var(--color-slate-300);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 4px var(--color-primary-100);
}

/* Input Sizes */
.form-input-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border-radius: var(--radius-lg);
}

.form-input-lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-lg);
  border-radius: var(--radius-2xl);
}

/* Input States */
.form-input-error {
  border-color: var(--color-error);
}

.form-input-error:focus {
  box-shadow: 0 0 0 4px var(--color-error-light);
}

.form-input-success {
  border-color: var(--color-success);
}

.form-input-success:focus {
  box-shadow: 0 0 0 4px var(--color-success-light);
}

/* Form Helper Text */
.form-helper {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.form-error {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-error);
}

/* Textarea */
textarea.form-input {
  min-height: 120px;
  resize: vertical;
}

/* Select */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748B'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 20px;
  padding-right: var(--space-10);
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.form-check-input {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  appearance: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.form-check-input:checked {
  background: var(--gradient-primary);
  border-color: var(--color-primary-500);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
}

.form-check-input[type="radio"] {
  border-radius: var(--radius-full);
}

.form-check-input[type="radio"]:checked {
  background-image: none;
  box-shadow: inset 0 0 0 4px var(--color-surface);
}

.form-check-label {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--color-slate-300);
  border-radius: var(--radius-full);
  transition: var(--transition-normal);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--color-surface);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-bounce);
}

.toggle-input:checked + .toggle-slider {
  background: var(--gradient-primary);
}

.toggle-input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.toggle-input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px var(--color-primary-200);
}

/* Search Input */
.search-input-wrapper {
  position: relative;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-input {
  padding-left: var(--space-12);
}

/* ============================================
   BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: 1.5;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Badge Variants */
.badge-default {
  background: var(--color-slate-100);
  color: var(--color-text-secondary);
}

.badge-primary {
  background: var(--color-primary-100);
  color: var(--color-primary-700);
}

.badge-accent {
  background: var(--color-accent-100);
  color: var(--color-accent-700);
}

.badge-secondary {
  background: var(--color-secondary-100);
  color: var(--color-secondary-700);
}

.badge-success {
  background: var(--color-success-light);
  color: var(--color-success-dark);
}

.badge-warning {
  background: var(--color-warning-light);
  color: var(--color-warning-dark);
}

.badge-error {
  background: var(--color-error-light);
  color: var(--color-error-dark);
}

.badge-info {
  background: var(--color-info-light);
  color: var(--color-info-dark);
}

/* Featured Badge (Gradient) */
.badge-featured {
  background: var(--gradient-warm);
  color: var(--color-text-inverse);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* Badge with Dot */
.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* Badge Sizes */
.badge-sm {
  padding: 2px var(--space-2);
  font-size: 10px;
}

.badge-lg {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

/* ============================================
   AVATARS
   ============================================ */

.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: var(--color-text-inverse);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Avatar Sizes */
.avatar-xs { width: 24px; height: 24px; font-size: var(--text-xs); }
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-md { width: 40px; height: 40px; font-size: var(--text-sm); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--text-base); }
.avatar-xl { width: 80px; height: 80px; font-size: var(--text-xl); }
.avatar-2xl { width: 120px; height: 120px; font-size: var(--text-3xl); }

/* Avatar with Status Ring */
.avatar-ring {
  box-shadow: 0 0 0 3px var(--color-surface), 0 0 0 5px var(--color-primary-500);
}

.avatar-ring-accent {
  box-shadow: 0 0 0 3px var(--color-surface), 0 0 0 5px var(--color-accent-500);
}

/* Avatar Status Indicator */
.avatar-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-surface);
}

.avatar-status-online { background: var(--color-success); }
.avatar-status-offline { background: var(--color-slate-400); }
.avatar-status-busy { background: var(--color-error); }

/* Avatar Group */
.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--color-surface);
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ============================================
   ALERTS / TOASTS
   ============================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  animation: fadeInUp 0.3s ease-out;
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
}

.alert-dismiss {
  flex-shrink: 0;
  padding: var(--space-1);
  margin: calc(-1 * var(--space-1));
  color: inherit;
  opacity: 0.7;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.alert-dismiss:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

/* Alert Variants */
.alert-success {
  background: var(--color-success-light);
  color: var(--color-success-dark);
  border: 1px solid var(--color-accent-200);
}

.alert-warning {
  background: var(--color-warning-light);
  color: var(--color-warning-dark);
  border: 1px solid #FCD34D;
}

.alert-error {
  background: var(--color-error-light);
  color: var(--color-error-dark);
  border: 1px solid #FCA5A5;
}

.alert-info {
  background: var(--color-info-light);
  color: var(--color-info-dark);
  border: 1px solid #93C5FD;
}

/* Toast Container */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 400px;
}

.toast {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  animation: slideInRight 0.3s ease-out;
  border-left: 4px solid var(--color-slate-300);
  min-width: 280px;
}

.toast.toast-removing {
  animation: slideOutRight 0.3s ease-in forwards;
}

.toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

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

.toast-title {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

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

.toast-close {
  padding: var(--space-1);
  margin: calc(-1 * var(--space-1));
  color: var(--color-text-muted);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  cursor: pointer;
  background: none;
  border: none;
}

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

.toast-close svg {
  width: 16px;
  height: 16px;
}

/* Toast Variants */
.toast-success {
  border-left-color: var(--color-success);
}

.toast-success .toast-icon {
  color: var(--color-success);
}

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

.toast-error .toast-icon {
  color: var(--color-danger);
}

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

.toast-warning .toast-icon {
  color: var(--color-warning);
}

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

.toast-info .toast-icon {
  color: var(--color-info);
}

/* Toast progress bar for auto-dismiss */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.3;
  border-radius: 0 0 0 var(--radius-xl);
  animation: toastProgress linear forwards;
}

.toast-success .toast-progress { background: var(--color-success); }
.toast-error .toast-progress { background: var(--color-danger); }
.toast-warning .toast-progress { background: var(--color-warning); }
.toast-info .toast-progress { background: var(--color-info); }

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ============================================
   MODALS
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  animation: fadeIn 0.2s ease-out;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-modal);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-2xl);
  animation: scaleIn 0.25s ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
}

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

.modal-close {
  padding: var(--space-2);
  margin: calc(-1 * var(--space-2));
  color: var(--color-text-muted);
  border-radius: var(--radius-lg);
  transition: var(--transition-fast);
}

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

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-slate-50);
  border-radius: 0 0 var(--radius-3xl) var(--radius-3xl);
}

/* Mobile Modal (Sheet) */
@media (max-width: 640px) {
  .modal-sheet {
    top: auto;
    bottom: 0;
    left: 0;
    transform: none;
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-3xl) var(--radius-3xl) 0 0;
    animation: slideInUp 0.3s ease-out;
  }

  .modal-sheet::before {
    content: '';
    position: absolute;
    top: var(--space-3);
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--color-slate-300);
    border-radius: var(--radius-full);
  }

  .modal-sheet .modal-header {
    padding-top: var(--space-8);
  }
}

/* ============================================
   DROPDOWNS
   ============================================ */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 200px !important;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border-light);
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition-fast);
  /* Override Bootstrap's display:none to use our opacity/visibility system */
  display: block !important;
}

.dropdown.open .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex !important;
  align-items: center !important;
  gap: var(--space-3) !important;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  border-radius: var(--radius-lg);
  transition: var(--transition-fast);
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--color-slate-100);
  color: var(--color-text-primary);
}

.dropdown-item-icon {
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
}

.dropdown-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-2) 0;
}

/* ============================================
   NOTIFICATION PANEL
   ============================================ */

.notification-dropdown {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: var(--font-bold);
  color: white;
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

.notification-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  width: 360px;
  max-width: calc(100vw - 2rem);
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border-light);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition-fast);
  overflow: hidden;
}

.dropdown.open .notification-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notification-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-slate-50);
}

.notification-panel-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
}

.notification-mark-read {
  font-size: var(--text-xs);
  color: var(--color-primary-600);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.notification-mark-read:hover {
  background: var(--color-primary-50);
}

.notification-panel-content {
  max-height: 360px;
  overflow-y: auto;
}

.notification-panel-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border-light);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-primary-600);
  background: var(--color-slate-50);
  transition: var(--transition-fast);
  text-decoration: none;
}

.notification-panel-footer:hover {
  background: var(--color-primary-50);
  color: var(--color-primary-700);
}

/* Mobile Fullscreen Notifications */
@media (max-width: 640px) {
  .notification-dropdown .notification-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    z-index: 9999 !important;
    transform: translateY(100%) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease !important;
  }

  .notification-dropdown.open .notification-panel {
    transform: translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .notification-panel-header {
    padding: var(--space-4) var(--space-5) !important;
    padding-top: calc(var(--space-4) + env(safe-area-inset-top, 0px)) !important;
    position: relative !important;
    background: white !important;
    border-bottom: 1px solid var(--color-border-light) !important;
  }

  .notification-panel-content {
    flex: 1 !important;
    max-height: none !important;
    height: auto !important;
    overflow-y: auto !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  }

  .notification-panel-footer {
    padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px)) !important;
    background: white !important;
  }

  .notification-close-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-lg);
    border: none;
    background: var(--color-slate-100);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
  }

  .notification-close-mobile:hover {
    background: var(--color-slate-200);
  }
}

@media (min-width: 641px) {
  .notification-close-mobile {
    display: none;
  }
}

/* Notification Items */
.notification-item-mini {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
  transition: var(--transition-fast);
  border-bottom: 1px solid var(--color-border-light);
}

.notification-item-mini:last-child {
  border-bottom: none;
}

.notification-item-mini:hover {
  background: var(--color-slate-50);
}

.notification-item-mini.unread {
  background: var(--color-primary-50);
}

.notification-item-mini.unread:hover {
  background: var(--color-primary-100);
}

.notification-icon-mini {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.notification-content-mini {
  flex: 1;
  min-width: 0;
}

.notification-title-mini {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-primary);
  line-height: 1.4;
}

.notification-time-mini {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Empty State */
.notification-empty {
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.notification-empty-icon {
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.notification-empty-icon svg {
  width: 32px;
  height: 32px;
  margin: 0 auto;
}

.notification-empty-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Loading State */
.notification-loading {
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.notification-spinner {
  width: 24px;
  height: 24px;
  margin: 0 auto;
  border: 3px solid var(--color-slate-200);
  border-top-color: var(--color-primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ============================================
   VIEW TOGGLE (Owner/Explorer)
   ============================================ */

.view-toggle {
  display: flex;
  align-items: center;
  background: var(--color-slate-100);
  padding: 3px;
  border-radius: var(--radius-xl);
  gap: 2px;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.view-toggle-btn:hover {
  color: var(--color-text-primary);
}

.view-toggle-btn.active {
  color: var(--color-text-primary);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.view-toggle-btn svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   TABS
   ============================================ */

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab:hover {
  color: var(--color-text-primary);
  background: var(--color-slate-50);
}

.tab.active {
  color: var(--color-primary-600);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full) var(--radius-full) 0 0;
}

/* Pill Tabs */
.tabs-pills {
  border-bottom: none;
  background: var(--color-slate-100);
  padding: var(--space-1);
  border-radius: var(--radius-xl);
}

.tabs-pills .tab {
  border-radius: var(--radius-lg);
}

.tabs-pills .tab.active {
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.tabs-pills .tab.active::after {
  display: none;
}

/* ============================================
   PROGRESS & LOADERS
   ============================================ */

/* Progress Bar */
.progress {
  width: 100%;
  height: 8px;
  background: var(--color-slate-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 0.5s ease-out;
}

.progress-bar-accent {
  background: var(--gradient-accent);
}

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-slate-200);
  border-top-color: var(--color-primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-slate-100) 25%,
    var(--color-slate-200) 50%,
    var(--color-slate-100) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
}

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

.skeleton-circle {
  border-radius: var(--radius-full);
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-2xl);
}

/* Stand Card Skeleton */
.skeleton-stand-card {
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.skeleton-stand-card .skeleton-header {
  height: 100px;
  background: linear-gradient(
    90deg,
    var(--color-slate-100) 25%,
    var(--color-slate-200) 50%,
    var(--color-slate-100) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-stand-card .skeleton-body {
  padding: var(--space-4);
}

.skeleton-stand-card .skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xl);
  margin-top: -32px;
  margin-bottom: var(--space-3);
  background: linear-gradient(
    90deg,
    var(--color-slate-200) 25%,
    var(--color-slate-300) 50%,
    var(--color-slate-200) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border: 3px solid var(--color-surface);
}

.skeleton-stand-card .skeleton-title {
  height: 20px;
  width: 70%;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-md);
}

.skeleton-stand-card .skeleton-subtitle {
  height: 14px;
  width: 50%;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-md);
}

.skeleton-stand-card .skeleton-stars {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.skeleton-stand-card .skeleton-star {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-sm);
}

.skeleton-stand-card .skeleton-footer {
  display: flex;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-light);
}

.skeleton-stand-card .skeleton-btn {
  flex: 1;
  height: 36px;
  border-radius: var(--radius-lg);
}

/* Map Skeleton */
.skeleton-map {
  width: 100%;
  height: 100%;
  min-height: 300px;
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}

.skeleton-map::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--color-slate-100) 25%,
    var(--color-slate-200) 50%,
    var(--color-slate-100) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-map::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-slate-200);
}

.skeleton-map-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  color: var(--color-slate-400);
  z-index: 1;
}

/* Product Card Skeleton */
.skeleton-product-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.skeleton-product-card .skeleton-image {
  height: 120px;
  background: linear-gradient(
    90deg,
    var(--color-slate-100) 25%,
    var(--color-slate-200) 50%,
    var(--color-slate-100) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-product-card .skeleton-details {
  padding: var(--space-3);
}

.skeleton-product-card .skeleton-name {
  height: 16px;
  width: 80%;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}

.skeleton-product-card .skeleton-price {
  height: 14px;
  width: 40%;
  border-radius: var(--radius-sm);
}

/* ============================================
   TABLES
   ============================================ */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-light);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--space-4) var(--space-5);
  text-align: left;
}

.table th {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  background: var(--color-slate-50);
  border-bottom: 1px solid var(--color-border);
}

.table td {
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border-light);
}

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

.table tr:hover td {
  background: var(--color-slate-50);
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-6);
  color: var(--color-slate-300);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 300px;
  margin-bottom: var(--space-6);
}

/* ============================================
   DIVIDERS
   ============================================ */

.divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-6) 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border-light);
}

/* ============================================
   TOOLTIPS
   ============================================ */

.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-3);
  background: var(--color-slate-800);
  color: var(--color-text-inverse);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  white-space: nowrap;
  border-radius: var(--radius-md);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-fast);
  z-index: var(--z-tooltip);
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   RATINGS / STARS
   ============================================ */

.rating {
  display: inline-flex;
  gap: var(--space-1);
}

.rating-star {
  width: 20px;
  height: 20px;
  color: var(--color-slate-300);
  transition: var(--transition-fast);
}

.rating-star.filled {
  color: #FBBF24;
}

.rating-star.half {
  background: linear-gradient(90deg, #FBBF24 50%, var(--color-slate-300) 50%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Interactive Rating */
.rating-interactive .rating-star {
  cursor: pointer;
}

.rating-interactive .rating-star:hover,
.rating-interactive .rating-star:hover ~ .rating-star {
  color: #FBBF24;
}

/* ============================================
   KEYFRAMES (referenced in animations.css)
   ============================================ */

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

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================
   SITE HEADER
   ============================================ */

.site-header,
header.sticky {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--color-surface);
}

/* Ensure header is visible on mobile with proper safe area */
@media (max-width: 767px) {
  header.sticky {
    position: fixed;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  /* Add spacer after fixed header for content */
  header.sticky + main,
  header.sticky ~ main {
    padding-top: 64px;
  }

  /* Handle case where main is inside a wrapper */
  .main-content {
    padding-top: 64px;
  }
}

/* Header inner wrapper */
header .bg-glass {
  background: rgba(255, 255, 255, 0.95);
}

/* ============================================
   MOBILE TOUCH TARGETS
   Ensures minimum 44x44px touch areas for accessibility
   ============================================ */

@media (max-width: 768px) {
  /* Buttons - ensure minimum touch target */
  .btn,
  button,
  [role="button"],
  .action-btn {
    min-height: 44px;
    min-width: 44px;
  }

  /* Small buttons get padding boost on mobile */
  .btn-xs,
  .btn-sm {
    min-height: 44px;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  /* Icon-only buttons */
  .btn-icon,
  button[aria-label]:not([aria-label=""]) {
    min-width: 44px;
    min-height: 44px;
    padding: var(--space-2);
  }

  /* Navigation items */
  nav a,
  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Dropdown items */
  .dropdown-item,
  .multi-select-option,
  [role="option"],
  [role="menuitem"] {
    min-height: 44px;
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
  }

  /* Form inputs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  input[type="search"],
  input[type="url"],
  select,
  textarea {
    min-height: 44px;
  }

  /* Checkboxes and radios - larger touch area */
  input[type="checkbox"],
  input[type="radio"] {
    min-width: 20px;
    min-height: 20px;
  }

  /* Links in content areas */
  .card a,
  .list-item a {
    padding: var(--space-2) 0;
  }

  /* Close buttons */
  .btn-close,
  .close-btn,
  [aria-label="Close"] {
    min-width: 44px;
    min-height: 44px;
  }

  /* Toggle switches */
  .toggle-switch {
    min-width: 52px;
    min-height: 28px;
  }

  /* Tab buttons */
  .tab-btn,
  .tab,
  [role="tab"] {
    min-height: 44px;
    padding: var(--space-3) var(--space-4);
    flex-shrink: 0;
  }

  /* Tabs container - add scroll fade indicator */
  .tabs {
    position: relative;
  }

  .tabs::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 1px;
    width: 40px;
    background: linear-gradient(to right, transparent, var(--color-surface));
    pointer-events: none;
  }

  /* Mobile touch feedback for buttons */
  .btn:active {
    opacity: 0.85;
    transform: scale(0.97);
    transition: transform 0.08s ease-out, opacity 0.08s ease-out;
  }

  .btn-primary:active {
    filter: brightness(0.9);
  }

  .btn-secondary:active {
    background: var(--color-slate-100);
  }
}
