/* Nirva Retailer Design System */
:root {
  --nirva-navy: #063B73;
  --nirva-blue: #0878C9;
  --nirva-light-blue: #DFF5FF;
  --nirva-sky: #8ED8F8;
  --nirva-green: #55A630;
  --nirva-light-green: #A8D96B;
  --nirva-dark: #031E3D;
  --font-heading: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  font-family: var(--font-body);
  color: var(--nirva-dark);
  background-color: #f7fbff;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-heading);
}

/* Glassmorphism and Card Styling */
.nirva-card {
  background: #ffffff;
  border-radius: 1.25rem;
  box-shadow: 0 4px 20px -2px rgba(6, 59, 115, 0.06), 0 2px 6px -1px rgba(6, 59, 115, 0.04);
  border: 1px solid rgba(142, 216, 248, 0.35);
  transition: all 0.2s ease-in-out;
}

.nirva-card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -4px rgba(6, 59, 115, 0.12), 0 4px 10px -2px rgba(6, 59, 115, 0.06);
  border-color: var(--nirva-blue);
}

/* Primary and Secondary Buttons */
.btn-primary {
  background: linear-gradient(135deg, #0878C9 0%, #063B73 100%);
  color: #ffffff;
  font-weight: 600;
  border-radius: 0.875rem;
  padding: 0.875rem 1.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px 0 rgba(8, 120, 201, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  border: none;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px 0 rgba(8, 120, 201, 0.45);
}

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

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: #ffffff;
  color: var(--nirva-navy);
  border: 1.5px solid #d0e7f7;
  font-weight: 600;
  border-radius: 0.875rem;
  padding: 0.875rem 1.5rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--nirva-light-blue);
  border-color: var(--nirva-blue);
}

/* Form Inputs */
.form-input, .form-select, .form-textarea {
  width: 100%;
  border-radius: 0.875rem;
  border: 1.5px solid #d5e5f2;
  padding: 0.875rem 1rem;
  font-size: 0.95rem;
  background-color: #ffffff;
  color: var(--nirva-dark);
  transition: all 0.2s ease;
  outline: none;
  font-family: var(--font-body);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--nirva-blue);
  box-shadow: 0 0 0 3px rgba(8, 120, 201, 0.15);
  background-color: #ffffff;
}

.form-input.is-invalid, .form-select.is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Quantity Stepper Control */
.qty-stepper {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #cfe2f3;
  border-radius: 9999px;
  padding: 4px;
  box-shadow: 0 2px 4px rgba(6, 59, 115, 0.04);
}

.qty-btn {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f7fc;
  color: var(--nirva-navy);
  font-weight: 700;
  font-size: 1.25rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.qty-btn:hover:not(:disabled) {
  background: var(--nirva-blue);
  color: #ffffff;
}

.qty-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.qty-input {
  width: 52px;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  border: none;
  outline: none;
  background: transparent;
  color: var(--nirva-dark);
  font-family: var(--font-heading);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-new { background: #dbeafe; color: #1e40af; }
.badge-contacted { background: #fef3c7; color: #92400e; }
.badge-interested { background: #e0e7ff; color: #4338ca; }
.badge-converted { background: #dcfce7; color: #166534; }
.badge-inactive { background: #f1f5f9; color: #475569; }

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #e0f2fe; color: #0369a1; }
.badge-processing { background: #fae8ff; color: #86198f; }
.badge-out_for_delivery { background: #ffedd5; color: #9a3412; }
.badge-delivered { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

/* Sticky Mobile Navigation */
.sticky-action-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(142, 216, 248, 0.4);
  padding: 0.875rem 1rem;
  z-index: 40;
  box-shadow: 0 -4px 16px rgba(6, 59, 115, 0.05);
}

@media (max-width: 640px) {
  .sticky-action-bar {
    bottom: 58px;
    border-radius: 1rem 1rem 0 0;
  }
}

/* Progress Step Bar */
.step-dot {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  transition: all 0.3s ease;
}

.step-dot.active {
  background: var(--nirva-navy);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(8, 120, 201, 0.25);
}

.step-dot.completed {
  background: var(--nirva-green);
  color: #ffffff;
}

.step-dot.pending {
  background: #e2e8f0;
  color: #64748b;
}

.step-line {
  flex: 1;
  height: 3px;
  background: #e2e8f0;
  transition: all 0.3s ease;
}

.step-line.completed {
  background: var(--nirva-green);
}

/* Checkbox pill selector */
.pill-checkbox {
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1.5px solid #d0e7f7;
  background: #ffffff;
  color: var(--nirva-dark);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.pill-checkbox.selected {
  background: #0878C9;
  border-color: #0878C9;
  color: #ffffff;
}

/* Mobile App Native Feel & Bottom Dock */
.mobile-bottom-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(142, 216, 248, 0.45);
  box-shadow: 0 -4px 20px rgba(6, 59, 115, 0.08);
  z-index: 50;
  padding: 6px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  padding: 4px 6px;
  border-radius: 12px;
  transition: all 0.15s ease;
  user-select: none;
}

.dock-item:active {
  transform: scale(0.92);
}

.dock-item.active {
  color: #063B73;
}

.dock-item.active svg {
  color: #0878C9;
}

.dock-center-action {
  margin-top: -18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.dock-center-btn {
  width: 52px;
  height: 52px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #0878C9 0%, #063B73 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(8, 120, 201, 0.4);
  border: 3px solid #ffffff;
  transition: transform 0.15s ease;
}

.dock-center-btn:active {
  transform: scale(0.9);
}

/* Action button loading spinner */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.85;
}

.btn-loading .btn-content {
  visibility: hidden;
  opacity: 0;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin-top: -9px;
  margin-left: -9px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: spin 0.65s linear infinite;
}

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

/* Splash screen animation */
#nirva-app-splash {
  transition: opacity 0.4s ease-out, visibility 0.4s ease-out;
}

#nirva-app-splash.splash-hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes loadingBar {
  0% { width: 0%; transform: translateX(0); }
  50% { width: 75%; }
  100% { width: 100%; }
}

.animate-loading-bar {
  animation: loadingBar 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Mobile App Bar Header */
.mobile-app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(223, 245, 255, 0.8);
  position: sticky;
  top: 0;
  z-index: 40;
}

/* Table mobile card transformation helper */
@media (max-width: 640px) {
  body {
    padding-bottom: 74px; /* clearance for bottom dock */
  }
  .hide-on-mobile-dock {
    margin-bottom: 40px;
  }
}

/* Responsive adjustments & accessibility */
@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;
  }
}
