/**
 * Mesure Chantier — finitions style Apple (iOS PWA + Capacitor)
 * Activé via .is-ios-app sur <html> (voir client/platform-ios.js)
 */

.is-ios-app {
  --font-ui: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
    system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Monaco, monospace;
  --app-radius: 12px;
  --app-radius-sm: 10px;
  --app-tabbar-h: 49px;
  --app-topbar-h: 44px;
  --app-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ios-separator: rgba(255, 255, 255, 0.09);
  --ios-vibrancy: rgba(15, 18, 25, 0.82);
}

.is-ios-app body {
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
}

/* ——— Navigation (frosted bars) ——— */

.is-ios-app .app-topbar {
  min-height: calc(var(--app-topbar-h) + env(safe-area-inset-top));
  padding-bottom: 0;
  align-items: flex-end;
  padding-top: max(4px, env(safe-area-inset-top));
  background: var(--ios-vibrancy);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--ios-separator);
}

.is-ios-app .app-topbar__marque {
  padding-bottom: 8px;
}

.is-ios-app .app-topbar__logo {
  height: 26px;
  width: auto;
}

.is-ios-app .app-topbar__nom {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.is-ios-app .app-topbar__editeur {
  display: none;
}

.is-ios-app .app-topbar__tag {
  font-size: 0.8125rem;
}

.is-ios-app .app-frame .jobber-pill {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8125rem;
  margin-bottom: 8px;
}

.is-ios-app .app-tabbar {
  min-height: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom));
  padding-top: 4px;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
  background: var(--ios-vibrancy);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--ios-separator);
  gap: 0;
}

.is-ios-app .app-tab {
  min-height: 44px;
  padding: 4px 2px 2px;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 0;
  -webkit-tap-highlight-color: transparent;
}

.is-ios-app .app-tab--active {
  color: var(--app-accent);
  background: transparent;
  font-weight: 600;
}

.is-ios-app .app-tab__badge {
  top: 4px;
  right: calc(50% - 20px);
  width: 5px;
  height: 5px;
}

.is-ios-app .app-main {
  padding-top: var(--space-4);
  padding-bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom) + var(--space-5));
}

/* ——— Titres (Large Title lite) ——— */

.is-ios-app .vue-mesurer__hero {
  border-bottom: none;
  margin-bottom: var(--space-4);
  padding-bottom: 0;
}

.is-ios-app .vue-mesurer__hero-overline {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--app-accent);
}

