/* ============================================
   FRANCEGUIDANCE — Player Styles
   ============================================ */

/* --- Design Tokens --- */
:root {
  --fg-brand: #4F46E5;
  --fg-brand-light: #818CF8;
  --fg-brand-dark: #3730A3;
  --fg-brand-bg: #EEF2FF;

  --fg-gray-50: #F9FAFB;
  --fg-gray-100: #F3F4F6;
  --fg-gray-200: #E5E7EB;
  --fg-gray-300: #D1D5DB;
  --fg-gray-400: #9CA3AF;
  --fg-gray-500: #6B7280;
  --fg-gray-600: #4B5563;
  --fg-gray-700: #374151;
  --fg-gray-800: #1F2937;
  --fg-gray-900: #111827;

  --fg-white: #FFFFFF;
  --fg-overlay-color: rgba(0, 0, 0, 0.6);

  --fg-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --fg-font-sm: 0.8125rem;
  --fg-font-base: 0.9375rem;
  --fg-font-lg: 1.125rem;
  --fg-font-xl: 1.5rem;

  --fg-space-xs: 0.25rem;
  --fg-space-sm: 0.5rem;
  --fg-space-md: 1rem;
  --fg-space-lg: 1.5rem;
  --fg-space-xl: 2rem;
  --fg-space-2xl: 3rem;

  --fg-radius-sm: 6px;
  --fg-radius-md: 10px;
  --fg-radius-lg: 16px;
  --fg-radius-full: 9999px;

  --fg-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --fg-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --fg-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --fg-shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.12), 0 8px 10px -6px rgba(0,0,0,0.08);

  --fg-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --fg-ease-out: cubic-bezier(0, 0, 0.2, 1);
  --fg-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --fg-dur-fast: 150ms;
  --fg-dur-normal: 300ms;
  --fg-dur-slow: 500ms;
}

/* --- Login Screen --- */
.fg-login {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fg-gray-100);
  font-family: var(--fg-font);
}

.fg-login__card {
  background: var(--fg-white);
  border-radius: var(--fg-radius-lg);
  box-shadow: var(--fg-shadow-xl);
  padding: var(--fg-space-xl) var(--fg-space-2xl);
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.fg-login__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: var(--fg-radius-full);
  background: var(--fg-brand-bg);
  color: var(--fg-brand);
  margin-bottom: var(--fg-space-md);
}

.fg-login__title {
  font-size: var(--fg-font-xl);
  color: var(--fg-gray-900);
  margin-bottom: var(--fg-space-xs);
}

.fg-login__subtitle {
  font-size: var(--fg-font-sm);
  color: var(--fg-gray-500);
  margin-bottom: var(--fg-space-lg);
}

.fg-login__form {
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-md);
}

.fg-login__field {
  text-align: left;
}

.fg-login__field label {
  display: block;
  font-size: var(--fg-font-sm);
  font-weight: 600;
  color: var(--fg-gray-700);
  margin-bottom: var(--fg-space-xs);
}

.fg-login__field input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: var(--fg-font-base);
  font-family: var(--fg-font);
  border: 1.5px solid var(--fg-gray-300);
  border-radius: var(--fg-radius-sm);
  outline: none;
  transition: border-color var(--fg-dur-fast) var(--fg-ease);
}

.fg-login__field input:focus {
  border-color: var(--fg-brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.fg-login__error {
  font-size: var(--fg-font-sm);
  color: #DC2626;
  margin: 0;
}

.fg-login__btn {
  padding: 0.65rem 1rem;
  font-size: var(--fg-font-base);
  font-weight: 600;
  font-family: var(--fg-font);
  color: var(--fg-white);
  background: var(--fg-brand);
  border: none;
  border-radius: var(--fg-radius-sm);
  cursor: pointer;
  transition: background var(--fg-dur-fast) var(--fg-ease);
}

.fg-login__btn:hover {
  background: var(--fg-brand-dark);
}

.fg-login__btn:active {
  transform: scale(0.98);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--fg-font);
  background: var(--fg-gray-100);
  color: var(--fg-gray-800);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--fg-space-lg);
}

