/* =============================================
   APP PAGES — MyJeunesse PWA
   Fond blanc | Textes sombres | Boutons roses
   ============================================= */

/* ─── Variables locales ─── */
:root {
  --app-bg: #ffffff;
  --app-bg-light: #f8f9fc;
  --app-bg-section: #f0f2f8;
  --app-text-primary: #1a1a2e;
  --app-text-secondary: #555555;
  --app-text-muted: #999999;
  --app-primary: #E91E63;
  --app-primary-light: #F48FB1;
  --app-primary-dark: #C2185B;
  --app-border: #e8eaf0;
  --app-card-bg: #ffffff;
  --app-card-shadow: 0 2px 12px rgba(0,0,0,0.06);
  --bottom-nav-h: 64px;
  --header-h: 56px;
}

/* =============================================
   HEADER COMMUN
   ============================================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--app-border);
}

.app-header .header-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--app-primary);
}

.app-header .header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-header .header-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--app-text-secondary);
  transition: background 0.2s;
}

.app-header .header-btn:active {
  background: var(--app-bg-light);
}

.app-header .header-btn .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: var(--app-primary);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-header .header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

/* ─── Header avec flèche retour ─── */
.app-header .header-back {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--app-primary);
  font-size: 1rem;
  font-weight: 600;
  padding: 8px;
}

.app-header .header-back svg {
  flex-shrink: 0;
}

/* =============================================
   BOTTOM NAVIGATION
   ============================================= */
.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #ffffff;
  border-top: 1px solid var(--app-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  background: none;
  border: none;
  color: var(--app-text-muted);
  font-size: 0.625rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.bottom-nav-item.active {
  color: var(--app-primary);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
}

/* =============================================
   PAGE CONTAINER
   ============================================= */
.page {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--app-bg);
  padding-bottom: calc(var(--bottom-nav-h) + 20px);
}

.page.active {
  display: block;
}

.page-scrollable {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  height: calc(100vh - var(--header-h) - var(--bottom-nav-h) - env(safe-area-inset-bottom, 0px));
}

/* =============================================
   HOME / MYNEWS PAGE
   ============================================= */
.news-filters {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.news-filters::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 8px 16px;
  border-radius: 9999px;
  border: 1px solid var(--app-border);
  background: #fff;
  color: var(--app-text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.filter-chip.active {
  background: var(--app-primary);
  color: #fff;
  border-color: var(--app-primary);
}

/* News cards */
.news-feed {
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.news-card {
  background: var(--app-card-bg);
  border-radius: 16px;
  box-shadow: var(--app-card-shadow);
  overflow: hidden;
}

.news-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

.news-card-tag {
  padding: 4px 12px;
  border-radius: 8px;
  background: rgba(233,30,99,0.08);
  color: var(--app-primary);
  font-size: 0.75rem;
  font-weight: 600;
}

.news-card-date {
  font-size: 0.75rem;
  color: var(--app-text-muted);
}

.news-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.news-card-image-placeholder {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #E91E63, #9C27B0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
}

.news-card-body {
  padding: 14px 16px;
}

.news-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--app-text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.news-card-excerpt {
  font-size: 0.875rem;
  color: var(--app-text-secondary);
  line-height: 1.5;
}

.news-card-footer {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--app-border);
  gap: 24px;
}

.news-action {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--app-text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
}

.news-action svg {
  width: 18px;
  height: 18px;
}

/* =============================================
   PROFILE INFO PAGE
   ============================================= */
.profile-card {
  background: var(--app-bg-light);
  border-radius: 16px;
  padding: 16px;
  margin: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.profile-avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--app-bg-section);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--app-text-muted);
  flex-shrink: 0;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--app-text-primary);
  margin-bottom: 4px;
}

.profile-role {
  font-size: 0.9375rem;
  color: var(--app-text-secondary);
  margin-bottom: 4px;
}

.profile-since {
  font-size: 0.8125rem;
  color: var(--app-text-muted);
}

.profile-since span {
  color: var(--app-primary);
  font-weight: 600;
}

.profile-flag {
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* Profile sections */
.profile-section {
  margin: 16px 0;
  padding: 0 16px;
}

.profile-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--app-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.profile-section-title svg {
  width: 18px;
  height: 18px;
  color: var(--app-primary);
}

.info-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  gap: 14px;
}

.info-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.info-card-icon svg {
  width: 22px;
  height: 22px;
}

.info-card-content {
  flex: 1;
}

.info-card-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--app-primary);
  margin-bottom: 2px;
}

.info-card-value {
  font-size: 0.875rem;
  color: var(--app-text-secondary);
}

/* Hierarchy */
.hierarchy-item {
  background: #ffffff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.hierarchy-role {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--app-primary);
  margin-bottom: 10px;
}

.hierarchy-person {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hierarchy-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.hierarchy-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--app-text-primary);
}

.hierarchy-detail {
  font-size: 0.8125rem;
  color: var(--app-text-secondary);
}

/* =============================================
   MY DIRECTORY PAGE
   ============================================= */
.directory-banner {
  margin: 16px;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  height: 140px;
  background: linear-gradient(135deg, #4A90E2, #667eea);
  display: flex;
  align-items: center;
  justify-content: center;
}

.directory-banner-text {
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
  text-align: center;
}

.directory-banner-text span {
  font-size: 0.875rem;
  font-weight: 400;
  opacity: 0.9;
}

/* Search bar */
.search-container {
  padding: 0 16px;
  margin-bottom: 16px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--app-bg-light);
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid var(--app-border);
}

.search-bar svg {
  width: 20px;
  height: 20px;
  color: var(--app-text-muted);
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  border: none;
  background: none;
  font-size: 0.9375rem;
  color: var(--app-text-primary);
  outline: none;
}

