/* ============================================================
   mobile.css — Breakpoints mobile-first pour ProjetRencontre
   Complète pride.custom.css · Bootstrap 4 compatible
   ============================================================ */

/* ── 1. Breakpoints ────────────────────────────────────────────────────── */
/*
  xs  : < 576px  (téléphones portrait)
  sm  : ≥ 576px  (téléphones paysage)
  md  : ≥ 768px  (tablettes)
  lg  : ≥ 992px  (laptops)
  xl  : ≥ 1200px (desktops)
*/

/* ── 2. Base mobile-first ──────────────────────────────────────────────── */
html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video {
  max-width: 100%;
  height: auto;
}

/* ── 3. Auth card — responsive ─────────────────────────────────────────── */
.auth-card {
  padding: 28px 20px;
}

@media (min-width: 576px) {
  .auth-card {
    padding: 40px 36px;
  }
}

/* ── 4. Navigation mobile (bottom bar) ─────────────────────────────────── */
.mobile-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--pride-bg-card);
  border-top: 1px solid var(--pride-border);
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--pride-text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav a.active,
.mobile-nav a:hover {
  color: var(--pride-primary);
}
.mobile-nav a svg,
.mobile-nav a .icon {
  width: 24px;
  height: 24px;
}

/* Masquer sur desktop */
@media (min-width: 992px) {
  .mobile-nav {
    display: none;
  }
}

/* Padding body pour la nav fixe */
.has-mobile-nav {
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
@media (min-width: 992px) {
  .has-mobile-nav {
    padding-bottom: 0;
  }
}

/* ── 5. Swipe cards — responsive ────────────────────────────────────────── */
.swipe-stack {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  aspect-ratio: 3 / 4;
}

@media (max-height: 700px) {
  .swipe-stack {
    aspect-ratio: 4 / 4;
  }
}

.swipe-card {
  position: absolute;
  inset: 0;
  border-radius: var(--pride-radius-lg);
  overflow: hidden;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  will-change: transform;
}
.swipe-card:active {
  cursor: grabbing;
}
.swipe-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* Labels swipe */
.swipe-label {
  position: absolute;
  top: 24px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 3px solid;
  padding: 4px 14px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}
.swipe-label-like {
  left: 20px;
  color: var(--pride-success);
  border-color: var(--pride-success);
  transform: rotate(-20deg);
}
.swipe-label-nope {
  right: 20px;
  color: var(--pride-danger);
  border-color: var(--pride-danger);
  transform: rotate(20deg);
}

/* ── 6. Action buttons Swipe ───────────────────────────────────────────── */
.swipe-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 20px 0 8px;
}

.swipe-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--pride-transition);
  background: var(--pride-bg-card);
  box-shadow: var(--pride-shadow);
  -webkit-tap-highlight-color: transparent;
  color: var(--pride-text);
}
/* Legacy single-dash aliases (kept for backwards compat) */
.swipe-btn-nope,
.swipe-btn--pass    { color: var(--pride-danger);  }
.swipe-btn-like,
.swipe-btn--like    { color: var(--pride-success); width: 64px; height: 64px; }
.swipe-btn-super,
.swipe-btn--superlike { color: var(--pride-blue);  }
.swipe-btn-boost,
.swipe-btn--boost   { color: var(--pride-yellow);  }
.swipe-btn--rewind  { color: var(--pride-text-muted); }
.swipe-btn.feature-locked { opacity: 0.4; cursor: not-allowed; }

.swipe-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.swipe-btn:active {
  transform: scale(0.95);
}

/* ── 7. Chat — responsive ───────────────────────────────────────────────── */
.chat-page {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

.chat-sidebar {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--pride-border);
  overflow-y: auto;
  background: var(--pride-bg-card);
}