/* --- Hidden attribute support (prevents display: flex from overriding hidden) --- */
[hidden] { display: none !important; }

/* --- Loading --- */
.fg-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--fg-space-md);
  color: var(--fg-gray-500);
  font-size: var(--fg-font-base);
}

.fg-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--fg-gray-200);
  border-top-color: var(--fg-brand);
  border-radius: 50%;
  animation: fg-spin 0.8s linear infinite;
}

@keyframes fg-spin {
  to { transform: rotate(360deg); }
}

/* --- Error --- */
.fg-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--fg-space-md);
  text-align: center;
  color: var(--fg-gray-600);
}

.fg-error__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #FEE2E2;
  color: #DC2626;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.fg-error h2 {
  font-size: var(--fg-font-lg);
  color: var(--fg-gray-800);
}

/* --- Player Container --- */
.fg-player {
  width: 100%;
  max-width: 1100px;
  background: var(--fg-white);
  border-radius: var(--fg-radius-lg);
  box-shadow: var(--fg-shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.fg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--fg-space-md) var(--fg-space-lg);
  border-bottom: 1px solid var(--fg-gray-100);
}

.fg-header__left {
  display: flex;
  align-items: center;
  gap: var(--fg-space-sm);
  min-width: 0;
}

.fg-header__logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}

.fg-header__title {
  font-size: var(--fg-font-lg);
  font-weight: 600;
  color: var(--fg-gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fg-header__step-counter {
  font-size: var(--fg-font-sm);
  color: var(--fg-gray-500);
  font-weight: 500;
  white-space: nowrap;
  background: var(--fg-gray-100);
  padding: 4px 12px;
  border-radius: var(--fg-radius-full);
}

/* --- Progress Bar --- */
.fg-progress {
  height: 3px;
  background: var(--fg-gray-100);
  position: relative;
}

.fg-progress__bar {
  height: 100%;
  background: var(--fg-brand);
  width: 0%;
  transition: width var(--fg-dur-normal) var(--fg-ease);
  border-radius: 0 2px 2px 0;
}

/* --- Viewport --- */
.fg-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--fg-gray-50);
  cursor: default;
}

.fg-screenshot {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity var(--fg-dur-normal) var(--fg-ease);
}

.fg-screenshot.is-loading {
  opacity: 0.3;
}

/* --- Overlay (Spotlight) --- */
.fg-overlay {
  position: absolute;
  inset: 0;
  background: var(--fg-overlay-color);
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--fg-dur-normal) var(--fg-ease);
  -webkit-mask-image: none;
  mask-image: none;
}

.fg-overlay.is-visible {
  opacity: 1;
}

/* --- Hotspot --- */
.fg-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 20;
  width: 48px;
  height: 48px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity var(--fg-dur-normal) var(--fg-ease);
  outline: none;
}

.fg-hotspot:focus-visible {
  outline: 2px solid var(--fg-brand);
  outline-offset: 4px;
  border-radius: 50%;
}

.fg-hotspot.is-visible {
  opacity: 1;
}

.fg-hotspot__core {
  position: absolute;
  inset: 25%;
  border-radius: var(--fg-radius-full);
  background: var(--fg-brand);
  border: 3px solid var(--fg-white);
  box-shadow: var(--fg-shadow-md);
  transition: transform var(--fg-dur-fast) var(--fg-ease);
}

.fg-hotspot:hover .fg-hotspot__core {
  transform: scale(1.15);
}

.fg-hotspot__pulse {
  position: absolute;
  inset: 0;
  border-radius: var(--fg-radius-full);
  border: 2px solid var(--fg-brand);
  animation: fg-pulse 2s var(--fg-ease) infinite;
}

