/* ===================================
   COMPONENTS.CSS - MABL Reusable UI Components
   =================================== */

/* ===================================
   BUTTON SYSTEM
   =================================== */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-weight: 700;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn--primary,
.btn--donate {
  background: var(--mabl-red);
  color: var(--white);
  padding: 14px 32px;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  animation: pulse-glow 3s ease-in-out infinite;
}

.btn--primary:hover,
.btn--donate:hover {
  background: #ea580c;
  color: var(--white);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.35);
  animation: none;
}

.btn--primary:active,
.btn--donate:active {
  background: #c2410c;
  color: var(--white);
  transform: translateY(0) scale(0.98);
  box-shadow: 0 1px 4px rgba(194, 65, 12, 0.4);
  transition: transform 0.1s ease;
}

.btn--secondary {
  background: var(--mabl-green);
  color: var(--white);
  padding: 14px 32px;
  box-shadow: 0 2px 8px rgba(47, 105, 53, 0.25);
}

.btn--secondary:hover {
  background: #1e4623;
  color: var(--white);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 16px rgba(30, 70, 35, 0.35);
}

.btn--secondary:active {
  background: #153319;
  color: var(--white);
  transform: translateY(0) scale(0.98);
  box-shadow: 0 1px 4px rgba(21, 51, 25, 0.4);
  transition: transform 0.1s ease;
}

.btn--ghost {
  background: transparent;
  color: var(--mabl-green);
  padding: 12px 24px;
  border: 2px solid var(--mabl-green);
  transition: all 0.2s ease;
}

.btn--ghost:hover {
  background: var(--mabl-green);
  color: var(--white);
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 2px 8px rgba(47, 105, 53, 0.2);
}

.btn--ghost:active {
  background: #1e4623;
  color: var(--white);
  border-color: #1e4623;
  transform: translateY(0) scale(0.98);
  box-shadow: none;
}

.btn--sm {
  padding: 10px 20px;
  font-size: var(--text-sm);
}

.btn--lg {
  padding: 18px 40px;
  font-size: var(--text-lg);
}

@media (max-width: 768px) {
  .btn--primary,
  .btn--donate,
  .btn--secondary {
    width: 100%;
    min-height: 56px;
    padding: 16px 24px;
  }

  .btn--ghost {
    min-height: 52px;
    padding: 14px 20px;
  }
}

.btn:focus-visible {
  outline: 3px solid var(--mabl-gold);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(218, 165, 32, 0.2);
}

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

/* Button Ripple Effect */
.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::before {
  width: 300px;
  height: 300px;
  transition: width 0s, height 0s;
}

/* Shine Effect on Primary Buttons */
.btn--primary::after,
.btn--donate::after,
.btn--secondary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.btn--primary:hover::after,
.btn--donate:hover::after,
.btn--secondary:hover::after {
  left: 100%;
}

/* Loading State */
.btn--loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn--loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ===================================
   CARDS
   =================================== */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-2xl);
  overflow: clip;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  transform: translateY(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-xl);
  border-color: var(--mabl-green);
}

.card:active {
  transform: translateY(-2px) scale(1.0);
  transition: transform 0.1s ease;
}

.card__img {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--gray-200), var(--gray-300));
  position: relative;
}

.card__body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card h3 {
  font-size: var(--text-xl);
  margin: 0 0 12px;
  color: var(--text-primary);
  line-height: 1.3;
}

.card p {
  color: var(--text-secondary);
  margin-bottom: auto;
  line-height: 1.6;
}

.card__meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 12px;
}

.card .btn {
  margin-top: 16px;
  width: 100%;
}

/* Hero Card */
.hero__card {
  background: var(--white);
  border-radius: var(--radius-2xl);
  padding: 24px;
  box-shadow: var(--shadow-xl);
}

@media (max-width: 879px) {
  .hero__card {
    margin-top: 40px;
  }
}

.hero__card h3 {
  font-size: var(--text-2xl);
  color: var(--text-primary);
  margin: 0 0 12px;
  font-weight: 800;
}

.hero__card p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

.hero__card-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

/* ===================================
   BADGES & TAGS
   =================================== */
.card__badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.card__badge--urgent {
  background: linear-gradient(135deg, var(--mabl-red), var(--mabl-red-dark));
  color: var(--white);
  animation: pulse-badge 2s ease-in-out infinite;
}

.tag {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(47, 105, 53, 0.1);
  color: var(--mabl-green);
  margin-bottom: 12px;
  width: fit-content;
}

/* ===================================
   PILLS / FILTERS
   =================================== */
.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  border: 2px solid var(--gray-300);
  padding: 10px 16px;
  border-radius: var(--radius-full);
  background: var(--white);
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: var(--text-sm);
  position: relative;
  overflow: hidden;
}

