/* ======================================================================
   FinishWorkoutModal CSS — Urban Design
   Pre-rating screen keeps original soft design
   Main stats view uses new urban/technical style
   ====================================================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Anton&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;700&display=swap');

.fwm-modal {
  /* Urban Design Tokens */
  --fwm-font-display: 'Anton', sans-serif;
  --fwm-font-body: 'Inter', sans-serif;
  --fwm-font-mono: 'JetBrains Mono', monospace;

  /* Colors */
  --fwm-volt: #DFFF00;
  --fwm-off-black: #0F0F0F;
  --fwm-concrete: #1a1a1a;
  --fwm-dark-grey: #141414;

  /* Pre-rating screen colors (kept from original) */
  --fwm-accent: #facc15;

  /* Text Colors */
  --fwm-text-h: #f5f5f5;
  --fwm-text-body: rgba(255, 255, 255, 0.9);
  --fwm-text-muted: #6b7280;
  --fwm-text-subtle: #4b5563;

  /* Borders */
  --fwm-border: rgba(255, 255, 255, 0.1);

  /* Transitions */
  --fwm-tfast: 0.15s;
  --fwm-tmed: 0.25s;
}

/* ========== Base Modal ========== */
.fwm-no-scroll { overflow: hidden; }

.fwm-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: none;
  font-family: var(--fwm-font-body);
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
}

.fwm-modal.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* ========== Dialog Container ========== */
.fwm-dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 90vh;
  max-height: 900px;
  background: var(--fwm-off-black);
  color: var(--fwm-text-body);
  border: 1px solid var(--fwm-border);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  outline: none;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity var(--fwm-tfast), transform var(--fwm-tfast);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.fwm-modal.is-open .fwm-dialog {
  opacity: 1;
  transform: scale(1);
  animation: fwmFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fwmFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* ========== Confetti Canvas ========== */
.fwm-confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10021;
}

/* ================================================================
   PRE-RATING SCREEN (Kept from original soft design)
   ================================================================ */
.fwm-pre-rating-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
  border-radius: 16px;
}

.fwm-pre-rating-screen.is-visible {
  opacity: 1;
  visibility: visible;
}

.fwm-pre-rating-video-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  overflow: hidden;
  border-radius: 16px;
}

.fwm-pre-rating-video-container iframe,
.fwm-pre-rating-video-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
  border-radius: 16px;
}

.fwm-pre-rating-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.85) 25%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0) 75%);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  z-index: 2;
}

.fwm-pre-rating-subtitle {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fwm-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fwm-pre-rating-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  line-height: 1.3;
}

