/* ==========================================================================
   COMPONENTS.CSS — Reusable UI Components
   AutoDM
   ========================================================================== */

/* ─────────────────────────────────────────────────────
   BACKGROUND UTILITIES
───────────────────────────────────────────────────── */
.brand-gradient  { background: var(--brand-gradient); }
.aurora-gradient { background: var(--aurora-gradient); }
.instagram-gradient { background: var(--instagram-gradient); }

/* ─────────────────────────────────────────────────────
   GLASS CARD
───────────────────────────────────────────────────── */
.glass-card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.glass-panel {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ─────────────────────────────────────────────────────
   CARD
───────────────────────────────────────────────────── */
.card {
  background: var(--color-surface-container-lowest);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-3xl);
  padding: 40px;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
  border-color: rgba(105, 28, 154, 0.35);
  box-shadow: var(--shadow-md);
}

/* ─────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: var(--radius-xl);
  font-size: var(--text-label-sm-size);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(0.97); }

/* Primary */
.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.btn-primary:hover { opacity: 0.88; box-shadow: var(--shadow-md); }

/* Gradient */
.btn-gradient {
  background: var(--brand-gradient);
  color: var(--color-on-primary);
  box-shadow: var(--shadow-md);
}
.btn-gradient:hover { transform: scale(1.02); box-shadow: var(--shadow-lg); }
.btn-gradient:active { transform: scale(0.97); }

/* Aurora Gradient */
.btn-aurora {
  background: var(--aurora-gradient);
  color: var(--color-on-primary);
  box-shadow: 0 4px 16px rgba(105, 28, 154, 0.22);
}
.btn-aurora:hover { box-shadow: 0 8px 32px rgba(105, 28, 154, 0.35); }

/* Instagram Gradient */
.btn-instagram {
  background: var(--instagram-gradient);
  color: var(--color-on-primary);
  box-shadow: var(--shadow-md);
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn-outline:hover { background: rgba(105, 28, 154, 0.05); }

/* Ghost */
.btn-ghost {
  background: var(--color-surface-container-lowest);
  color: var(--color-on-surface);
  border: 1px solid var(--color-outline-variant);
}
.btn-ghost:hover { background: var(--color-surface-container-low); }

/* White (used on dark gradient backgrounds) */
.btn-white {
  background: #ffffff;
  color: var(--color-primary);
  font-weight: 800;
  box-shadow: var(--shadow-xl);
}
.btn-white:hover { transform: scale(1.03); box-shadow: var(--shadow-xl); }

/* Size variants */
.btn-sm { padding: 10px 20px; font-size: 13px; border-radius: var(--radius-lg); }
.btn-lg { padding: 20px 48px; font-size: 18px; border-radius: var(--radius-2xl); }
.btn-xl { padding: 22px 64px; font-size: 20px; border-radius: var(--radius-3xl); font-weight: 800; }

/* Full width */
.btn-full { width: 100%; }

/* ─────────────────────────────────────────────────────
   FORM INPUTS
───────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: var(--text-label-sm-size);
  font-weight: var(--text-label-sm-weight);
  color: var(--color-on-surface-variant);
  padding-left: 4px;
  transition: color var(--transition-fast);
}

.form-label.active { color: var(--color-primary); }

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-outline);
  pointer-events: none;
  transition: color var(--transition-fast);
  font-size: 20px;
}

.input-field {
  width: 100%;
  padding: 14px 16px;
  background: var(--color-surface-container-low);
  border: 1px solid rgba(208, 194, 211, 0.4);
  border-radius: var(--radius-xl);
  font-size: var(--text-body-md-size);
  color: var(--color-on-surface);
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  cursor: text;
}

.input-field::placeholder {
  color: var(--color-outline);
}

.input-field:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(105, 28, 154, 0.12);
}

.input-field.has-icon-left { padding-left: 48px; }
.input-field.has-icon-right { padding-right: 48px; }

.input-wrapper:focus-within .input-icon {
  color: var(--color-primary);
}

.input-action {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-outline);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
}

.input-action:hover { color: var(--color-on-surface-variant); }

textarea.input-field {
  resize: vertical;
  min-height: 120px;
  padding-top: 14px;
}

select.input-field {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%237f7383'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ─────────────────────────────────────────────────────
   BADGE
───────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge-primary {
  background: var(--color-primary-fixed);
  color: var(--color-on-primary-fixed-variant);
}

.badge-success {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-warning {
  background: #fff8e1;
  color: #f57f17;
}

.badge-danger {
  background: var(--color-error-container);
  color: var(--color-error);
}

.badge-gradient {
  background: var(--brand-gradient);
  color: #fff;
}

/* ─────────────────────────────────────────────────────
   DIVIDER
───────────────────────────────────────────────────── */
.divider {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-block: 24px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(208, 194, 211, 0.4);
}

.divider-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-outline-variant);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────
   STAT CARD
