/* base.css — Base : reset, page, barre du haut, contenu, squelettes de chargement */

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


html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

/* ===== TOP BAR ===== */
#top-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--top-height);
  background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-500) 100%);
  color: var(--white);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

#app-title {
  font-size: 1.05rem; font-weight: 700; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#search-container {
  flex: 1;
}

#search-input {
  width: 100%;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--white);
  font-size: .88rem;
  outline: none;
  transition: background .2s;
}
#search-input::placeholder { color: rgba(255,255,255,.6); }
#search-input:focus { background: rgba(255,255,255,.25); }

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: transparent; border: none; color: var(--white); cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.icon-btn:active { background: rgba(255,255,255,.2); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:disabled { opacity: .5; cursor: not-allowed; }

#drive-btn { position: relative; }
#drive-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--slate-400);
  border: 2px solid var(--navy-700);
}
#drive-dot.connected { background: var(--green-400); }

#sync-btn.syncing svg { animation: sync-spin .9s linear infinite; }
@keyframes sync-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== MAIN CONTENT ===== */
#main-content {
  position: fixed;
  top: var(--top-height);
  bottom: var(--nav-height);
  left: 0; right: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Transition douce lors du changement d'onglet / ouverture d'une fiche */
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
#main-content.view-fade-in { animation: viewFadeIn .22s ease; }

/* ===== SKELETON DE CHARGEMENT ===== */
@keyframes skeletonShimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
.skeleton-card, .skeleton-hero {
  background: linear-gradient(90deg, var(--color-border) 25%, var(--mist-50) 37%, var(--color-border) 63%);
  background-size: 400% 100%;
  animation: skeletonShimmer 1.4s ease infinite;
}
.skeleton-card { height: 96px; border-radius: var(--radius); }
.skeleton-hero { height: 118px; margin-bottom: 12px; }

/* ===== PULL TO REFRESH ===== */
#pull-refresh {
  position: fixed;
  top: var(--top-height);
  left: 50%;
  width: 36px; height: 36px;
  transform: translate(-50%, -48px);
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  z-index: 96;
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
  color: var(--color-light);
  font-size: 1.1rem;
}
#pull-refresh.visible { opacity: 1; }
#pull-refresh.ready { color: var(--color-primary); }
#pull-refresh.loading .pull-refresh-spinner { animation: sync-spin .8s linear infinite; }
