/* =====================================================
   REGAFRIK — Styles responsive mobile
   Breakpoints : xs < 576px | sm 576-768px | md 768-992px
   ===================================================== */

/* ── BASE MOBILE ─────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

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

/* Évite le zoom sur les inputs iOS (bug natif Safari) */
input, select, textarea {
  font-size: 16px !important;
}


/* ── NAVBAR MOBILE ───────────────────────────────── */

@media (max-width: 991px) {

  .navbar {
    padding: 0.6rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1050;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .navbar-brand { font-size: 1.1rem !important; }

  .navbar-toggler {
    border: 1px solid rgba(201,168,76,0.4);
    border-radius: 8px;
    padding: 6px 10px;
  }
  .navbar-toggler:focus { box-shadow: 0 0 0 2px rgba(201,168,76,0.3); }
  .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(201,168,76,0.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  }

  .navbar-collapse {
    background: rgba(13,27,62,0.97);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    margin-top: 8px;
    padding: 1rem;
    border: 1px solid rgba(201,168,76,0.15);
  }

  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 0.95rem;
    transition: background 0.2s ease;
  }
  .navbar-nav .nav-link:hover,
  .navbar-nav .nav-link:active {
    background: rgba(201,168,76,0.1);
    color: #C9A84C !important;
  }

  .navbar-nav .btn-cta-nav {
    margin-top: 0.5rem;
    width: 100%;
    text-align: center;
    padding: 0.75rem;
    border-radius: 10px;
  }
}


/* ── LANDING PAGE HERO ───────────────────────────── */

@media (max-width: 767px) {

  #hero {
    height: 100svh;
    min-height: 600px;
  }


  #hero .hero-content h1 {
    font-size: clamp(1.8rem, 8vw, 2.8rem) !important;
    line-height: 1.2 !important;
    text-align: center;
    padding: 0 1rem;
  }

  #hero .hero-content p,
  #hero .hero-content .typed-text {
    font-size: 0.95rem !important;
    padding: 0 1.5rem;
    text-align: center;
  }

  #hero .hero-buttons {
    flex-direction: column !important;
    gap: 0.75rem !important;
    padding: 0 2rem;
    width: 100%;
  }
  #hero .hero-buttons .btn {
    width: 100%;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
  }

  #hero .hero-badges {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.5rem;
    padding: 0 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
    justify-content: flex-start !important;
  }
  #hero .hero-badges::-webkit-scrollbar { display: none; }
  #hero .hero-badges .badge-inst {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 6px 12px;
  }

  #hero-canvas { opacity: 0.4; }
}


/* ── TICKER DÉFILANT ─────────────────────────────── */

@media (max-width: 767px) {
  .ticker-wrap {
    height: 38px;
    font-size: 0.8rem;
  }
  .ticker-live-badge {
    font-size: 0.7rem;
    padding: 0 8px;
  }
}


/* ── SECTION CHIFFRES CLÉS ───────────────────────── */

@media (max-width: 767px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem;
    padding: 0 1rem;
  }
  .stat-card { padding: 1.25rem 1rem; }
  .stat-number { font-size: 2rem !important; }
  .stat-label { font-size: 0.8rem; }
}


/* ── CAROUSEL SWIPER ARTICLES ────────────────────── */

@media (max-width: 767px) {
  .swiper-articles {
    padding: 1rem 0.5rem 3rem !important;
  }
  .swiper-articles .swiper-slide {
    width: 88vw !important;
    max-width: 340px;
  }
  .article-card { border-radius: 12px; overflow: hidden; }
  .article-card .card-body { padding: 1rem; }
  .article-card .card-title { font-size: 1rem; line-height: 1.35; }
}


/* ── SECTION GLOBE UEMOA ─────────────────────────── */

@media (max-width: 767px) {
  .uemoa-section { flex-direction: column !important; }
  .uemoa-section .text-col,
  .uemoa-section .globe-col { width: 100% !important; }
  .uemoa-section .globe-col { height: 280px; margin-top: 1.5rem; }
  .uemoa-section svg { width: 100%; height: auto; }
  .country-list li { font-size: 0.85rem; padding: 0.4rem 0; }
}


