/**
 * Kalyx - UI Components System
 */

/* ==========================================================================
   1. BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.65rem 1.25rem;
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background-color: var(--brand-accent);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--brand-accent-hover);
  color: var(--text-inverse);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--surface-border-strong);
}

.btn-secondary:hover {
  background-color: var(--surface-muted);
  border-color: var(--text-secondary);
}

.btn-whatsapp {
  background-color: var(--brand-whatsapp);
  color: var(--text-inverse);
}

.btn-whatsapp:hover {
  background-color: var(--brand-whatsapp-hover);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: var(--text-base);
  border-radius: var(--radius-md);
}

.btn-full {
  width: 100%;
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.8;
  position: relative;
  color: transparent !important;
}

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

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

/* ==========================================================================
   2. CARDS & CONTAINERS
   ========================================================================== */
.card {
  background-color: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-primary-subtle);
}

.feature-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.feature-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background-color: var(--brand-primary-light);
  color: var(--brand-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
}

/* ==========================================================================
   3. ACCORDIONS (FAQ & SYLLABUS)
   ========================================================================== */
.accordion {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.accordion-item {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  background-color: var(--surface-card);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.accordion-item.is-active {
  border-color: var(--brand-primary-subtle);
}

.accordion-header {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-md);
  color: var(--text-primary);
  background-color: var(--surface-card);
  transition: background-color var(--transition-fast);
}

.accordion-header:hover {
  background-color: var(--surface-alt);
}

.accordion-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--transition-normal);
}

.accordion-item.is-active .accordion-icon {
  transform: rotate(180deg);
  color: var(--brand-accent);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow) ease-out, padding var(--transition-slow) ease-out;
  padding: 0 var(--space-lg);
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: var(--line-height-relaxed);
}

.accordion-item.is-active .accordion-body {
  padding: 0 var(--space-lg) var(--space-lg);
}

/* ==========================================================================
   4. FORM CONTROLS & VALIDATION
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-md);
  position: relative;
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

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

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: var(--text-base);
  border: 1px solid var(--surface-border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface-body);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

.form-input.is-invalid,
.form-select.is-invalid {
  border-color: var(--color-error);
}

.form-input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.form-error-msg {
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: 4px;
  display: none;
}

.form-input.is-invalid + .form-error-msg {
  display: block;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* Honeypot field (hidden from legitimate users, catches bots) */
.form-honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
  height: 0;
  width: 0;
}

/* ==========================================================================
   5. BADGES & PILLS
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.badge-primary {
  background-color: var(--brand-primary-light);
  color: var(--brand-accent);
  border: 1px solid var(--brand-primary-subtle);
}

.badge-outline {
  background-color: transparent;
  color: var(--text-muted);
  border: 1px solid var(--surface-border-strong);
}

/* ==========================================================================
   6. COURSE PRICING CARD
   ========================================================================== */
.pricing-card {
  background-color: var(--surface-card);
  border: 2px solid var(--brand-primary-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-md);
  position: relative;
}

.pricing-header {
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.pricing-amount {
  font-size: clamp(2rem, 3vw, 2.5rem);
  font-weight: var(--font-weight-extrabold);
  color: var(--text-primary);
  line-height: 1.1;
  margin: var(--space-xs) 0;
}

.pricing-note {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.pricing-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.pricing-feature-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.pricing-feature-item svg {
  color: var(--color-success);
  flex-shrink: 0;
}

/* ==========================================================================
   7. TRAINER & TESTIMONIAL PLACEHOLDER CARDS
   ========================================================================== */
.placeholder-card {
  background-color: var(--surface-alt);
  border: 1px dashed var(--surface-border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  text-align: center;
}

.placeholder-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background-color: var(--surface-muted);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
}

/* ==========================================================================
   8. ENQUIRY MODAL (Native Dialog)
   ========================================================================== */
dialog.enquiry-modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: min(92vw, 520px);
  width: 100%;
  margin: auto;
  box-shadow: var(--shadow-xl);
  background-color: var(--surface-card);
  z-index: var(--z-modal);
}

dialog.enquiry-modal::backdrop {
  background-color: var(--surface-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.modal-close-btn:hover {
  background-color: var(--surface-muted);
  color: var(--text-primary);
}

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

/* ==========================================================================
   9. FLOATING WHATSAPP WIDGET
   ========================================================================== */
.floating-whatsapp-widget {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-floating);
  display: flex;
  align-items: center;
}

.floating-whatsapp-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--brand-whatsapp);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
  position: relative;
}

.floating-whatsapp-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.5);
  color: #ffffff;
}

.floating-whatsapp-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--brand-whatsapp);
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* ==========================================================================
   10. TOAST NOTIFICATION
   ========================================================================== */
.toast-container {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  background-color: var(--surface-card);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  border: 1px solid var(--surface-border);
  transform: translateY(-20px);
  opacity: 0;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

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

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

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

.toast-title {
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-sm);
}

.toast-desc {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}