.pill::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(47, 105, 53, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.pill:hover {
  border-color: var(--mabl-green);
  color: var(--mabl-green);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(47, 105, 53, 0.2);
}

.pill:active {
  transform: translateY(0);
}

.pill:active::before {
  width: 200px;
  height: 200px;
  transition: width 0s, height 0s;
}

.pill[aria-current="true"] {
  background: rgba(47, 105, 53, 0.1);
  border-color: var(--mabl-green);
  color: var(--mabl-green);
  box-shadow: 0 2px 8px rgba(47, 105, 53, 0.15);
}

/* ===================================
   PROGRESS BAR
   =================================== */
.progress {
  margin-bottom: 20px;
}

.progress__info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: var(--text-sm);
}

.progress__label {
  font-weight: 600;
  color: var(--text-primary);
}

.progress__target {
  color: var(--text-muted);
}

.bar {
  height: 10px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--mabl-green), var(--mabl-green-dark));
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

/* ===================================
   VIDEO PLAYER COMPONENTS
   =================================== */
.card__video {
  position: relative;
  width: 100%;
  margin: 16px 0 20px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--gray-900);
  aspect-ratio: 16 / 9;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.card__video:hover {
  transform: translateY(-2px);
}

.card__video-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card__video-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.4));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.card__video:hover .card__video-overlay {
  background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.5));
}

.card__video-play {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.card__video:hover .card__video-play {
  transform: scale(1.1);
  background: #ffffff;
  box-shadow: 0 6px 28px rgba(249, 115, 22, 0.35);
}

.card__video:active .card__video-play {
  transform: scale(1.05);
  background: var(--mabl-red);
  box-shadow: 0 2px 12px rgba(249, 115, 22, 0.5);
}

.card__video-play svg {
  width: 28px;
  height: 28px;
  fill: var(--mabl-red);
  margin-left: 4px;
  transition: fill 0.3s ease;
}

.card__video:hover .card__video-play svg {
  fill: #ea580c;
}

.card__video:active .card__video-play svg {
  fill: #ffffff;
}

.card__video-duration {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.85);
  color: var(--white);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ===================================
   FORM ELEMENTS
   =================================== */
.newsletter input {
  flex: 1;
  padding: 14px 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  background: rgba(255, 255, 255, 0.9);
  min-width: 200px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.newsletter input:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.95);
}

.newsletter input:focus {
  outline: none;
  border-color: var(--white);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .newsletter input {
    width: 100%;
  }
}

/* ===================================
   TOAST NOTIFICATIONS
   =================================== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
}

@media (max-width: 768px) {
  .toast-container {
    top: 70px;
    right: 16px;
    left: 16px;
    max-width: none;
  }
}

.toast {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--mabl-green);
  display: flex;
  align-items: start;
  gap: 12px;
  animation: slideInRight 0.3s ease;
  position: relative;
}

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

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

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

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

.toast__icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast__icon svg {
  width: 20px;
  height: 20px;
}

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

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

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

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

.toast__content {
  flex: 1;
}

.toast__title {
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast__message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

.toast__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.toast__close:hover {
  color: var(--text-primary);
}

.toast__close svg {
  width: 16px;
  height: 16px;
}

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

/* ===================================
   LOADING SPINNER
   =================================== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ===================================
   SKELETON LOADERS
   =================================== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-200) 0%,
    var(--gray-100) 20%,
    var(--gray-200) 40%,
    var(--gray-200) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s linear infinite;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.skeleton--card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.skeleton__img {
  aspect-ratio: 16/9;
  background: linear-gradient(
    90deg,
    var(--gray-200) 0%,
    var(--gray-100) 20%,
    var(--gray-200) 40%,
    var(--gray-200) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s linear infinite;
}

.skeleton__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton__line {
  height: 12px;
  background: linear-gradient(
    90deg,
    var(--gray-200) 0%,
    var(--gray-100) 20%,
    var(--gray-200) 40%,
    var(--gray-200) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s linear infinite;
  border-radius: var(--radius-sm);
}

.skeleton__line--sm {
  width: 30%;
  height: 10px;
}

.skeleton__line--md {
  width: 80%;
  height: 12px;
}

.skeleton__line--lg {
  width: 100%;
  height: 14px;
}

.skeleton__title {
  width: 60%;
  height: 24px;
  margin-bottom: 8px;
}

.skeleton__button {
  width: 100%;
  height: 48px;
  margin-top: 16px;
}

.skeleton--stat {
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  border: 2px solid rgba(218, 165, 32, 0.3);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.skeleton__stat-number {
  width: 80px;
  height: 40px;
  background: linear-gradient(
    90deg,
    rgba(218, 165, 32, 0.2) 0%,
    rgba(218, 165, 32, 0.3) 20%,
    rgba(218, 165, 32, 0.2) 40%,
    rgba(218, 165, 32, 0.2) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s linear infinite;
  border-radius: var(--radius-md);
}

.skeleton__stat-label {
  width: 100px;
  height: 16px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.2) 20%,
    rgba(255, 255, 255, 0.1) 40%,
    rgba(255, 255, 255, 0.1) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s linear infinite;
  border-radius: var(--radius-sm);
}

.content-loaded .skeleton,
.content-loaded .skeleton--card,
.content-loaded .skeleton--stat {
  display: none;
}
