/* =========================================
   HomeFit Routines - Modern Dark Theme
   Colors: Orange #f97316, Black #0a0a0a, Gray tones
   ========================================= */

/* =========================================
   Custom Fonts
   ========================================= */
@font-face {
  font-family: 'Josefin Sans';
  src: url('assets/fonts/JosefinSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Josefin Sans';
  src: url('assets/fonts/JosefinSans-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Josefin Sans';
  src: url('assets/fonts/JosefinSans-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Josefin Sans';
  src: url('assets/fonts/JosefinSans-BoldItalic.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Arial Narrow';
  src: url('assets/fonts/ARIALN.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #f97316;
  --primary-hover: #ea580c;
  --primary-light: #fdba74;
  --primary-glow: rgba(249, 115, 22, 0.35);
  
  --bg-base: #0a0a0a;
  --bg-elevated: #111111;
  --bg-card: #151515;
  --bg-card-hover: #1a1a1a;
  --bg-input: #1f1f1f;
  
  --text-primary: #ffffff;
  --text-secondary: #a1a1a1;
  --text-muted: #6b6b6b;
  
  --border: #262626;
  --border-light: #333333;
  
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 40px var(--primary-glow);
  
  --transition: 200ms ease;
  --transition-slow: 400ms ease;

  --font-primary: 'Josefin Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-description: 'Arial Narrow', Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* =========================================
   Header
   ========================================= */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.logo-img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
}

.logo-accent {
  color: var(--primary);
}

.nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.phone-qr {
  position:absolute;
  right: 0;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.lang-toggle:hover {
  border-color: var(--primary);
}

.lang-option {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition);
}

.lang-option.active {
  color: var(--primary);
}

.lang-separator {
  color: var(--text-muted);
}

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}

.mobile-menu-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: transform var(--transition), opacity var(--transition);
}

.mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 24px;
  z-index: 99;
  flex-direction: column;
  gap: 16px;
}

.mobile-menu.active {
  display: flex;
}

.mobile-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.mobile-lang {
  display: flex;
  gap: 12px;
  padding-top: 8px;
}

.lang-btn {
  flex: 1;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.lang-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* =========================================
   Hero Section
   ========================================= */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 80px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--primary-glow), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(249, 115, 22, 0.1), transparent),
    radial-gradient(ellipse 60% 40% at 0% 80%, rgba(249, 115, 22, 0.08), transparent);
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 700px;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 24px;
}

.hero-title span {
  display: block;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-family: var(--font-description);
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 500px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 50px var(--primary-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-card);
  border-color: var(--border-light);
}

.hero-stats {
  display: flex;
  gap: 48px;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* =========================================
   How It Works
   ========================================= */
.how-it-works {
  padding: 100px 0;
  background: var(--bg-elevated);
}

.section-title {
  font-size: 2.25rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.section-subtitle {
  font-family: var(--font-description);
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 48px;
}

.steps {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.step {
  flex: 1;
  min-width: 220px;
  max-width: 280px;
  text-align: center;
  padding: 32px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  transition: all var(--transition);
}

.step:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
}

.step-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.step-number {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  background: var(--bg-base);
  border: 2px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
}

.step h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.step p {
  font-family: var(--font-description);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.step-connector {
  display: flex;
  align-items: center;
  padding-top: 60px;
}

.connector-line {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, var(--border), var(--primary), var(--border));
}

/* =========================================
   Routines Section
   ========================================= */
.routines {
  padding: 100px 0;
}

.routines-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 40px;
}

.routines-header .section-title,
.routines-header .section-subtitle {
  text-align: left;
  margin-bottom: 0;
}

.routines-header .section-subtitle {
  margin-top: 8px;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

.filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Routines Grid */
.routines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
}

/* Routine Card */
.routine-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  animation: fadeUp 0.5s ease forwards;
  opacity: 0;
  position: relative;
}

.free-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: auto;
  pointer-events: none;
  z-index: 1;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.routine-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.routine-card.hidden {
  display: none;
}

.card-header {
  display: flex;
  gap: 20px;
  padding: 24px;
}