.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 767px) {
  .chat-sidebar {
    width: 100%;
    position: fixed;
    inset: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .chat-sidebar.open {
    transform: translateX(0);
  }
  .chat-window {
    width: 100%;
  }
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-input-bar {
  padding: 12px 16px;
  border-top: 1px solid var(--pride-border);
  background: var(--pride-bg-card);
  display: flex;
  gap: 12px;
  align-items: flex-end;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

/* Bulles de message */
.bubble {
  max-width: 70%;
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 0.9375rem;
  line-height: 1.5;
  word-break: break-word;
}
.bubble-out {
  background: var(--pride-primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.bubble-in {
  background: var(--pride-bg-input);
  color: var(--pride-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

@media (max-width: 576px) {
  .bubble { max-width: 85%; }
}

/* ── 8. Stories ─────────────────────────────────────────────────────────── */
.stories-bar {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.stories-bar::-webkit-scrollbar { display: none; }

.story-item {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.story-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 3px;
  background: var(--pride-gradient);
}
.story-ring-seen {
  background: var(--pride-border);
}
.story-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pride-bg);
  display: block;
}

.story-name {
  font-size: 0.7rem;
  color: var(--pride-text-muted);
  max-width: 68px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 9. Match popup ─────────────────────────────────────────────────────── */
.match-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.3s ease;
}

.match-popup {
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.match-popup h2 {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.match-avatars {
  display: flex;
  justify-content: center;
  gap: -20px;
  margin: 24px 0;
}
.match-avatars .avatar-hex {
  width: 100px;
  height: 100px;
}
.match-avatars .avatar-hex:last-child {
  margin-left: -20px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── 10. Onboarding steps ───────────────────────────────────────────────── */
.onboarding-step {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  max-width: 480px;
  margin: 0 auto;
}

.onboarding-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.onboarding-content {
  flex: 1;
}

.onboarding-footer {
  padding: 20px 0 env(safe-area-inset-bottom);
}

/* ── 11. Grille de profils ──────────────────────────────────────────────── */
.profiles-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 576px) {
  .profiles-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
  .profiles-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1200px) {
  .profiles-grid { grid-template-columns: repeat(5, 1fr); }
}

.profile-card-mini {
  aspect-ratio: 3 / 4;
  border-radius: var(--pride-radius);
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.profile-card-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.profile-card-mini:hover img {
  transform: scale(1.05);
}
.profile-card-mini .overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  font-size: 0.85rem;
  font-weight: 600;
}

/* ── 12. Topbar / Header responsive ─────────────────────────────────────── */
.pr-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: var(--pride-bg-card);
  border-bottom: 1px solid var(--pride-border);
  padding: 0 16px;
  height: 56px;
}

.pr-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  gap: 12px;
}

.pr-header__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
  flex-shrink: 0;
}

.pr-header__brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  background: var(--pride-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Navigation principale — masquée sur mobile, visible sur desktop */
.pr-nav {
  display: none;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

@media (min-width: 768px) {
  .pr-nav {
    display: flex;
  }
}

.pr-nav__link {
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--pride-text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.pr-nav__link:hover,
.pr-nav__link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.pr-nav__link.is-active {
  color: var(--pride-primary);
}

/* Zone utilisateur droite */
.pr-header__user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pr-header__avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pride-border);
  transition: border-color 0.2s;
}

.pr-header__avatar:hover img {
  border-color: var(--pride-primary);
}

/* Sélecteur de langue dans la topbar — toujours visible */
.pr-header__user .pr-lang-switcher {
  display: flex;
}

/* Sur très petits écrans : masquer le label "logout", garder le bouton */
@media (max-width: 380px) {
  .pr-header__logout .button {
    font-size: 0;       /* cacher le texte */
    padding: 6px 8px;
  }
  .pr-header__logout .button::before {
    content: '⏏';
    font-size: 14px;
  }
  .pr-header__brand {
    display: none;
  }
}

/* ── 13. Sélecteur de langue — responsive ───────────────────────────────── */
/* Sur mobile, s'assure que le select est toujours cliquable */
.pr-lang-select {
  min-width: 60px;
  max-width: 90px;
  /* Évite que le select soit rogné sur Safari iOS */
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239a9ab5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 22px;
}

@media (max-width: 576px) {
  .pr-lang-select {
    font-size: 11px;
    padding: 3px 20px 3px 6px;
  }
}

/* ── 14. Landing / Login page — responsive ──────────────────────────────── */
@media (max-width: 767px) {
  /* Sur mobile, la landing passe en single colonne */
  .landing {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  .landing-info {
    padding: 24px 20px 16px;
  }

  .landing-form {
    flex: 1;
    padding: 0 16px 24px;
  }

  .landing-decoration {
    display: none;
  }

  .landing-info-pretitle {
    font-size: 14px;
  }

  .landing-info-title {
    font-size: 28px;
    margin-bottom: 8px;
  }

  .landing-info-text {
    font-size: 13px;
    margin-bottom: 16px;
  }

  .tab-switch {
    margin-bottom: 4px;
  }

  .form-box {
    border-radius: 16px;
    padding: 24px 20px;
  }

  /* Cacher la décoration rocket sur mobile */
  .form-box-decoration {
    display: none;
  }

  .form-box .form {
    margin-top: 0 !important;
  }

  /* Les messages flash prennent toute la largeur */
  .form-box-message {
    margin-bottom: 16px !important;
  }
}

/* ── 15. Chat layout — correction classe is-visible ─────────────────────── */
/*
 * La vue chat/index.php toggle .is-visible sur la sidebar (JS inline).
 * mobile.css définissait .open — on ajoute l'alias .is-visible ici.
 */
@media (max-width: 767px) {
  .chat-sidebar.is-visible,
  .chat-sidebar.open {
    transform: translateX(0);
  }

  /* Bouton retour mobile — visible uniquement sur mobile */
  #btn-back-convs {
    display: flex !important;
  }

  /* Zone messages : hauteur calculée dynamiquement */
  .chat-widget-conversation {
    max-height: calc(100dvh - 56px - 64px - 72px - 70px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (min-width: 768px) {
  #btn-back-convs {
    display: none !important;
  }
}

/* ── 16. Swipe cards sur petits écrans — touch improvements ─────────────── */
@media (max-width: 576px) {
  .swipe-stack {
    max-width: calc(100vw - 32px);
    /* Empêcher le scroll page pendant le swipe */
    touch-action: none;
  }

  .swipe-actions {
    gap: 12px;
    padding: 14px 0 4px;
  }

  .swipe-btn {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }

  .swipe-btn--like,
  .swipe-btn-like {
    width: 58px;
    height: 58px;
  }
}

/* ── 17. Contenu principal ──────────────────────────────────────────────── */
.pr-main {
  min-height: calc(100dvh - 56px);
  padding: 20px 16px;
  max-width: 1280px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .pr-main {
    padding: 28px 24px;
  }
}

@media (min-width: 1200px) {
  .pr-main {
    padding: 32px 40px;
  }
}

/* ── 18. Utilitaires responsive ─────────────────────────────────────────── */
.hide-mobile { display: none !important; }
@media (min-width: 768px) {
  .hide-mobile  { display: initial !important; }
  .hide-desktop { display: none    !important; }
}

.text-center-mobile {
  text-align: center;
}
@media (min-width: 768px) {
  .text-center-mobile { text-align: left; }
}

/* Safe areas iOS */
.safe-top    { padding-top:    env(safe-area-inset-top);    }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
.safe-left   { padding-left:   env(safe-area-inset-left);   }
.safe-right  { padding-right:  env(safe-area-inset-right);  }
