/* ============================
   OHISS - Style principal
   ============================ */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --orange: #FF5722;
  --orange-light: #FBE9E7;
  --orange-dark: #BF360C;
  --orange-gradient: linear-gradient(135deg, #FF5722, #FF8A65);
  --green: #4CAF50;
  --green-light: #E8F5E9;
  --green-dark: #1B5E20;
  --blue: #2196F3;
  --blue-light: #E3F2FD;
  --blue-dark: #0D47A1;
  --purple: #9C27B0;
  --purple-light: #F3E5F5;
  --bg: #f5f5f5;
  --white: #ffffff;
  --text: #1a1a1a;
  --text-mid: #666;
  --text-light: #aaa;
  --border: #eee;
  --dark: #1a1a1a;
  --dark-2: #2a2a2a;
  --dark-3: #333;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  overflow-x: hidden;
  overscroll-behavior: none;
}

body { padding-bottom: 80px; min-height: 100vh; }

/* === HEADER === */
.app-header {
  background: var(--orange);
  padding: env(safe-area-inset-top, 16px) 18px 18px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
  color: white;
  position: relative;
}

.app-header h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.app-header .sub { font-size: 12px; color: rgba(255,255,255,0.8); margin-top: 2px; }
.app-header .header-top { display: flex; align-items: center; justify-content: space-between; }
.app-header .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.back-btn {
  background: rgba(255,255,255,0.2);
  border: none; color: white;
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; margin-right: 10px;
}

.header-row { display: flex; align-items: center; }

/* === NAVBAR === */
.navbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white;
  display: flex; justify-content: space-around;
  padding: 10px 0;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.nav-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 4px 12px;
  text-decoration: none; color: var(--text-light);
  cursor: pointer; background: none; border: none;
  font-family: inherit; min-width: 50px;
}
.nav-item .icon { font-size: 22px; line-height: 1; }
.nav-item .label { font-size: 9px; font-weight: 600; }
.nav-item.active { color: var(--orange); }

/* === CONTENT === */
.content { padding: 14px; }

.section-label {
  font-size: 11px; font-weight: 700;
  color: var(--text-light); text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 8px; margin-top: 14px;
}
.section-label:first-child { margin-top: 0; }

/* === CARDS === */
.card {
  background: white; border-radius: 16px;
  padding: 14px; border: 1px solid var(--border);
  margin-bottom: 10px;
}

.stat-card {
  background: white; border-radius: 14px;
  padding: 12px; border: 1px solid var(--border);
}
.stat-card .stat-val { font-size: 22px; font-weight: 800; color: var(--text); }
.stat-card .stat-unit { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.stat-card .stat-icon { font-size: 18px; margin-bottom: 4px; }
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.orange { color: var(--orange); }
.green { color: var(--green); }
.blue { color: var(--blue); }
.purple { color: var(--purple); }

/* === BUTTONS === */
.btn {
  background: var(--orange);
  color: white; border: none;
  border-radius: 12px;
  padding: 13px 16px; width: 100%;
  font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  text-align: center;
  transition: transform 0.08s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); opacity: 0.9; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-outline { background: white; color: var(--orange); border: 2px solid var(--orange); }
.btn-success { background: var(--green); }
.btn-small { padding: 8px 14px; font-size: 12px; width: auto; }
.btn-ghost { background: transparent; color: var(--text-mid); padding: 8px; }

/* === FAB (Floating Action Button) === */
.fab {
  position: fixed; bottom: 80px; right: 16px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--orange); color: white;
  border: none; font-size: 28px;
  box-shadow: 0 4px 16px rgba(255,87,34,0.4);
  cursor: pointer; z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(0.92); }