.card-qr {
  width: 100px;
  height: 100px;
  background: white;
  border-radius: var(--radius-md);
  padding: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-qr canvas {
  width: 100% !important;
  height: 100% !important;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.card-badge.beginner {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.card-badge.intermediate {
  background: rgba(234, 179, 8, 0.15);
  color: var(--warning);
}

.card-badge.advanced {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-desc {
  font-family: var(--font-description);
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  gap: 24px;
  padding: 16px 24px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.card-meta svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* =========================================
   Modal
   ========================================= */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

.modal-container {
  position: relative;
  max-width: 900px;
  max-height: 90vh;
  width: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

.modal-container::-webkit-scrollbar {
  width: 8px;
}

.modal-container::-webkit-scrollbar-track {
  background: transparent;
}

.modal-container::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

.modal-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  padding: 32px 40px;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
  z-index: 20;
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.modal-qr-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.modal-qr {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  width: fit-content;
}

.modal-scan-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 12px;
}

.deeplink-btn {
  display: none;
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bg-base);
  background: var(--primary);
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.2s;
}

.deeplink-btn:hover {
  opacity: 0.85;
}

@media (max-width: 768px) {
  .deeplink-btn {
    display: inline-block;
  }
}

.qr-container {
  margin-bottom: 12px;
}

.qr-container canvas {
  width: 100% !important;
  height: auto !important;
  max-width: 230px;
}

.qr-hint {
  font-size: 0.85rem;
  color: #666;
  margin: 0;
}

.modal-info {
  padding-right: 24px;
}

.modal-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.modal-badge.beginner {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.modal-badge.intermediate {
  background: rgba(234, 179, 8, 0.15);
  color: var(--warning);
}

.modal-badge.advanced {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.modal-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-desc {
  font-family: var(--font-description);
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.7;
}

.modal-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 32px;
}

.modal-stat {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-stat svg {
  color: var(--primary);
}

.modal-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  display: block;
}

.modal-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.modal-section {
  margin-bottom: 28px;
}

.modal-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.tag.none {
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.3);
}

.schedule {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.schedule-day {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.schedule-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.schedule-day-name {
  font-weight: 600;
}

.schedule-day-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.schedule-exercises {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.exercise-chip {
  padding: 4px 10px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.exercise-chip.superset {
  background: rgba(249, 115, 22, 0.15);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.routines-section{
  margin-bottom: 40px;
}

/* =========================================
   Footer
   ========================================= */
.footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
}

.footer-name {
  font-weight: 700;
  font-size: 1.1rem;
  display: block;
}

.footer-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.footer-made {
  color: var(--text-muted);
}

.footer-bottom {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 900px) {
  .modal-header {
    grid-template-columns: 1fr;
  }

  .modal-qr-wrapper {
    align-items: center;
  }

  .modal-qr {
    max-width: 280px;
  }

  .modal-scan-hint {
    text-align: center;
  }

  .modal-content {
    padding: 32px 24px;
  }
}

@media (max-width: 768px) {
  .nav {
    display: none;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  .hero-title {
    font-size: 2.25rem;
  }
  
  .hero-stats {
    gap: 32px;
  }
  
  .steps {
    flex-direction: column;
    align-items: center;
  }
  
  .step-connector {
    transform: rotate(90deg);
    padding: 0;
  }
  
  .routines-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-groups {
    align-items: flex-start;
    width: 100%;
  }

  .filter-group {
    flex-wrap: wrap;
  }

  .routines-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-stats {
    flex-direction: column;
    gap: 16px;
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }
  
  .card-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .card-footer {
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .hero-actions {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Animation delays for cards */
.routine-card:nth-child(1) { animation-delay: 0.05s; }
.routine-card:nth-child(2) { animation-delay: 0.1s; }
.routine-card:nth-child(3) { animation-delay: 0.15s; }
.routine-card:nth-child(4) { animation-delay: 0.2s; }
.routine-card:nth-child(5) { animation-delay: 0.25s; }
.routine-card:nth-child(6) { animation-delay: 0.3s; }
.routine-card:nth-child(7) { animation-delay: 0.35s; }
.routine-card:nth-child(8) { animation-delay: 0.4s; }
.routine-card:nth-child(9) { animation-delay: 0.45s; }
.routine-card:nth-child(10) { animation-delay: 0.5s; }
