/* ============================================================
   AIRAVATAM — Component Library
   Reusable UI components: Buttons, Cards, Badges, Forms,
   Tabs, Accordions, Stats, Tags, Toasts, Skeletons.
   ============================================================ */

/* ============================================================
   1. BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1.75rem;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
  user-select: none;
}

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

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

/* Ripple effect on click */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.btn:active::after {
  opacity: 1;
}

/* --- Primary (Blue) --- */
.btn-primary {
  background: var(--gradient-brand);
  color: white;
  box-shadow: 0 4px 16px rgba(0, 127, 255, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 127, 255, 0.50);
  color: white;
}

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

/* --- Accent (Orange) --- */
.btn-accent {
  background: var(--gradient-accent);
  color: white;
  box-shadow: 0 4px 16px rgba(255, 107, 0, 0.35);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(255, 107, 0, 0.50);
  color: white;
}

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

.btn-outline:hover {
  background: var(--color-primary);
  color: white;
  transform: translateY(-2px);
}

/* --- Outline White (for dark sections) --- */
.btn-outline-white {
  background: transparent;
  color: white;
  border-color: rgba(255, 255, 255, 0.5);
}

.btn-outline-white:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: white;
  color: white;
  transform: translateY(-2px);
}

/* --- Ghost --- */
.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: rgba(0, 127, 255, 0.08);
  color: var(--color-primary);
}

/* --- WhatsApp --- */
.btn-whatsapp {
  background: var(--color-whatsapp);
  color: white;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
}

.btn-whatsapp:hover {
  background: var(--color-whatsapp-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(37, 211, 102, 0.50);
  color: white;
}

/* --- Sizes --- */
.btn-sm {
  padding: 0.5rem 1.25rem;
  font-size: var(--text-sm);
}

.btn-lg {
  padding: 1rem 2.25rem;
  font-size: var(--text-lg);
}

.btn-xl {
  padding: 1.125rem 2.75rem;
  font-size: var(--text-xl);
}

/* --- Icon only --- */
.btn-icon {
  padding: 0.75rem;
  border-radius: var(--radius-full);
  aspect-ratio: 1;
}

/* --- Loading state --- */
.btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn.loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  flex-shrink: 0;
}

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

/* ============================================================
   2. CARDS
   ============================================================ */

/* Base card */
.card {
  background: var(--color-surface-light);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border-light);
  transition: var(--transition-base);
}

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

/* Dark card (inside dark sections) */
.card-dark {
  background: var(--gradient-card-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  transition: var(--transition-base);
}

.card-dark:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary), var(--shadow-glow-blue);
  transform: translateY(-4px);
}

/* Glass card */
.card-glass {
  background: var(--color-bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
}

/* Product card */
.card-product {
  background: white;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
  transition: var(--transition-base);
  display: flex;
  flex-direction: column;
}

.card-product:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-primary-light);
}

.card-product-image {
  aspect-ratio: 4/3;
  background: var(--color-bg-page);
  overflow: hidden;
  position: relative;
}

.card-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: var(--space-4);
  transition: transform var(--duration-slow) var(--ease-out);
}

.card-product:hover .card-product-image img {
  transform: scale(1.06);
}

.card-product-body {
  padding: var(--space-5);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-product-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--color-text-dark);
  margin-bottom: var(--space-2);
  line-height: var(--leading-snug);
}

.card-product-desc {
  font-size: var(--text-sm);
  color: var(--color-text-label);
  line-height: var(--leading-relaxed);
  flex: 1;
  margin-bottom: var(--space-4);
}

.card-product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: auto;
}

/* Service card */
.card-service {
  background: white;
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  border: 1px solid var(--color-border-light);
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card-service::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-slow) var(--ease-out);
}

.card-service:hover::before {
  transform: scaleX(1);
}

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

.card-service.accent::before {
  background: var(--gradient-accent);
}

/* Stat card */
.card-stat {
  text-align: center;
  padding: var(--space-8) var(--space-6);
}

.card-stat .stat-value {
  font-family: var(--font-heading);
  font-size: clamp(var(--text-3xl), 5vw, var(--text-4xl));
  font-weight: var(--weight-extrabold);
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.card-stat .stat-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* ============================================================
   3. BADGES & TAGS
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-primary {
  background: rgba(0, 127, 255, 0.12);
  color: var(--color-primary);
  border-color: rgba(0, 127, 255, 0.25);
}

.badge-accent {
  background: rgba(255, 107, 0, 0.12);
  color: var(--color-accent);
  border-color: rgba(255, 107, 0, 0.25);
}

.badge-success {
  background: rgba(34, 197, 94, 0.12);
  color: var(--color-success);
  border-color: rgba(34, 197, 94, 0.25);
}

.badge-dark {
  background: rgba(10, 15, 30, 0.08);
  color: var(--color-text-label);
  border-color: rgba(10, 15, 30, 0.12);
}

/* Tag (clickable filter) */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-full);
  background: var(--color-bg-page);
  color: var(--color-text-label);
  border: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: var(--transition-fast);
}

.tag:hover,
.tag.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* ============================================================
   4. ICON BOX
   ============================================================ */