@keyframes fg-pulse {
  0%   { transform: scale(1);   opacity: 0.7; }
  70%  { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* --- Tooltip --- */
.fg-tooltip {
  position: absolute;
  z-index: 30;
  width: 300px;
  max-width: 80%;
  background: var(--fg-white);
  border-radius: var(--fg-radius-md);
  box-shadow: var(--fg-shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fg-dur-normal) var(--fg-ease),
              transform var(--fg-dur-normal) var(--fg-ease-bounce);
}

.fg-tooltip.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Tooltip entrance animations per position */
.fg-tooltip[data-position="bottom"] {
  transform: translateY(-8px);
}
.fg-tooltip[data-position="bottom"].is-visible {
  transform: translateY(0);
}

.fg-tooltip[data-position="top"] {
  transform: translateY(8px);
}
.fg-tooltip[data-position="top"].is-visible {
  transform: translateY(0);
}

.fg-tooltip[data-position="left"] {
  transform: translateX(8px);
}
.fg-tooltip[data-position="left"].is-visible {
  transform: translateX(0);
}

.fg-tooltip[data-position="right"] {
  transform: translateX(-8px);
}
.fg-tooltip[data-position="right"].is-visible {
  transform: translateX(0);
}

.fg-tooltip__content {
  padding: var(--fg-space-lg);
}

.fg-tooltip__step-badge {
  display: inline-block;
  background: var(--fg-brand);
  color: var(--fg-white);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--fg-radius-full);
  margin-bottom: var(--fg-space-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fg-tooltip__title {
  font-size: var(--fg-font-base);
  font-weight: 600;
  color: var(--fg-gray-900);
  margin-bottom: var(--fg-space-xs);
  line-height: 1.4;
}

.fg-tooltip__desc {
  font-size: var(--fg-font-sm);
  color: var(--fg-gray-500);
  line-height: 1.5;
}

/* Tooltip arrow */
.fg-tooltip__arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--fg-white);
  transform: rotate(45deg);
}

.fg-tooltip[data-position="bottom"] .fg-tooltip__arrow {
  top: -6px;
  left: 50%;
  margin-left: -6px;
  box-shadow: -2px -2px 3px rgba(0,0,0,0.04);
}

.fg-tooltip[data-position="top"] .fg-tooltip__arrow {
  bottom: -6px;
  left: 50%;
  margin-left: -6px;
  box-shadow: 2px 2px 3px rgba(0,0,0,0.04);
}

.fg-tooltip[data-position="left"] .fg-tooltip__arrow {
  right: -6px;
  top: 50%;
  margin-top: -6px;
  box-shadow: 2px -2px 3px rgba(0,0,0,0.04);
}

.fg-tooltip[data-position="right"] .fg-tooltip__arrow {
  left: -6px;
  top: 50%;
  margin-top: -6px;
  box-shadow: -2px 2px 3px rgba(0,0,0,0.04);
}

/* --- Navigation Footer --- */
.fg-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--fg-space-md) var(--fg-space-lg);
  border-top: 1px solid var(--fg-gray-100);
  gap: var(--fg-space-md);
}

.fg-nav__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--fg-space-xs);
  padding: 8px 16px;
  font-size: var(--fg-font-sm);
  font-weight: 500;
  font-family: var(--fg-font);
  color: var(--fg-gray-600);
  background: var(--fg-white);
  border: 1px solid var(--fg-gray-200);
  border-radius: var(--fg-radius-sm);
  cursor: pointer;
  transition: all var(--fg-dur-fast) var(--fg-ease);
  white-space: nowrap;
  min-width: 100px;
  justify-content: center;
}

.fg-nav__btn:hover {
  background: var(--fg-gray-50);
  border-color: var(--fg-gray-300);
  color: var(--fg-gray-800);
}

.fg-nav__btn:active {
  background: var(--fg-gray-100);
}

.fg-nav__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.fg-nav__btn:disabled:hover {
  background: var(--fg-white);
  border-color: var(--fg-gray-200);
  color: var(--fg-gray-600);
}

.fg-nav__btn--next {
  background: var(--fg-brand);
  color: var(--fg-white);
  border-color: var(--fg-brand);
}

.fg-nav__btn--next:hover {
  background: var(--fg-brand-dark);
  border-color: var(--fg-brand-dark);
  color: var(--fg-white);
}

