/**
 * Shared Component Styles for AudioScriptPro
 *
 * Reusable utility classes: animations, glass effect, hover lifts,
 * status accents, skeleton loaders.
 *
 * All values reference tokens from variables.css.
 * All animations respect prefers-reduced-motion.
 */

/* ==========================================================================
   Surface Anchors & Numeric Utilities (Wave 1)
   ========================================================================== */

.bg-marketing {
  background: var(--asp-bg-marketing);
  color: #fafaf9;  /* Always-light text on always-dark surface; matches dark-mode --asp-text */
}

.bg-app {
  background: var(--asp-bg-app);
  color: #fafaf9;
}

.surface-1 {
  background: var(--asp-bg-secondary);
}

.surface-2 {
  background: var(--asp-bg-tertiary);
}

.numeric {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ==========================================================================
   AudioScriptPro Wordmark
   ========================================================================== */

.asp-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.asp-brand-mark {
  display: inline-flex;
  width: 1.35rem;
  height: 1.35rem;
  color: #fff;
  flex: 0 0 auto;
}

.asp-brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.asp-brand-mark rect {
  fill: var(--asp-primary);
}

.asp-brand-mark g {
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ==========================================================================
   Timecode Typography
   ========================================================================== */

.tc {
  font-family: var(--asp-font-mono);
  font-variant-numeric: tabular-nums slashed-zero;
  font-feature-settings: "tnum" 1, "zero" 1;
  letter-spacing: 0;
  white-space: nowrap;
}

/* ==========================================================================
   Status Chips
   ========================================================================== */

.status-chip {
  --chip-color: var(--asp-secondary);
  --chip-bg: rgba(100, 116, 139, 0.1);
  --chip-border: rgba(100, 116, 139, 0.22);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-color);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}

.status-chip .status-dot,
.status-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--chip-color, var(--asp-secondary));
  flex: 0 0 auto;
}

.status-chip.success,
.status-dot.success {
  --chip-color: var(--asp-success);
  --chip-bg: var(--asp-tint-success);
  --chip-border: rgba(5, 150, 105, 0.24);
}

.status-chip.info,
.status-dot.info {
  --chip-color: var(--asp-info);
  --chip-bg: var(--asp-tint-info);
  --chip-border: rgba(8, 145, 178, 0.24);
}

.status-chip.warning,
.status-dot.warning {
  --chip-color: var(--asp-warning);
  --chip-bg: var(--asp-tint-warning);
  --chip-border: rgba(217, 119, 6, 0.26);
}

.status-chip.danger,
.status-dot.danger {
  --chip-color: var(--asp-danger);
  --chip-bg: var(--asp-tint-danger);
  --chip-border: rgba(220, 38, 38, 0.24);
}

.status-chip.primary,
.status-dot.primary {
  --chip-color: var(--asp-primary);
  --chip-bg: var(--asp-primary-light);
  --chip-border: rgba(37, 99, 235, 0.22);
}

.status-chip.secondary,
.status-dot.secondary {
  --chip-color: var(--asp-secondary);
  --chip-bg: rgba(100, 116, 139, 0.1);
}

a.status-chip:focus-visible,
button.status-chip:focus-visible {
  outline: 2px solid var(--asp-primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Admin Stat Cards
   ========================================================================== */

.admin-stat-card {
  border: 1px solid var(--asp-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0)),
    var(--asp-bg);
  box-shadow: var(--asp-shadow-sm);
}

.admin-stat-card .card-body {
  min-height: 9rem;
}

.admin-stat-label {
  color: var(--asp-text-secondary);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-stat-value {
  font-family: var(--asp-font-heading);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: clamp(2rem, 4vw, 2.65rem);
  line-height: 1;
  letter-spacing: 0;
}

.admin-stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--asp-radius);
  background: var(--stat-bg, var(--asp-primary-light));
  color: var(--stat-color, var(--asp-primary));
}

.admin-stat-primary {
  --stat-color: var(--asp-primary);
  --stat-bg: var(--asp-primary-light);
}

.admin-stat-success {
  --stat-color: var(--asp-success);
  --stat-bg: var(--asp-tint-success);
}

.admin-stat-info {
  --stat-color: var(--asp-info);
  --stat-bg: var(--asp-tint-info);
}

.admin-stat-danger {
  --stat-color: var(--asp-danger);
  --stat-bg: var(--asp-tint-danger);
}

.dark-mode .admin-stat-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    var(--asp-bg-secondary);
}

/* ==========================================================================
   Card Hover Lift
   ========================================================================== */

.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--asp-shadow-hover);
}

/* ==========================================================================
   Glass Effect Utility
   ========================================================================== */

.glass-effect {
  background: var(--asp-glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--asp-glass-border);
  box-shadow: var(--asp-glass-shadow);
}

/* ==========================================================================
   Fade-In-Up Animation (page entry)
   ========================================================================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.4s ease-out;
}

/* ==========================================================================
   Skeleton Loader
   ========================================================================== */

@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--asp-bg-secondary) 25%, var(--asp-bg-tertiary) 37%, var(--asp-bg-secondary) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--asp-radius);
}

