/* ==========================================================================
   IPTV Alberta — Component stylesheet
   Semantic classes for the recurring UI primitives (buttons, badges, cards,
   inputs, tables, accordion, mobile nav drawer, toasts). Loaded BEFORE
   tailwind.css so any one-off Tailwind utility placed alongside these
   classes in the markup naturally wins the cascade for that property,
   exactly like the component/utility layering Tailwind itself recommends.
   ========================================================================== */

/* ---- Button ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  white-space: nowrap;
  border-radius: .375rem;
  font-size: .875rem;
  line-height: 1.25rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  font-family: inherit;
}
.btn svg { width: 1rem; height: 1rem; flex-shrink: 0; pointer-events: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 1px hsl(var(--ring)); }
.btn:disabled { pointer-events: none; opacity: .5; }

.btn-md { min-height: 2.25rem; padding: .5rem 1rem; }
.btn-sm { min-height: 2rem; padding: 0 .75rem; font-size: .75rem; line-height: 1rem; }
.btn-lg { min-height: 2.5rem; padding: 0 2rem; }
.btn-icon { height: 2.25rem; width: 2.25rem; padding: 0; }

.btn-gradient {
  background-image: linear-gradient(to right, #ef4444, #f97316);
  color: #fff;
  font-weight: 600;
}
.btn-outline-white {
  background-color: rgba(255,255,255,.08);
  border: 2px solid rgba(255,255,255,.2);
  color: #fff;
  font-weight: 600;
}
.btn-outline-white:hover { background-color: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); }
.btn-outline-soft {
  border: 1px solid rgba(255,255,255,.1);
  background-color: rgba(255,255,255,.05);
  backdrop-filter: blur(4px);
  color: hsl(var(--foreground));
}
.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: hsl(var(--foreground));
}
.btn-ghost:hover { background-color: rgba(255,255,255,.05); }

/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: .375rem;
  border: 1px solid transparent;
  padding: .125rem .625rem;
  font-size: .75rem;
  line-height: 1rem;
  font-weight: 600;
}
.badge-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.badge-gradient { background-image: linear-gradient(to right, #ef4444, #f97316); color: #fff; }

/* ---- Card ---- */
.card {
  border-radius: .5625rem;
  border: 1px solid hsl(var(--card-border));
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: var(--shadow-sm);
}
.card-content { padding: 1.5rem; }

/* ---- Form controls ---- */
.field-label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .5rem;
  color: hsl(var(--foreground));
}
.field-input,
.field-textarea {
  display: flex;
  width: 100%;
  border-radius: .375rem;
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  padding: .5rem .75rem;
  font-size: 1rem;
  color: hsl(var(--foreground));
  font-family: inherit;
}
.field-input { height: 2.25rem; }
.field-textarea { min-height: 120px; resize: vertical; }
.field-input::placeholder,
.field-textarea::placeholder { color: hsl(var(--muted-foreground)); }
.field-input:focus-visible,
.field-textarea:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--ring)); }
.field-error {
  display: none;
  font-size: .8125rem;
  color: hsl(var(--destructive));
  margin-top: .375rem;
}
.field-error.visible { display: block; }
.field-input.invalid,
.field-textarea.invalid { border-color: hsl(var(--destructive)); }
@media (min-width: 768px) {
  .field-input, .field-textarea { font-size: .875rem; }
}

/* ---- Table ---- */
.table { width: 100%; font-size: .875rem; border-collapse: collapse; }
.table thead tr, .table tbody tr { border-bottom: 1px solid hsl(var(--border)); }
.table tbody tr:last-child { border-bottom: none; }
.table th { height: 3rem; padding: 0 1rem; text-align: left; vertical-align: middle; font-weight: 500; color: hsl(var(--muted-foreground)); }
.table td { padding: 1rem; vertical-align: middle; }

/* ---- Accordion ---- */
.accordion-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  font-weight: 500;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
}
.accordion-trigger:hover { text-decoration: underline; }
.accordion-chevron { transition: transform .2s ease; }
.accordion-trigger[aria-expanded="true"] .accordion-chevron { transform: rotate(180deg); }
.accordion-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height .35s ease;
}
.accordion-content.open { max-height: 800px; }
.accordion-content-inner { padding-bottom: 1rem; }

/* ---- Header / mobile nav drawer ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 9999;
  border-bottom: 1px solid rgba(255,255,255,.05);
  background: linear-gradient(180deg, hsl(230 25% 5% / 0.97) 0%, hsl(230 25% 3% / 0.95) 100%);
  backdrop-filter: blur(20px);
}
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0,0,0,.8);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.mobile-menu-overlay.open { opacity: 1; visibility: visible; }
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  width: 75%;
  max-width: 24rem;
  background: hsl(var(--background));
  border-left: 1px solid hsl(var(--border));
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform .3s ease;
  overflow-y: auto;
}
.mobile-menu.open { transform: translateX(0); }
.mobile-menu-close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  opacity: .7;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: .375rem;
  border-radius: .25rem;
}
.mobile-menu-close:hover { opacity: 1; background: hsl(var(--secondary)); }

/* ---- WhatsApp floating button ---- */
.whatsapp-fab {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
}
.whatsapp-fab-tooltip {
  pointer-events: none;
  display: none;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity .3s ease, transform .3s ease;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(4px);
  color: #111827;
  font-size: .875rem;
  font-weight: 600;
  border-radius: .75rem;
  padding: .625rem 1rem;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,.2);
  white-space: nowrap;
  position: relative;
}
.whatsapp-fab:hover .whatsapp-fab-tooltip { opacity: 1; transform: translateX(0); }
.whatsapp-fab-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 9999px;
  background: #25D366;
  box-shadow: 0 4px 20px rgba(37,211,102,.4);
  transition: box-shadow .3s ease, transform .3s ease;
}
.whatsapp-fab:hover .whatsapp-fab-icon { box-shadow: 0 6px 28px rgba(37,211,102,.5); transform: scale(1.05); }
.whatsapp-fab-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  background: #ef4444;
  border-radius: 9999px;
  border: 2px solid hsl(230 25% 3%);
  animation: pulse-dot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@media (min-width: 640px) {
  .whatsapp-fab { bottom: 1.5rem; right: 1.5rem; }
  .whatsapp-fab-icon { width: 60px; height: 60px; }
}
@media (max-width: 639px) {
  .whatsapp-fab-tooltip { display: none !important; }
}

/* ---- Period toggle (multi-screen plans) ---- */
.period-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  font-family: inherit;
}
.period-toggle-btn:hover { color: hsl(var(--foreground)); }
.period-toggle-btn.active {
  background-image: linear-gradient(to right, #ef4444, #f97316);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

/* ---- Toasts ---- */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  left: 1rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: flex-end;
}
@media (min-width: 640px) { .toast-container { left: auto; max-width: 24rem; } }
.toast {
  width: 100%;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--popover-border));
  color: hsl(var(--popover-foreground));
  border-radius: .375rem;
  padding: .875rem 1rem;
  box-shadow: var(--shadow-lg);
  font-size: .875rem;
  animation: toast-in .25s ease;
}
.toast-title { font-weight: 600; margin-bottom: .125rem; }
.toast.destructive { border-color: hsl(0 75% 45% / .5); background: hsl(0 45% 10%); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Scroll-reveal (replaces framer-motion whileInView) ---- */
[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}
[data-reveal].revealed { opacity: 1; transform: translateY(0); }
[data-reveal-immediate] { animation: reveal-in .8s ease both; }
@keyframes reveal-in { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  [data-reveal], [data-reveal-immediate] { animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; }
}
