/* =============================================
   FabricAI — Shared Component Styles
   styles/components.css
   ============================================= */

/* ─── Site Header ───────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: var(--glass-bg-heavy);
  border-bottom: var(--glass-border);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header-logo-icon {
  width: 38px;
  height: 38px;
}

.header-brand-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-extrabold);
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: var(--tracking-tight);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ─── Dashboard Hero Label ──────────────────── */
.dashboard-hero {
  padding-block: var(--space-10) var(--space-8);
  text-align: center;
}

.dashboard-hero-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  background: var(--gradient-brand-soft);
  border: 1px solid hsla(263, 60%, 55%, 0.25);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-brand);
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-5);
  animation: slideDown var(--duration-slow) var(--ease-out) both;
}

.dashboard-hero-label svg {
  width: 14px;
  height: 14px;
}

.dashboard-hero-title {
  font-size: var(--text-4xl);
  font-family: var(--font-display);
  font-weight: var(--weight-extrabold);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
  animation: slideUp var(--duration-slow) var(--ease-out) 100ms both;
  max-width: 700px;
  margin-inline: auto;
}

.dashboard-hero-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 520px;
  margin-inline: auto;
  margin-bottom: var(--space-6);
  animation: slideUp var(--duration-slow) var(--ease-out) 200ms both;
}

/* ─── Icon Buttons ──────────────────────────── */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: hsla(240, 10%, 18%, 0.6);
  border: 1px solid var(--color-border-default);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-base);
}

.icon-btn:hover {
  background: hsla(240, 10%, 25%, 0.6);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ─── Logout Button ─────────────────────────── */
.logout-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  background: hsla(355, 75%, 60%, 0.1);
  border: 1px solid hsla(355, 75%, 60%, 0.2);
  color: var(--color-error);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: var(--transition-base);
}

.logout-btn:hover {
  background: var(--color-error);
  border-color: var(--color-error);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-error);
}

.logout-btn svg {
  width: 16px;
  height: 16px;
}

/* ─── Generate Button ───────────────────────── */
.generate-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  padding-block: var(--space-6) var(--space-4);
}

.generate-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-width: 280px;
  height: 64px;
  padding: 0 var(--space-10);
  border-radius: var(--radius-full);
  background: var(--gradient-brand);
  background-size: 200% 200%;
  color: white;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  border: none;
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out),
              opacity var(--duration-slow) var(--ease-out);
  box-shadow: var(--shadow-brand);
  animation: glowPulse 3s ease-in-out infinite;
}

/* Shimmer layer */
.generate-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-shimmer);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* Pulse ring on hover */
.generate-btn::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: var(--radius-full);
  border: 2px solid hsla(263, 70%, 60%, 0.5);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}

.generate-btn:hover:not(:disabled)::after {
  opacity: 1;
  transform: scale(1);
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: var(--shadow-brand-strong);
  animation: none;
}

.generate-btn:active:not(:disabled) {
  transform: translateY(-1px);
}

.generate-btn:disabled,
.generate-btn.disabled {
  background: hsla(240, 10%, 20%, 0.8);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.5;
  animation: none;
  transform: none;
  color: var(--color-text-tertiary);
}

.generate-btn:disabled::before {
  display: none;
}

/* Button content layers */
.generate-btn-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  pointer-events: none;
}

.generate-btn svg {
  width: 24px;
  height: 24px;
  transition: transform var(--duration-base) var(--ease-bounce);
}

.generate-btn:hover:not(:disabled) svg {
  transform: scale(1.15) rotate(-5deg);
}

/* ─── Generate Loading State ────────────────── */
.generate-btn.loading {
  cursor: wait;
  animation: none;
  min-width: 340px;
}

.generate-btn.loading:hover {
  transform: none;
}

.generate-btn-spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid hsla(0,0%,100%,0.3);
  border-top-color: white;
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
  display: none;
  flex-shrink: 0;
}

.generate-btn.loading .generate-btn-spinner {
  display: block;
}

.generate-btn.loading .generate-btn-icon {
  display: none;
}

/* ─── Loading Progress ──────────────────────── */
.generate-progress-wrap {
  width: 100%;
  max-width: 400px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  animation: slideUp var(--duration-slow) var(--ease-out) both;
}

.generate-progress-wrap.visible {
  display: flex;
}

.generate-progress-bar-track {
  width: 100%;
  height: 6px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.generate-progress-bar-fill {
  height: 100%;
  background: var(--gradient-brand);
  border-radius: var(--radius-full);
  background-size: 200% 100%;
  animation: gradientShift 2s linear infinite;
  transition: width var(--duration-slow) var(--ease-out);
  position: relative;
}

/* Striped pattern overlay */
.generate-progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 8px,
    hsla(0,0%,100%,0.15) 8px,
    hsla(0,0%,100%,0.15) 16px
  );
  animation: progressStripe 0.5s linear infinite;
}

.generate-stage-text {
  font-size: var(--text-sm);
  color: var(--color-text-brand);
  font-weight: var(--weight-medium);
  text-align: center;
  min-height: 1.5em;
  transition: opacity var(--duration-base) var(--ease-out);
}

.generate-stage-text.fade {
  opacity: 0;
}

/* ─── Generate Success State ────────────────── */
.generate-btn.success {
  background: linear-gradient(135deg, hsl(155, 65%, 40%) 0%, hsl(155, 65%, 35%) 100%);
  box-shadow: var(--shadow-success);
  animation: none;
  cursor: default;
}

.generate-btn.success:hover {
  transform: none;
}

/* ─── Checklist prereqs ─────────────────────── */
.generate-requirements {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  justify-content: center;
}

.req-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  transition: color var(--duration-base) var(--ease-out);
}

.req-item.complete {
  color: var(--color-success);
}

.req-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ─── Toast Notifications ───────────────────── */
#toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-4));
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  min-width: 280px;
  max-width: 380px;
  background: var(--glass-bg-heavy);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  box-shadow: var(--shadow-xl);
  pointer-events: all;
  animation: toastIn var(--duration-slow) var(--ease-out) both;
}

.toast.removing {
  animation: toastOut var(--duration-slow) var(--ease-out) forwards;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.toast-message {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-snug);
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-tertiary);
  padding: 2px;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast);
  flex-shrink: 0;
}

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

.toast-close svg {
  width: 14px;
  height: 14px;
}

/* Toast variants */
.toast--success {
  border-left: 3px solid var(--color-success);
}

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

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

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

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

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

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

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

/* ─── Offline Banner ────────────────────────── */
#offline-banner {
  position: fixed;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--color-warning-soft);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-warning);
  backdrop-filter: var(--glass-blur);
  transition: transform var(--duration-slow) var(--ease-out);
  pointer-events: none;
  white-space: nowrap;
}

#offline-banner.visible {
  transform: translateX(-50%) translateY(0);
}

#offline-banner svg {
  width: 16px;
  height: 16px;
}