/* ==========================================================================
   Pulse Animation (active/loading indicators)
   ========================================================================== */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ==========================================================================
   Spin Animation
   ========================================================================== */

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

.spin {
  animation: spin 1s linear infinite;
}

/* ==========================================================================
   Status Left-Border Accents
   ========================================================================== */

.status-accent-info {
  border-left: 4px solid var(--asp-info);
}

.status-accent-success {
  border-left: 4px solid var(--asp-success);
}

.status-accent-warning {
  border-left: 4px solid var(--asp-warning);
}

.status-accent-danger {
  border-left: 4px solid var(--asp-danger);
}

/* ==========================================================================
   Smooth Theme Transition (applied to body)
   ========================================================================== */

body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==========================================================================
   Hero Section Background
   ========================================================================== */

.hero-gradient {
  background: linear-gradient(to bottom, var(--asp-bg-secondary), var(--asp-bg));
}

/* ==========================================================================
   Auth Card Accent Bar
   ========================================================================== */

.auth-card-accent {
  border-top: 3px solid transparent;
  border-image: var(--asp-gradient-header);
  border-image-slice: 1;
  box-shadow: var(--asp-shadow);
}

/* ==========================================================================
   Feature Icon Shadow
   ========================================================================== */

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--asp-radius-lg);
  background: var(--asp-tint-info);
  color: var(--asp-primary);
  font-size: 1.5rem;
  box-shadow: var(--asp-shadow-sm);
}

/* ==========================================================================
   Progress Bar Gradient
   ========================================================================== */

.progress-gradient .progress-bar {
  background: var(--asp-gradient-primary);
}

/* ==========================================================================
   Focus Ring Enhancement
   ========================================================================== */

.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
  border-color: var(--asp-primary);
}

/* ==========================================================================
   Empty State Enhancement
   ========================================================================== */

.empty-state {
  border: 1px dashed var(--asp-border);
  border-radius: var(--asp-radius-lg);
  padding: 3rem 1.5rem;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--asp-text-muted);
  opacity: 0.5;
}

/* ==========================================================================
   Quick Prompt Pill Buttons
   ========================================================================== */

.quick-prompt-pill {
  border-radius: 50rem;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.quick-prompt-pill:hover {
  transform: translateY(-1px);
}

/* ==========================================================================
   Transcript Preview Inner Shadow
   ========================================================================== */

.transcript-preview {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.dark-mode .transcript-preview {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Stagger-In Animation (card groups, list items)
   ========================================================================== */

.stagger-in > * {
  animation: fadeInUp 0.4s ease-out both;
}

.stagger-in > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.10s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.20s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.30s; }
.stagger-in > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-in > *:nth-child(8) { animation-delay: 0.40s; }
.stagger-in > *:nth-child(n+9) { animation-delay: 0.45s; }

/* ==========================================================================
   Enhanced Button Hover Effects
   ========================================================================== */

.btn-primary,
.btn-success,
.btn-danger {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-success:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.btn-danger:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

/* ==========================================================================
   Message Timestamp Styling
   ========================================================================== */

.message-timestamp {
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ==========================================================================
   Inline Title Edit Styling
   ========================================================================== */

.job-title-display {
  cursor: pointer;
  border-bottom: 2px dashed transparent;
  transition: border-color 0.2s ease;
}

.job-title-display:hover,
.job-title-display:focus {
  border-bottom-color: var(--asp-primary);
}

/* ==========================================================================
   Reduce Motion Override
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .card-hover,
  .fade-in-up,
  .skeleton,
  .pulse,
  .spin,
  .quick-prompt-pill,
  .summary-item,
  .message .message-content,
  .color-option,
  .active-filter-badge,
  .transcript-preview-area,
  .playback-controls button,
  .stagger-in > *,
  .btn-primary,
  .btn-success,
  .btn-danger,
  body {
    animation: none !important;
    transition: none !important;
  }

  .card-hover:hover,
  .quick-prompt-pill:hover,
  .summary-item:hover,
  .color-option:hover,
  .btn-primary:hover,
  .btn-success:hover,
  .btn-danger:hover {
    transform: none;
    box-shadow: none;
  }
}

/* Also gate on the existing .reduce-motion class */
.reduce-motion .card-hover,
.reduce-motion .fade-in-up,
.reduce-motion .skeleton,
.reduce-motion .pulse,
.reduce-motion .spin,
.reduce-motion .quick-prompt-pill,
.reduce-motion .summary-item,
.reduce-motion .message .message-content,
.reduce-motion .color-option,
.reduce-motion .active-filter-badge,
.reduce-motion .transcript-preview-area,
.reduce-motion .playback-controls button,
.reduce-motion .stagger-in > *,
.reduce-motion .btn-primary,
.reduce-motion .btn-success,
.reduce-motion .btn-danger {
  animation: none !important;
  transition: none !important;
}

.reduce-motion .card-hover:hover,
.reduce-motion .quick-prompt-pill:hover,
.reduce-motion .summary-item:hover,
.reduce-motion .color-option:hover,
.reduce-motion .btn-primary:hover,
.reduce-motion .btn-success:hover,
.reduce-motion .btn-danger:hover {
  transform: none;
  box-shadow: none;
}