.fg-nav__btn--next:active {
  background: var(--fg-brand-dark);
}

.fg-nav__btn--next:disabled {
  opacity: 0.4;
}

.fg-nav__btn--next:disabled:hover {
  background: var(--fg-brand);
  border-color: var(--fg-brand);
  color: var(--fg-white);
}

/* Dots */
.fg-nav__dots {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.fg-nav__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: var(--fg-gray-300);
  cursor: pointer;
  padding: 0;
  transition: all var(--fg-dur-fast) var(--fg-ease);
}

.fg-nav__dot:hover {
  background: var(--fg-gray-400);
  transform: scale(1.3);
}

.fg-nav__dot.is-active {
  background: var(--fg-brand);
  transform: scale(1.2);
}

.fg-nav__dot.is-completed {
  background: var(--fg-brand-light);
}

/* --- Watermark --- */
.fg-watermark {
  text-align: center;
  padding: var(--fg-space-sm);
  font-size: 0.6875rem;
  color: var(--fg-gray-400);
  border-top: 1px solid var(--fg-gray-100);
}

.fg-watermark strong {
  color: var(--fg-gray-500);
  font-weight: 600;
}

/* --- Completion Screen --- */
.fg-complete {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  animation: fg-fade-in var(--fg-dur-normal) var(--fg-ease);
}

@keyframes fg-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fg-complete__card {
  background: var(--fg-white);
  border-radius: var(--fg-radius-lg);
  padding: var(--fg-space-2xl);
  text-align: center;
  box-shadow: var(--fg-shadow-xl);
  max-width: 400px;
  width: 90%;
  animation: fg-scale-in var(--fg-dur-slow) var(--fg-ease-bounce);
}

@keyframes fg-scale-in {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.fg-complete__icon {
  color: var(--fg-brand);
  margin-bottom: var(--fg-space-lg);
}

.fg-complete h2 {
  font-size: var(--fg-font-xl);
  color: var(--fg-gray-900);
  margin-bottom: var(--fg-space-sm);
}

.fg-complete p {
  color: var(--fg-gray-500);
  margin-bottom: var(--fg-space-xl);
}

.fg-complete__actions {
  display: flex;
  gap: var(--fg-space-sm);
  justify-content: center;
}

/* --- Buttons --- */
.fg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fg-space-xs);
  padding: 10px 24px;
  font-size: var(--fg-font-base);
  font-weight: 500;
  font-family: var(--fg-font);
  border: none;
  border-radius: var(--fg-radius-sm);
  cursor: pointer;
  transition: all var(--fg-dur-fast) var(--fg-ease);
}

.fg-btn--primary {
  background: var(--fg-brand);
  color: var(--fg-white);
}

.fg-btn--primary:hover {
  background: var(--fg-brand-dark);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  body {
    padding: var(--fg-space-sm);
  }

  .fg-player {
    border-radius: var(--fg-radius-md);
  }

  .fg-tooltip {
    width: 250px;
  }

  .fg-header__title {
    font-size: var(--fg-font-base);
  }

  .fg-nav__btn {
    min-width: auto;
    padding: 8px 12px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0;
  }

  .fg-player {
    border-radius: 0;
    min-height: 100vh;
    justify-content: space-between;
  }

  .fg-tooltip {
    width: 220px;
    max-width: 70%;
  }

  .fg-tooltip__content {
    padding: var(--fg-space-md);
  }

  .fg-nav__btn span {
    display: none;
  }

  .fg-nav__btn {
    min-width: 40px;
    padding: 8px;
  }

  .fg-header {
    padding: var(--fg-space-sm) var(--fg-space-md);
  }

  .fg-nav {
    padding: var(--fg-space-sm) var(--fg-space-md);
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .fg-hotspot__pulse {
    animation: none;
  }

  .fg-spinner {
    animation-duration: 1.5s;
  }

  .fg-tooltip,
  .fg-overlay,
  .fg-screenshot,
  .fg-progress__bar,
  .fg-hotspot {
    transition-duration: 0ms;
  }
}