───────────────────────────────────────────────────── */
.stat-card {
  background: var(--color-surface-container-lowest);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-2xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.stat-card__value {
  font-size: 32px;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}

.stat-card__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ─────────────────────────────────────────────────────
   STATUS DOT
───────────────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot--active  { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.2); }
.status-dot--paused  { background: #f59e0b; }
.status-dot--stopped { background: var(--color-outline); }
.status-dot--error   { background: var(--color-error); }

/* ─────────────────────────────────────────────────────
   TOGGLE SWITCH
───────────────────────────────────────────────────── */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  gap: 10px;
}

.toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__track {
  width: 48px;
  height: 26px;
  background: var(--color-outline-variant);
  border-radius: var(--radius-full);
  transition: background var(--transition-base);
  position: relative;
}

.toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform var(--transition-base);
}

.toggle__input:checked + .toggle__track {
  background: var(--color-primary);
}

.toggle__input:checked + .toggle__track .toggle__thumb {
  transform: translateX(22px);
}

/* ─────────────────────────────────────────────────────
   SKELETON LOADER
───────────────────────────────────────────────────── */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.skeleton {
  background: var(--color-surface-container);
  border-radius: var(--radius-md);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* ─────────────────────────────────────────────────────
   TOOLTIP
───────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-inverse-surface);
  color: var(--color-inverse-on-surface);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 100;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ─────────────────────────────────────────────────────
   FLOATING ANIMATION (used on auth page)
───────────────────────────────────────────────────── */
@keyframes floating {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-18px); }
}

.floating-anim {
  animation: floating 6s ease-in-out infinite;
}

/* ─────────────────────────────────────────────────────
   SPIN ANIMATION
───────────────────────────────────────────────────── */
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.spin-slow { animation: spin-slow 30s linear infinite; }

/* ─────────────────────────────────────────────────────
   FADE IN (page-level)
───────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
  animation: fadeInUp 0.7s ease forwards;
}

.fade-in-up--delay-1 { animation-delay: 0.1s; opacity: 0; }
.fade-in-up--delay-2 { animation-delay: 0.2s; opacity: 0; }
.fade-in-up--delay-3 { animation-delay: 0.3s; opacity: 0; }

/* ─────────────────────────────────────────────────────
   PROGRESS BAR
───────────────────────────────────────────────────── */
.progress-bar {
  height: 8px;
  background: var(--color-surface-container);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

/* ─────────────────────────────────────────────────────
   ALERT / NOTICE
───────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-xl);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.alert-info    { background: var(--color-primary-fixed); color: var(--color-on-primary-fixed); }
.alert-success { background: #e8f5e9; color: #1b5e20; }
.alert-warning { background: #fff8e1; color: #7c4f00; }
.alert-error   { background: var(--color-error-container); color: var(--color-error); }

/* ─────────────────────────────────────────────────────
   CTA BANNER SECTION
───────────────────────────────────────────────────── */
.cta-section {
  position: relative;
  padding: 100px 32px;
  text-align: center;
  color: #fff;
  overflow: hidden;
  border-radius: var(--radius-3xl);
  margin: 64px auto;
  box-shadow: var(--shadow-xl);
}

.cta-section__bg {
  position: absolute;
  inset: 0;
  background: var(--brand-gradient);
  z-index: -2;
}

.cta-section__spinner {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.18), transparent 60%);
  z-index: -1;
  animation: spin-slow 30s linear infinite;
}

.cta-section__title {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
  color: #fff;
  text-align: center;
}

.cta-section__sub {
  font-size: 18px;
  opacity: 0.92;
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.6;
  font-weight: 500;
  color: #fff;
  text-align: center;
}

.cta-section .btn {
  display: inline-flex;
  margin: 0 auto;
}

.cta-section__note {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 24px;
  color: #fff;
  text-align: center;
}