.is-ios-app .vue-mesurer__hero-titre {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.is-ios-app .vue-mesurer__hero-texte {
  font-size: 1rem;
  line-height: 1.45;
}

/* ——— Segmented control (mode gouttières / toiture) ——— */

.is-ios-app .produit-selecteur {
  display: flex;
  gap: 2px;
  margin: var(--space-4) 0;
  padding: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.is-ios-app .produit-carte {
  flex: 1;
  min-height: 44px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  transition:
    background 0.2s var(--app-ease),
    box-shadow 0.2s var(--app-ease);
}

.is-ios-app .produit-carte--actif {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  border: none;
}

.is-ios-app .produit-carte__icone {
  display: none;
}

.is-ios-app .produit-carte__label {
  font-size: 0.9375rem;
  font-weight: 600;
  width: 100%;
  text-align: center;
}

.is-ios-app .produit-carte__detail {
  display: none;
}

@media (max-width: 420px) {
  .is-ios-app .produit-selecteur {
    flex-direction: row;
  }
}

/* ——— Formulaires & boutons ——— */

.is-ios-app .app-frame .saisie {
  border: none;
  border-radius: 12px;
  background: var(--app-surface-2);
}

.is-ios-app .app-frame .saisie__champ {
  min-height: 44px;
  padding: 12px 14px;
  font-size: 1.0625rem;
  border-radius: 10px;
  border-color: rgba(255, 255, 255, 0.1);
}

.is-ios-app .app-frame .saisie__champ:focus {
  box-shadow: 0 0 0 4px var(--app-accent-soft);
}

.is-ios-app .app-frame .bouton-action,
.is-ios-app .reglages__btn {
  min-height: 50px;
  padding: 0 var(--space-5);
  font-size: 1.0625rem;
  font-weight: 600;
  border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.12s var(--app-ease),
    opacity 0.12s var(--app-ease),
    background 0.2s var(--app-ease);
}

.is-ios-app .app-frame .bouton-action:active:not(:disabled),
.is-ios-app .reglages__btn:active,
.is-ios-app .app-tab:active,
.is-ios-app .produit-carte:active {
  transform: scale(0.98);
  opacity: 0.88;
}

.is-ios-app .app-frame .bouton-action--filet,
.is-ios-app .app-frame .bouton-action--secondaire {
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  border: none;
}

/* ——— Grouped lists (Réglages) ——— */

.is-ios-app .reglages {
  gap: var(--space-5);
}

.is-ios-app .reglages__carte {
  padding: var(--space-4) var(--space-5);
  border: none;
  border-radius: 12px;
  background: var(--app-surface-2);
}

.is-ios-app .reglages__carte-titre {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--app-text-muted);
}

.is-ios-app .reglages__select,
.is-ios-app .app-frame .financier__select,
.is-ios-app .app-frame .financier__champ {
  min-height: 44px;
  font-size: 1.0625rem;
  border-radius: 10px;
  border-color: rgba(255, 255, 255, 0.1);
  appearance: none;
  -webkit-appearance: none;
}

.is-ios-app .reglages__liste li {
  border-bottom-color: var(--ios-separator);
}

/* ——— Relevé · chiffres hero ——— */

.is-ios-app .app-frame #vue-releve .instrument__valeur {
  font-size: clamp(2.75rem, 14vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.is-ios-app .app-frame #vue-releve .instrument__valeur--pi {
  font-size: clamp(1.5rem, 8vw, 2rem);
  font-weight: 600;
}

.is-ios-app .app-frame #vue-releve .releve-hero {
  border: none;
  border-radius: 12px;
  background: var(--app-surface-2);
}

.is-ios-app .app-empty {
  border: none;
  border-radius: 12px;
  background: var(--app-surface-2);
}

.is-ios-app .app-frame .calibrage {
  border: none;
  border-radius: 12px;
  background: var(--app-surface-2);
}

.is-ios-app .app-frame .financier__produit {
  min-height: 44px;
  border-radius: 10px;
}

.is-ios-app .app-frame .financier__onglet {
  min-height: 44px;
  border-radius: 10px;
  font-weight: 500;
}

.is-ios-app .app-frame .financier__onglet--actif {
  font-weight: 600;
}

.is-ios-app .jobber-app__modal {
  border-radius: 14px;
}

.is-ios-app .jobber-app__btn {
  min-height: 50px;
  border-radius: 12px;
  font-weight: 600;
}

/* ——— Pas d’effets hover sur tactile ——— */

@media (hover: none) {
  .is-ios-app .produit-carte:hover,
  .is-ios-app .app-frame .bouton-action:hover,
  .is-ios-app .reglages__btn:hover {
    transform: none;
    opacity: 1;
    background: inherit;
    border-color: inherit;
  }

  .is-ios-app .produit-carte--actif:hover {
    background: rgba(255, 255, 255, 0.12);
  }

  .is-ios-app .app-frame .bouton-action:hover {
    background: var(--app-accent);
  }

  .is-ios-app .app-frame .bouton-action--filet:hover,
  .is-ios-app .app-frame .bouton-action--secondaire:hover {
    background: rgba(255, 255, 255, 0.06);
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-ios-app .app-frame .bouton-action:active:not(:disabled),
  .is-ios-app .reglages__btn:active,
  .is-ios-app .app-tab:active,
  .is-ios-app .produit-carte:active {
    transform: none;
  }
}