.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: rgba(0, 127, 255, 0.10);
  color: var(--color-primary);
  font-size: 1.5rem;
  flex-shrink: 0;
  transition: var(--transition-base);
}

.icon-box.lg {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-2xl);
  font-size: 2rem;
}

.icon-box.accent {
  background: rgba(255, 107, 0, 0.10);
  color: var(--color-accent);
}

.icon-box-dark {
  background: rgba(0, 127, 255, 0.15);
  border: 1px solid rgba(0, 127, 255, 0.25);
}

/* ============================================================
   5. FORM ELEMENTS
   ============================================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-label);
  letter-spacing: 0.01em;
}

.form-label .required {
  color: var(--color-error);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: var(--text-base);
  font-family: var(--font-body);
  color: var(--color-text-dark);
  background: white;
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  transition: var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--color-primary-light);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
  outline: none;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: var(--leading-relaxed);
}

.form-helper {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* Dark variant form inputs */
.form-input-dark,
.form-select-dark,
.form-textarea-dark {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

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

.form-input-dark:focus,
.form-select-dark:focus,
.form-textarea-dark:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* ============================================================
   6. ACCORDION (FAQ)
   ============================================================ */

.accordion {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.accordion-item {
  background: white;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: var(--transition-base);
}

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

.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--color-text-dark);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.accordion-trigger:hover {
  color: var(--color-primary);
}

.accordion-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(0, 127, 255, 0.1);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: transform var(--duration-base) var(--ease-out);
}

.accordion-item.open .accordion-icon {
  transform: rotate(45deg);
  background: var(--color-primary);
  color: white;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-slow) var(--ease-out);
}

.accordion-item.open .accordion-content {
  max-height: 600px;
}

.accordion-body {
  padding: 0 var(--space-6) var(--space-5);
  font-size: var(--text-base);
  color: var(--color-text-label);
  line-height: var(--leading-relaxed);
}

/* ============================================================
   7. TABS
   ============================================================ */

.tabs-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-8);
}

.tabs-nav-center {
  justify-content: center;
}

.tab-btn {
  padding: 0.6rem 1.5rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-label);
  background: var(--color-bg-page);
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.tab-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary-light);
}

.tab-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0, 127, 255, 0.30);
}

.tab-panel {
  display: none;
  animation: fadeIn var(--duration-base) var(--ease-out);
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   8. PARTNER / BRAND LOGO STRIP
   ============================================================ */

.logo-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-8);
}

.logo-strip-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-light);
  transition: var(--transition-fast);
  min-width: 120px;
  height: 56px;
}

.logo-strip-item:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}

.logo-strip-item img {
  max-height: 32px;
  width: auto;
  object-fit: contain;
  filter: grayscale(100%) opacity(0.5);
  transition: filter var(--duration-base) var(--ease-out);
}

.logo-strip-item:hover img {
  filter: grayscale(0%) opacity(1);
}

/* ============================================================
   9. TOAST NOTIFICATION
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border-light);
  min-width: 280px;
  max-width: 360px;
  pointer-events: all;
  animation: toastIn var(--duration-slow) var(--ease-spring);
}

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

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

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

@keyframes toastIn {
  from {
    transform: translateX(120%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ============================================================
   10. SKELETON LOADER
   ============================================================ */

.skeleton {
  background: linear-gradient(90deg,
      var(--color-bg-page) 25%,
      #e2e8f0 50%,
      var(--color-bg-page) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

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

  100% {
    background-position: -200% 0;
  }
}

/* ============================================================
   11. STEP / PROCESS INDICATOR
   ============================================================ */

.steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  position: relative;
}

.steps::before {
  content: '';
  position: absolute;
  left: 23px;
  top: 48px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--color-primary), transparent);
}

.step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
}

.step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: white;
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 127, 255, 0.35);
  position: relative;
  z-index: 1;
}

.step-content {
  padding-top: var(--space-2);
  flex: 1;
}

.step-content h4 {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
}

.step-content p {
  font-size: var(--text-sm);
  color: var(--color-text-label);
  line-height: var(--leading-relaxed);
}

/* ============================================================
   12. MODAL / POPUP
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-base) var(--ease-out),
    visibility var(--duration-base);
  padding: var(--space-4);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-2xl);
  transform: translateY(20px) scale(0.95);
  transition: transform var(--duration-base) var(--ease-out);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-bg-page);
  border: none;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  z-index: 2;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

.modal-header {
  padding: var(--space-6) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-dark);
  margin-bottom: var(--space-2);
}

.modal-header p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

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

/* ============================================================
   13. WHATSAPP FLOATING WIDGET
   ============================================================ */

.whatsapp-widget {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 56px;
  height: 56px;
  background-color: #25D366;
  /* WhatsApp Green */
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
  z-index: calc(var(--z-modal) - 1);
  /* Just below modal */
  text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.whatsapp-widget:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
  color: white;
}

.whatsapp-widget svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

@media (max-width: 640px) {
  .whatsapp-widget {
    bottom: var(--space-4);
    right: var(--space-4);
    width: 48px;
    height: 48px;
  }

  .whatsapp-widget svg {
    width: 28px;
    height: 28px;
  }
}