/* ── SECTION FEATURES PLATEFORME ─────────────────── */

@media (max-width: 767px) {
  .features-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
    padding: 0 1rem;
  }
  .feature-card { padding: 1.25rem; }
  .feature-card[data-tilt] { transform: none !important; }
}


/* ── STEPPER "COMMENT ÇA MARCHE" ─────────────────── */

@media (max-width: 767px) {
  .how-it-works-steps { flex-direction: column !important; gap: 0.75rem; }
  .step-pill { width: 100%; text-align: center; }
  .step-demo-area { min-height: 200px; padding: 1rem; font-size: 0.85rem; }
  .step-connector-line { display: none; }
}


/* ── PAGE LISTE ARTICLES ─────────────────────────── */

@media (max-width: 767px) {

  .filters-sidebar {
    position: fixed !important;
    top: 0;
    left: -100%;
    width: 88vw;
    max-width: 320px;
    height: 100vh;
    background: #fff;
    z-index: 1060;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: 4px 0 30px rgba(0,0,0,0.2);
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid rgba(74,44,143,0.1);
  }
  .filters-sidebar.open { left: 0; }

  .filters-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1055;
  }
  .filters-overlay.active { display: block; }

  .btn-open-filters-mobile {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1040;
    background: linear-gradient(135deg, #4A2C8F, #6240b5);
    color: #fff;
    border: none;
    border-radius: 25px;
    padding: 0.7rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(74,44,143,0.4);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .articles-grid { grid-template-columns: 1fr !important; gap: 1rem; }

  .article-list-card { flex-direction: column !important; }
  .article-list-card .article-thumb {
    width: 100% !important;
    height: 160px;
    object-fit: cover;
    border-radius: 10px 10px 0 0;
  }
  .article-list-card .article-body { padding: 1rem; }

  .results-toolbar {
    flex-direction: column !important;
    gap: 0.75rem;
    align-items: flex-start !important;
  }
  .results-toolbar .sort-select { width: 100%; }

  .pagination { flex-wrap: wrap; justify-content: center; gap: 4px; }
  .pagination .page-link { padding: 0.5rem 0.75rem; font-size: 0.85rem; }
}


/* ── PAGE LECTURE ARTICLE ─────────────────────────── */

@media (max-width: 767px) {

  .article-detail-header { padding: 1.5rem 1rem; }
  .article-detail-title {
    font-size: clamp(1.4rem, 6vw, 2rem) !important;
    line-height: 1.25;
  }
  .article-detail-content {
    font-size: 1rem;
    line-height: 1.75;
    padding: 0 0.25rem;
  }
  .article-detail-content h2 { font-size: 1.2rem; }
  .article-detail-content h3 { font-size: 1.1rem; }

  .article-sidebar {
    margin-top: 2rem;
    border-top: 1px solid rgba(74,44,143,0.15);
    padding-top: 1.5rem;
  }

  .share-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
  .share-buttons .btn { flex: 1; min-width: 100px; font-size: 0.8rem; padding: 0.5rem; }
}


/* ── FORMULAIRES AUTH (LOGIN / REGISTER) ─────────── */

@media (max-width: 767px) {

  body.auth-page {
    align-items: flex-start !important;
    padding-top: 2rem !important;
  }

  .auth-card {
    margin: 0 1rem 2rem !important;
    padding: 1.75rem 1.25rem !important;
    border-radius: 16px !important;
  }

  .auth-card h2 { font-size: 1.4rem; }
  .auth-card .form-control { padding: 0.85rem 1rem; font-size: 16px; }
  .auth-card .btn-login { padding: 1rem; font-size: 1rem; }
}


/* ── PAGES INTÉRIEURES AUTHENTIFIÉES ─────────────── */

@media (max-width: 991px) {

  .app-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    width: 280px;
    z-index: 1040;
    transition: left 0.3s ease;
    overflow-y: auto;
    background: #0D1B3E;
    padding-top: 60px;
  }
  .app-sidebar.open { left: 0; }

  .app-main-content {
    margin-left: 0 !important;
    padding: 1rem !important;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
  }
  .sidebar-overlay.active { display: block; }
}