.fwm-pre-rating-stars {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.fwm-star {
  background: none;
  border: none;
  padding: 0.35rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.fwm-star svg {
  width: 2rem;
  height: 2rem;
  fill: rgba(255, 255, 255, 0.32);
  transition: fill 0.2s ease, filter 0.2s ease;
}

.fwm-star:hover,
.fwm-star.hover {
  transform: scale(1.12);
}

.fwm-star:hover svg,
.fwm-star.hover svg {
  fill: var(--fwm-accent);
  filter: drop-shadow(0 0 6px rgba(250, 204, 21, 0.4));
}

.fwm-star.active svg {
  fill: var(--fwm-accent);
  filter: drop-shadow(0 0 4px rgba(250, 204, 21, 0.35));
}

.fwm-pre-rating-finish-btn {
  width: 100%;
  max-width: 400px;
  background-color: #ffffff;
  color: #000000;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--fwm-tmed) ease;
  margin-top: 0.5rem;
}

.fwm-pre-rating-finish-btn:hover {
  background-color: #e5e5e5;
  transform: translateY(-1px);
}

/* ================================================================
   MAIN CONTENT - URBAN DESIGN (New)
   ================================================================ */
.fwm-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 90vh;
}

/* ========== Hero Section (no image) ========== */
.fwm-hero {
  position: relative;
  width: 100%;
  border-bottom: 1px solid var(--fwm-border);
  flex: 1;
  min-height: 120px;
  background: var(--fwm-off-black);
  display: flex;
  align-items: flex-end;
}

.fwm-hero-content {
  padding: 28px;
  width: 100%;
}

.fwm-hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.fwm-completed-badge {
  background: var(--fwm-volt);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fwm-completed-time {
  font-family: var(--fwm-font-mono);
  font-size: 11px;
  color: var(--fwm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.fwm-hero-title {
  font-family: var(--fwm-font-display);
  font-size: 2.3rem;
  font-weight: 400;
  text-transform: uppercase;
  color: #fff;
  line-height: 1;
  margin: 0;
}

/* ========== Content Area (no scroll) ========== */
.fwm-content-scroll {
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ========== Primary Stats Grid ========== */
.fwm-primary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--fwm-border);
}

.fwm-primary-stat {
  padding: 28px;
  background: rgba(26, 26, 26, 0.5);
}

.fwm-primary-stat-left {
  border-right: 1px solid var(--fwm-border);
}

.fwm-stat-label {
  display: block;
  font-family: var(--fwm-font-mono);
  font-size: 11px;
  color: var(--fwm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.fwm-stat-value-large {
  font-family: var(--fwm-font-display);
  font-size: 2.5rem;
  color: #fff;
  line-height: 1;
}

.fwm-stat-comparison {
  display: block;
  font-family: var(--fwm-font-mono);
  font-size: 11px;
  color: var(--fwm-volt);
  margin-top: 6px;
}

.fwm-stat-comparison:empty {
  display: none;
}

.fwm-stat-comparison.negative {
  color: #ef4444;
}

/* ========== Secondary Stats Row ========== */
.fwm-secondary-stats {
  display: flex;
  border-bottom: 1px solid var(--fwm-border);
  background: #121212;
}

.fwm-secondary-stat {
  flex: 1;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-right: 1px solid var(--fwm-border);
}

.fwm-secondary-stat:last-child {
  border-right: none;
}

.fwm-stat-icon {
  width: 16px;
  height: 16px;
  margin-bottom: 10px;
}

.fwm-stat-icon-green {
  color: var(--fwm-volt);
}

.fwm-stat-icon-orange {
  color: #f97316;
}

.fwm-stat-icon-gray {
  color: var(--fwm-text-muted);
}

.fwm-secondary-stat-value {
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1;
  color: #fff;
}

.fwm-secondary-stat-label {
  font-size: 9px;
  color: var(--fwm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
}

.fwm-text-muted {
  color: var(--fwm-text-muted) !important;
}

/* ========== Distribution Section ========== */
.fwm-distribution-section {
  padding: 24px;
  border-bottom: 1px solid var(--fwm-border);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.fwm-distribution-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
}

.fwm-section-title {
  font-family: var(--fwm-font-display);
  font-size: 1.5rem;
  text-transform: uppercase;
  color: #fff;
  margin: 0;
  font-weight: 400;
}

.fwm-section-subtitle {
  font-family: var(--fwm-font-mono);
  font-size: 11px;
  color: var(--fwm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fwm-distribution-bars {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  justify-content: flex-start;
  overflow: hidden;
  padding: 8px 0;
}

.fwm-distribution-bar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fwm-distribution-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.fwm-distribution-bar-label {
  font-weight: 700;
  text-transform: uppercase;
  color: #d1d5db;
}

.fwm-distribution-bar-value {
  font-family: var(--fwm-font-mono);
  font-size: 12px;
}

.fwm-distribution-bar-value.primary {
  color: var(--fwm-volt);
}

.fwm-distribution-bar-value.secondary {
  color: #fff;
}

.fwm-distribution-bar-value.tertiary {
  color: var(--fwm-text-muted);
}

.fwm-distribution-bar-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
}

.fwm-distribution-bar-fill {
  height: 100%;
  transition: width 0.8s ease-out;
}

.fwm-distribution-bar-fill.primary {
  background: var(--fwm-volt);
}

.fwm-distribution-bar-fill.secondary {
  background: #fff;
}

.fwm-distribution-bar-fill.tertiary {
  background: #333;
}

/* ========== Bottom Stats Grid ========== */
.fwm-bottom-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--fwm-concrete);
  margin-top: auto;
}

.fwm-bottom-stat {
  padding: 20px;
}

.fwm-bottom-stat:first-child {
  border-right: 1px solid var(--fwm-border);
}

.fwm-bottom-stat-label {
  display: block;
  font-family: var(--fwm-font-mono);
  font-size: 10px;
  color: var(--fwm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.fwm-bottom-stat-value {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
}

/* Intensity colors */
.fwm-bottom-stat-value[data-intensity="beginner"] {
  color: #4ade80;
}

.fwm-bottom-stat-value[data-intensity="intermediate"] {
  color: #facc15;
}

.fwm-bottom-stat-value[data-intensity="advanced"] {
  color: #f97316;
}

.fwm-bottom-stat-value[data-intensity="professional"] {
  color: #ef4444;
}

/* ========== Footer ========== */
.fwm-footer {
  padding: 24px;
  border-top: 1px solid var(--fwm-border);
  background: var(--fwm-off-black);
  flex-shrink: 0;
}

.fwm-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 3fr;
  gap: 12px;
}

.fwm-footer-btn {
  height: 52px;
  border: 1px solid var(--fwm-border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--fwm-tfast);
}

.fwm-footer-btn svg {
  width: 22px;
  height: 22px;
}

.fwm-footer-btn-icon {
  color: var(--fwm-text-muted);
}

.fwm-footer-btn-icon:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.fwm-footer-btn-icon.liked {
  color: #ef4444;
}

.fwm-footer-btn-icon.liked svg {
  fill: #ef4444;
}

.fwm-footer-btn-cta {
  background: var(--fwm-volt);
  border: none;
  color: #000;
  font-family: var(--fwm-font-display);
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  gap: 8px;
}

.fwm-footer-btn-cta:hover {
  background: #fff;
}

.fwm-footer-btn-cta svg {
  stroke: #000;
}

/* ================================================================
   MOBILE STYLES
   ================================================================ */
@media (max-width: 768px) {
  .fwm-modal.is-open {
    padding: 0;
    align-items: stretch;
  }

  .fwm-dialog {
    max-width: none;
    max-height: none;
    height: 100vh;
    height: 100dvh;
  }

  /* Pre-rating mobile */
  .fwm-pre-rating-screen {
    border-radius: 0;
  }

  .fwm-pre-rating-video-container,
  .fwm-pre-rating-video-container iframe,
  .fwm-pre-rating-video-container img {
    border-radius: 0;
  }

  .fwm-pre-rating-content {
    padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom, 0px));
  }

  .fwm-pre-rating-title {
    font-size: 1.25rem;
  }

  .fwm-star svg {
    width: 1.75rem;
    height: 1.75rem;
  }

  /* Main content mobile */
  .fwm-body {
    max-height: none;
    height: 100%;
  }

  .fwm-hero {
    min-height: 100px;
  }

  .fwm-hero-title {
    font-size: 1.75rem;
  }

  .fwm-hero-content {
    padding: 20px;
  }

  .fwm-primary-stat {
    padding: 20px;
  }

  .fwm-stat-value-large {
    font-size: 2rem;
  }

  .fwm-secondary-stat {
    padding: 16px 12px;
  }

  .fwm-secondary-stat-value {
    font-size: 1.25rem;
  }

  .fwm-distribution-section {
    padding: 20px;
  }

  .fwm-section-title {
    font-size: 1.25rem;
  }

  .fwm-footer {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .fwm-footer-btn {
    height: 48px;
  }

  .fwm-footer-btn-cta {
    font-size: 1.125rem;
  }
}

/* ======================================================================
   Clean Theme Overrides
   White background, black text, sharp corners, system fonts
   ====================================================================== */

body.design-clean .fwm-modal {
  /* Override fonts to system */
  --fwm-font-display: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --fwm-font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --fwm-font-mono: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Colors - Light theme */
  --fwm-volt: #1A1A1A;
  --fwm-off-black: #FFFFFF;
  --fwm-concrete: #F5F5F5;
  --fwm-dark-grey: #FAFAFA;
  --fwm-accent: #1A1A1A;

  /* Text Colors */
  --fwm-text-h: #1A1A1A;
  --fwm-text-body: #333333;
  --fwm-text-muted: #666666;
  --fwm-text-subtle: #999999;

  /* Borders */
  --fwm-border: #E5E5E5;

  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
}

/* Dialog container */
body.design-clean .fwm-dialog {
  background: #FFFFFF;
  border: 1px solid #E5E5E5;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

/* Pre-rating screen */
body.design-clean .fwm-pre-rating-screen {
  border-radius: 0;
}

body.design-clean .fwm-pre-rating-video-container,
body.design-clean .fwm-pre-rating-video-container iframe,
body.design-clean .fwm-pre-rating-video-container img {
  border-radius: 0;
}

body.design-clean .fwm-pre-rating-subtitle {
  color: #1A1A1A;
}

body.design-clean .fwm-star svg {
  fill: rgba(0, 0, 0, 0.2);
}

body.design-clean .fwm-star:hover svg,
body.design-clean .fwm-star.hover svg {
  fill: #1A1A1A;
  filter: none;
}

body.design-clean .fwm-star.active svg {
  fill: #1A1A1A;
  filter: none;
}

body.design-clean .fwm-pre-rating-finish-btn {
  background-color: #1A1A1A;
  color: #FFFFFF;
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.design-clean .fwm-pre-rating-finish-btn:hover {
  background-color: #333333;
}

/* Hero section */
body.design-clean .fwm-hero {
  background: #FFFFFF;
  border-bottom: 1px solid #E5E5E5;
}

body.design-clean .fwm-completed-badge {
  background: #1A1A1A;
  color: #FFFFFF;
}

body.design-clean .fwm-completed-time {
  font-family: var(--fwm-font-body);
  color: #666666;
}

body.design-clean .fwm-hero-title {
  font-family: var(--fwm-font-body);
  font-weight: 700;
  text-transform: none;
  color: #1A1A1A;
}

/* Primary stats */
body.design-clean .fwm-primary-stat {
  background: #FAFAFA;
}

body.design-clean .fwm-stat-label {
  font-family: var(--fwm-font-body);
  color: #666666;
}

body.design-clean .fwm-stat-value-large {
  font-family: var(--fwm-font-body);
  font-weight: 700;
  color: #1A1A1A;
}

body.design-clean .fwm-stat-comparison {
  font-family: var(--fwm-font-body);
  color: #1A1A1A;
}

body.design-clean .fwm-stat-comparison.negative {
  color: #dc3545;
}

/* Secondary stats */
body.design-clean .fwm-secondary-stats {
  background: #FFFFFF;
}

body.design-clean .fwm-secondary-stat {
  border-right: 1px solid #E5E5E5;
}

body.design-clean .fwm-stat-icon-green {
  color: #1A1A1A;
}

body.design-clean .fwm-stat-icon-orange {
  color: #f97316;
}

body.design-clean .fwm-stat-icon-gray {
  color: #999999;
}

body.design-clean .fwm-secondary-stat-value {
  color: #1A1A1A;
}

body.design-clean .fwm-secondary-stat-label {
  color: #666666;
}

/* Distribution section */
body.design-clean .fwm-distribution-section {
  border-bottom: 1px solid #E5E5E5;
}

body.design-clean .fwm-section-title {
  font-family: var(--fwm-font-body);
  font-weight: 700;
  text-transform: none;
  color: #1A1A1A;
}

body.design-clean .fwm-section-subtitle {
  font-family: var(--fwm-font-body);
  color: #666666;
}

body.design-clean .fwm-distribution-bar-label {
  color: #333333;
}

body.design-clean .fwm-distribution-bar-value.primary {
  color: #1A1A1A;
}

body.design-clean .fwm-distribution-bar-track {
  background: #E5E5E5;
}

body.design-clean .fwm-distribution-bar-fill.primary {
  background: #1A1A1A;
}

body.design-clean .fwm-distribution-bar-fill.secondary {
  background: #666666;
}

body.design-clean .fwm-distribution-bar-fill.tertiary {
  background: #CCCCCC;
}

/* Bottom stats */
body.design-clean .fwm-bottom-stats {
  background: #F5F5F5;
}

body.design-clean .fwm-bottom-stat:first-child {
  border-right: 1px solid #E5E5E5;
}

body.design-clean .fwm-bottom-stat-label {
  font-family: var(--fwm-font-body);
  color: #666666;
}

body.design-clean .fwm-bottom-stat-value {
  color: #1A1A1A;
  text-transform: none;
}

/* Footer */
body.design-clean .fwm-footer {
  border-top: 1px solid #E5E5E5;
  background: #FFFFFF;
}

body.design-clean .fwm-footer-btn {
  border: 1px solid #E5E5E5;
}

body.design-clean .fwm-footer-btn-icon {
  color: #666666;
}

body.design-clean .fwm-footer-btn-icon:hover {
  background: #F5F5F5;
  color: #1A1A1A;
}

body.design-clean .fwm-footer-btn-icon.liked {
  color: #ef4444;
}

body.design-clean .fwm-footer-btn-cta {
  background: #1A1A1A;
  color: #FFFFFF;
  font-family: var(--fwm-font-body);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.design-clean .fwm-footer-btn-cta:hover {
  background: #333333;
}