/* === EXERCISE LIST === */
.exo-card {
  background: white; border-radius: 14px;
  padding: 11px 13px; display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--border); margin-bottom: 8px;
  cursor: pointer;
}
.exo-card:active { background: #fafafa; }

.exo-thumb {
  width: 56px; height: 56px; border-radius: 12px;
  background: var(--orange-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.exo-info { flex: 1; min-width: 0; }
.exo-name { font-size: 13px; font-weight: 700; color: var(--text); }
.exo-muscle { font-size: 10px; color: var(--orange); font-weight: 600; margin-top: 1px; }
.exo-detail { font-size: 10px; color: var(--text-light); margin-top: 2px; }
.exo-tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.tag {
  font-size: 9px; padding: 2px 7px; border-radius: 6px;
  font-weight: 700;
}
.tag-h { background: var(--orange-light); color: var(--orange-dark); }
.tag-k { background: var(--green-light); color: var(--green-dark); }
.tag-e { background: var(--blue-light); color: var(--blue-dark); }
.tag-aucun { background: #f0f0f0; color: #555; }

.diff-dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; margin-right: 3px;
}
.diff-facile { background: var(--green); }
.diff-moyen { background: #FF9800; }
.diff-difficile { background: #F44336; }

/* === FILTERS === */
.filter-scroll {
  display: flex; gap: 7px;
  overflow-x: auto; padding-bottom: 6px;
  scrollbar-width: none;
  margin-bottom: 10px;
}
.filter-scroll::-webkit-scrollbar { display: none; }

.chip {
  background: white; border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 13px;
  font-size: 11px; font-weight: 600;
  color: var(--text-mid); white-space: nowrap;
  cursor: pointer; font-family: inherit;
}
.chip.active { background: var(--orange); border-color: var(--orange); color: white; }

.mat-row { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.mat-chip {
  border-radius: 8px; padding: 6px 11px;
  font-size: 11px; font-weight: 700;
  cursor: pointer; font-family: inherit; border: 1px solid transparent;
}
.mat-chip.active.all { background: var(--orange); color: white; border-color: var(--orange); }
.mat-chip.all { background: white; color: var(--text-mid); border-color: var(--border); }
.mat-chip.h { background: var(--orange-light); color: var(--orange-dark); border-color: #FFCCBC; }
.mat-chip.k { background: var(--green-light); color: var(--green-dark); border-color: #C8E6C9; }
.mat-chip.e { background: var(--blue-light); color: var(--blue-dark); border-color: #BBDEFB; }
.mat-chip.aucun { background: #f0f0f0; color: #555; border-color: #ddd; }
.mat-chip.active.h { background: var(--orange-dark); color: white; }
.mat-chip.active.k { background: var(--green-dark); color: white; }
.mat-chip.active.e { background: var(--blue-dark); color: white; }
.mat-chip.active.aucun { background: #555; color: white; }

/* === SEARCH === */
.search-bar {
  background: rgba(255,255,255,0.2);
  border-radius: 12px; padding: 9px 14px;
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px;
}
.search-bar input {
  background: transparent; border: none; outline: none;
  color: white; font-size: 13px; flex: 1; font-family: inherit;
}
.search-bar input::placeholder { color: rgba(255,255,255,0.7); }

/* === MODAL === */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end;
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.modal-bg.show { opacity: 1; pointer-events: auto; }
.modal {
  background: white; width: 100%;
  border-radius: 24px 24px 0 0;
  padding: 18px 18px calc(env(safe-area-inset-bottom, 0px) + 20px);
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  max-height: 90vh; overflow-y: auto;
}
.modal-bg.show .modal { transform: translateY(0); }
.modal-handle {
  width: 40px; height: 4px;
  background: #ddd; border-radius: 2px;
  margin: 0 auto 14px;
}
.modal-title { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.modal-subtitle { font-size: 12px; color: var(--orange); font-weight: 600; margin-bottom: 14px; }
.modal-close {
  position: absolute; right: 16px; top: 16px;
  width: 30px; height: 30px; border-radius: 50%;
  background: #f0f0f0; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer;
}

/* === FIELDS === */
.field { margin-bottom: 14px; }
.field-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-mid); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 7px;
}
.mode-toggle { display: flex; gap: 6px; }
.mode-btn {
  flex: 1; padding: 9px;
  border-radius: 10px; font-size: 12px; font-weight: 700;
  border: 1.5px solid var(--border); background: white;
  color: var(--text-mid); cursor: pointer; font-family: inherit;
}
.mode-btn.active {
  background: var(--orange-light);
  border-color: var(--orange); color: var(--orange);
}

.stepper {
  display: flex; align-items: center; gap: 0;
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden;
}
.stepper button {
  width: 36px; height: 38px;
  background: var(--bg); border: none;
  color: var(--orange); font-size: 18px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.stepper button:active { background: var(--orange-light); }
.stepper-val {
  flex: 1; text-align: center;
  font-size: 15px; font-weight: 700;
  background: white; padding: 6px 0;
}
.stepper-val small { display: block; font-size: 9px; color: var(--text-light); font-weight: 500; }
.fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.pause-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.pchip {
  padding: 5px 11px; border-radius: 8px;
  font-size: 11px; font-weight: 700;
  border: 1px solid var(--border); color: var(--text-mid);
  background: white; cursor: pointer; font-family: inherit;
}
.pchip.active { background: var(--orange); border-color: var(--orange); color: white; }

input[type="number"], input[type="text"], input[type="date"], input[type="time"] {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit;
  outline: none; -webkit-appearance: none;
}
input:focus { border-color: var(--orange); }

/* === ANIMATION BOX === */
.anim-box {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #FBE9E7, #FFE0B2);
  display: flex; align-items: center; justify-content: center;
}
.anim-box-big {
  width: 100%; height: 220px;
  background: linear-gradient(135deg, #FBE9E7, #FFE0B2);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}

/* === EMPTY STATE === */
.empty {
  text-align: center; padding: 40px 20px;
  color: var(--text-light);
}
.empty-icon { font-size: 48px; margin-bottom: 10px; opacity: 0.5; }
.empty-text { font-size: 13px; }

/* === BADGE === */
.badge {
  background: var(--orange); color: white;
  font-size: 10px; font-weight: 700;
  border-radius: 20px; padding: 3px 9px;
}
.badge-green { background: var(--green); }
.badge-blue { background: var(--blue); }

/* === PLANNING ITEM === */
.planning-item {
  background: white; border-radius: 14px;
  padding: 12px; border: 1px solid var(--border);
  margin-bottom: 8px; display: flex; align-items: center; gap: 12px;
}
.planning-thumb {
  width: 50px; height: 50px; border-radius: 10px;
  background: var(--orange-light); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.planning-info { flex: 1; min-width: 0; }
.planning-name { font-size: 13px; font-weight: 700; }
.planning-config { font-size: 11px; color: var(--text-mid); margin-top: 2px; }
.del-btn {
  background: none; border: none;
  color: var(--text-light); font-size: 16px;
  cursor: pointer; padding: 6px;
}

/* === TIMER PAGE === */
.timer-page {
  background: var(--dark); color: white;
  min-height: 100vh; padding-bottom: 0;
  position: fixed; inset: 0; z-index: 300;
  overflow-y: auto;
}
.timer-header {
  padding: env(safe-area-inset-top, 16px) 20px 8px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
  display: flex; align-items: center; justify-content: space-between;
}
.timer-back {
  background: rgba(255,255,255,0.1); border: none;
  color: var(--orange); font-size: 12px; font-weight: 700;
  padding: 8px 14px; border-radius: 20px;
  cursor: pointer; font-family: inherit;
}
.seance-info { text-align: right; }
.seance-info .title { font-size: 12px; font-weight: 700; }
.seance-info .prog { font-size: 10px; color: #888; margin-top: 1px; }
.timer-exo-section { padding: 8px 20px 0; }
.timer-badge {
  display: inline-block; background: var(--orange);
  color: white; font-size: 10px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px; margin-bottom: 8px;
}
.timer-exo-name {
  color: white; font-size: 22px; font-weight: 800;
  line-height: 1.15;
}
.timer-exo-sub { color: #888; font-size: 11px; margin-top: 4px; }

.timer-prog-wrap { padding: 14px 20px 0; }
.timer-prog-track {
  background: var(--dark-3); border-radius: 10px;
  height: 5px; overflow: hidden;
}
.timer-prog-fill {
  background: var(--orange); height: 100%;
  transition: width 0.3s; width: 0;
}

.timer-circle-section {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 0 16px;
}
.timer-circle-wrap { position: relative; width: 220px; height: 220px; }
.timer-text {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center; width: 100%;
}
.timer-phase {
  font-size: 11px; font-weight: 700;
  color: var(--orange); text-transform: uppercase;
  letter-spacing: 1.5px;
}
.timer-phase.pause { color: var(--green); }
.timer-count {
  font-size: 60px; font-weight: 800;
  color: white; line-height: 1;
  margin-top: 6px; font-variant-numeric: tabular-nums;
}
.timer-of { font-size: 11px; color: #555; margin-top: 4px; }

.serie-indicator {
  margin-top: 14px; display: flex; gap: 8px;
}
.serie-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--dark-3);
}
.serie-dot.done { background: var(--green); }
.serie-dot.active { background: var(--orange); }

.timer-controls {
  display: flex; align-items: center; justify-content: center;
  gap: 22px; padding: 16px 20px;
}
.tctrl-sm {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--dark-2); border: none;
  color: #aaa; font-size: 22px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.tctrl-main {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--orange); border: none;
  color: white; font-size: 34px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(255,87,34,0.4);
}
.tctrl-main:active { transform: scale(0.93); }

.next-up {
  margin: 8px 16px; background: var(--dark-2);
  border-radius: 14px; padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
}
.next-up-label { font-size: 9px; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: 0.8px; }
.next-up-name { font-size: 12px; font-weight: 700; color: #ddd; margin-top: 2px; }
.next-up-detail { font-size: 10px; color: #666; margin-top: 1px; }
.next-up-thumb {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--dark-3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.done-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 30px; min-height: 60vh; text-align: center;
}
.done-emoji { font-size: 80px; margin-bottom: 16px; }
.done-title { font-size: 24px; font-weight: 800; color: white; margin-bottom: 8px; }
.done-sub { font-size: 14px; color: #888; margin-bottom: 24px; }

/* === RUNNING === */
.run-card {
  background: white; border-radius: 14px;
  padding: 14px; margin-bottom: 8px;
  border: 1px solid var(--border);
}
.run-date { font-size: 11px; color: var(--text-light); font-weight: 600; }
.run-row { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.run-dist { font-size: 20px; font-weight: 800; color: var(--orange); }
.run-time { font-size: 13px; color: var(--text-mid); }
.run-pace { margin-left: auto; font-size: 11px; color: var(--text-light); }

/* === LOADER === */
.loader {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === TOAST === */
.toast {
  position: fixed; bottom: 100px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--dark); color: white;
  padding: 11px 20px; border-radius: 30px;
  font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: all 0.3s;
  z-index: 500;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.success { background: var(--green); }
.toast.error { background: #F44336; }

/* Utility */
.flex { display: flex; }
.flex-1 { flex: 1; }
.space-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.center { text-align: center; }

/* === ANIMATIONS SVG === */
@keyframes curl-arm { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-120deg); } }
@keyframes squat-body { 0%,100% { transform: translateY(0); } 50% { transform: translateY(14px); } }
@keyframes pushup-body { 0%,100% { transform: translateY(0); } 50% { transform: translateY(10px); } }
@keyframes swing-arm { 0%,100% { transform: rotate(-70deg); } 50% { transform: rotate(70deg); } }
@keyframes lateral-arms { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-80deg); } }
@keyframes frontal-arms { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-90deg); } }
@keyframes press-arms { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-20px); } }
@keyframes row-arm { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-15px); } }
@keyframes plank-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }
@keyframes crunch-body { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(-15deg); } }
@keyframes twist-body { 0%,100% { transform: rotate(-30deg); } 50% { transform: rotate(30deg); } }
@keyframes jump-body { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-20px); } }
@keyframes lunge-body { 0%,100% { transform: translateY(0); } 50% { transform: translateY(12px); } }
@keyframes hipthrust-body { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }
@keyframes bridge-pulse { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes kickback-leg { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(40deg); } }
@keyframes calf-body { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes deadlift-body { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(8px) rotate(-25deg); } }
@keyframes mountain-leg { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-30deg); } }
@keyframes oiseau-arms { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-50deg); } }
@keyframes superman-pulse { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes burpee-cycle { 0%,100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(20px) scaleY(0.6); } }
@keyframes halo-rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes jack-spread { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-45deg); } }
@keyframes facepull-arm { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-10px); } }
@keyframes bench-arm { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes fly-arm { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-70deg); } }
@keyframes shrug-body { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes legraise-leg { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-80deg); } }
@keyframes flutter-leg { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