@media (max-width: 767px) {

  .documents-grid { grid-template-columns: 1fr !important; gap: 0.75rem; }

  .document-card { padding: 1rem; }
  .document-card .doc-title { font-size: 0.95rem; line-height: 1.35; }
  .document-card .doc-actions { flex-wrap: wrap; gap: 0.4rem; }
  .document-card .doc-actions .btn { font-size: 0.75rem; padding: 0.35rem 0.65rem; }

  .search-bar-wrapper { padding: 0 0 1rem; }
  .search-bar-wrapper input { font-size: 16px; }

  .summary-card { padding: 1rem 1.25rem; margin-top: 0.75rem; }
  .ai-summary h2 { font-size: 0.95rem; }
  .ai-summary ul { padding-left: 1.1rem; }

  .workspace-tree { font-size: 0.9rem; }
  .workspace-folder-item { padding: 0.6rem 0.75rem; }

  .table-responsive-mobile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-responsive-mobile table { min-width: 600px; }
}


/* ── BOTTOM NAVIGATION BAR (mobile uniquement) ────── */

.bottom-nav { display: none; }

@media (max-width: 767px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(13,27,62,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(201,168,76,0.2);
    z-index: 1030;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: rgba(248,246,241,0.55);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 10px;
    transition: all 0.2s ease;
    min-width: 56px;
    min-height: 44px;
    justify-content: center;
  }

  .bottom-nav-item i, .bottom-nav-item svg { font-size: 1.25rem; }

  .bottom-nav-item.active,
  .bottom-nav-item:active {
    color: #C9A84C;
    background: rgba(201,168,76,0.1);
  }

  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

  .sidebar-nav-links { display: none; }
}


/* ── TOUCH & SCROLL UX ───────────────────────────── */

@media (max-width: 767px) {
  .btn, .nav-link, .badge-inst, .bottom-nav-item {
    min-height: 44px;
    min-width: 44px;
  }

  .snap-scroll-x {
    scroll-snap-type: x mandatory;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .snap-scroll-x > * {
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  .container { padding-left: 1rem; padding-right: 1rem; }
  .row { margin-left: -0.5rem; margin-right: -0.5rem; }
  [class*="col-"] { padding-left: 0.5rem; padding-right: 0.5rem; }
}


/* ── UTILITAIRES ─────────────────────────────────── */

@media (max-width: 767px) {
  .hide-mobile   { display: none !important; }
  .show-mobile   { display: block !important; }
  .text-center-mobile { text-align: center !important; }
  .full-width-mobile  { width: 100% !important; }
  .p-mobile-1 { padding: 0.5rem !important; }
  .p-mobile-2 { padding: 1rem !important; }
  .mt-mobile-2 { margin-top: 1rem !important; }
}


/* ── Bannière PWA ────────────────────────────────── */

.pwa-banner {
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom) + 8px);
  left: 1rem;
  right: 1rem;
  background: rgba(13,27,62,0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(201,168,76,0.35);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 2000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  transform: translateY(120px);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.45s ease;
  pointer-events: none;
}

.pwa-banner.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

.pwa-banner-icon img { border-radius: 12px; flex-shrink: 0; }

.pwa-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pwa-banner-text strong { color: #F8F6F1; font-size: 0.9rem; font-weight: 700; }
.pwa-banner-text span   { color: rgba(248,246,241,0.6); font-size: 0.75rem; }

.pwa-banner-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

.pwa-btn-install {
  background: linear-gradient(135deg, #C9A84C, #e0c068);
  color: #0D1B3E;
  border: none;
  border-radius: 20px;
  padding: 0.5rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.pwa-btn-install:active { transform: scale(0.96); }

.pwa-btn-dismiss {
  background: transparent;
  border: none;
  color: rgba(248,246,241,0.5);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  transition: color 0.2s;
}
.pwa-btn-dismiss:hover { color: #F8F6F1; }

@media (min-width: 768px) {
  .pwa-banner { display: none !important; }
}

.pwa-standalone .navbar { padding-top: env(safe-area-inset-top); }
.pwa-standalone .bottom-nav {
  padding-bottom: calc(env(safe-area-inset-bottom) + 4px);
}