.search-bar input::placeholder {
  color: var(--app-text-muted);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}

.empty-state-icon {
  width: 100px;
  height: 100px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--app-text-secondary);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 0.875rem;
  color: var(--app-text-muted);
  max-width: 280px;
}

/* Directory results */
.directory-list {
  padding: 0 16px;
}

.directory-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border-radius: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.directory-item-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.directory-item-info {
  flex: 1;
}

.directory-item-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--app-text-primary);
}

.directory-item-role {
  font-size: 0.8125rem;
  color: var(--app-text-secondary);
}

.directory-item-direction {
  font-size: 0.75rem;
  color: var(--app-text-muted);
}

.directory-item-flag {
  font-size: 1.25rem;
}

/* =============================================
   AVIS & COMMENTAIRES PAGE
   ============================================= */
.avis-banner {
  margin: 16px;
  border-radius: 16px;
  overflow: hidden;
  height: 120px;
  background: linear-gradient(135deg, #00BCD4, #0097A7);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.avis-banner-text {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
}

.avis-form {
  padding: 0 16px;
}

.avis-form-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--app-text-primary);
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  color: var(--app-text-secondary);
  margin-bottom: 8px;
}

.form-select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--app-border);
  background: var(--app-bg-light);
  font-size: 0.9375rem;
  color: var(--app-text-primary);
  appearance: none;
  cursor: pointer;
}

.form-textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--app-border);
  background: var(--app-bg-light);
  font-size: 0.9375rem;
  color: var(--app-text-primary);
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
}

.form-textarea::placeholder,
.form-select::placeholder {
  color: var(--app-text-muted);
}

.btn-primary {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 24px auto;
  padding: 14px 24px;
  border-radius: 9999px;
  border: none;
  background: var(--app-primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 4px 16px rgba(233,30,99,0.3);
}

/* =============================================
   MENU / MES SERVICES PAGE
   ============================================= */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
}

.services-grid.hidden {
  display: none;
}

.service-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  background: none;
  border: none;
  cursor: pointer;
}

.service-item:active {
  opacity: 0.7;
}

.service-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--app-bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.service-icon svg {
  width: 26px;
  height: 26px;
  color: var(--app-primary);
}

.service-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--app-text-secondary);
  text-align: center;
}

.btn-toggle-services {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px;
  background: none;
  border: none;
  color: var(--app-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.btn-toggle-services svg {
  width: 20px;
  height: 20px;
}

/* Menu links */
.menu-links {
  padding: 16px;
  border-top: 1px solid var(--app-border);
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--app-text-primary);
  font-size: 0.9375rem;
  font-weight: 500;
  border-bottom: 1px solid var(--app-border);
}

.menu-link:last-child {
  border-bottom: none;
}

.menu-link svg {
  width: 22px;
  height: 22px;
  color: var(--app-primary);
}

.menu-link.logout {
  color: var(--app-primary);
}

.app-version {
  text-align: center;
  padding: 16px;
  font-size: 0.8125rem;
  color: var(--app-text-muted);
}

/* =============================================
   NOTIFICATIONS PAGE
   ============================================= */
.notifications-list {
  padding: 0 16px;
}

.notification-section-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--app-text-primary);
  padding: 16px 0 12px;
}

.notification-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--app-border);
}

.notification-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(233,30,99,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-icon svg {
  width: 22px;
  height: 22px;
  color: var(--app-primary);
}

.notification-content {
  flex: 1;
}

.notification-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--app-text-primary);
  margin-bottom: 4px;
}

.notification-desc {
  font-size: 0.875rem;
  color: var(--app-text-secondary);
  margin-bottom: 4px;
  line-height: 1.4;
}

.notification-time {
  font-size: 0.75rem;
  color: var(--app-text-muted);
}

/* =============================================
   MODAL DE CONFIRMATION
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: #ffffff;
  border-radius: 20px;
  padding: 28px 24px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal-box {
  transform: scale(1);
}

.modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--app-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.modal-icon svg {
  width: 28px;
  height: 28px;
  color: var(--app-primary);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--app-text-primary);
  margin-bottom: 8px;
}

.modal-message {
  font-size: 0.9375rem;
  color: var(--app-text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.btn-modal-secondary {
  flex: 1;
  padding: 12px 16px;
  border-radius: 9999px;
  border: 1.5px solid var(--app-primary);
  background: #fff;
  color: var(--app-primary);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-modal-primary {
  flex: 1;
  padding: 12px 16px;
  border-radius: 9999px;
  border: none;
  background: var(--app-primary);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

/* =============================================
   LOADER INTERNE
   ============================================= */
.internal-loader {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.internal-loader.active {
  display: flex;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  animation: loaderSpin 1s linear infinite;
}

@keyframes loaderSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loader-spinner svg {
  width: 100%;
  height: 100%;
  color: var(--app-primary);
}

/* =============================================
   WELCOME SLIDE (Onboarding)
   ============================================= */
.welcome-slide-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}

.welcome-logo {
  width: 200px;
  height: auto;
}

.welcome-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--app-text-primary);
  line-height: 1.2;
}

.welcome-title span {
  color: var(--app-primary);
}

.welcome-subtitle {
  font-size: 1rem;
  color: var(--app-text-secondary);
  max-width: 280px;
  line-height: 1.6;
}

/* =============================================
   UTILITAIRES
   ============================================= */
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

/* Réduction de mouvement */
@media (prefers-reduced-motion: reduce) {
  .filter-chip, .bottom-nav-item, .btn-primary,
  .modal-overlay, .modal-box, .service-icon {
    transition: none !important;
  }
  .loader-spinner {
    animation: none !important;
  }
}

/* Responsive */
@media (min-width: 768px) {
  .news-feed {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  .services-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
