/* ============================================================
   NEXARA — responsive.css
   CSS global responsive — couvre TOUTES les pages
   Compatible : iPhone SE → iPhone 15 Pro Max, Android, iPad, Desktop
   Breakpoints : 480px / 768px / 1024px / 1200px
   ============================================================ */

/* ── 1. RESET GLOBAL ANTI-DÉBORDEMENT ─────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

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

table {
  width: 100%;
}

/* ── 2. TAILLE MINIMALE DES BOUTONS (touch targets) ───────── */
.btn,
button,
a.btn,
input[type="submit"],
input[type="button"] {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* ── 3. INPUTS ACCESSIBLES SUR MOBILE ─────────────────────── */
input, select, textarea {
  font-size: 16px !important; /* évite le zoom iOS sur focus */
  max-width: 100%;
}

/* ── 4. PAGE D'ACCUEIL — nexara-home.html ─────────────────── */

/* Correction zone noire : hero trop paddé */
#hero {
  padding-top: 80px !important;
}

/* Navbar fixe — s'assure qu'elle reste visible */
#navbar,
nav#navbar {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 64px;
}

/* Le contenu ne se cache pas sous la navbar fixe */
body > *:not(#navbar):not(#mobile-nav):not(#cookie-banner):first-of-type,
#hero {
  scroll-margin-top: 64px;
}

/* ── 5. PAGES INTERNES — Sidebar + Main ───────────────────── */

/* Sidebar déjà gérée, on renforce */
.sidebar {
  z-index: 200;
}

/* Overlay quand sidebar ouverte sur mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
}
.sidebar-overlay.visible {
  display: block;
}

/* Topbar — bouton hamburger */
.hamburger,
.menu-toggle,
.sidebar-toggle {
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: inherit;
  min-height: 44px;
  min-width: 44px;
  display: none;
  align-items: center;
  justify-content: center;
}

/* ── 6. TABLEAUX SCROLLABLES ───────────────────────────────── */
.table-wrap,
.table-container,
.orders-table,
.history-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table,
.orders-table table {
  min-width: 500px;
}

/* ── 7. GRILLES ADAPTATIVES ────────────────────────────────── */
.stats-grid,
.cards-grid {
  display: grid;
  gap: 16px;
}

/* ── 8. FORMULAIRES PLEINE LARGEUR ─────────────────────────── */
.form-group {
  width: 100%;
}

.form-group input,
.form-group select,
.form-group textarea,
.fc input,
.fc select {
  width: 100%;
}

/* ── 9. CARTES ─────────────────────────────────────────────── */
.card {
  width: 100%;
}

/* ============================================================
   TABLETTE — max-width: 1024px
   ============================================================ */
@media (max-width: 1024px) {

  /* Sidebar masquée par défaut */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }

  /* Main prend toute la largeur */
  .main {
    margin-left: 0 !important;
  }

  /* Hamburger visible */
  .hamburger,
  .menu-toggle,
  .sidebar-toggle {
    display: flex !important;
  }

  /* Stats grille 2 colonnes */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Grilles 2 colonnes */
  .plans-grid,
  .features-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Login/Register : cacher le panneau gauche déco */
  .layout .left {
    display: none;
  }
  .layout {
    grid-template-columns: 1fr !important;
  }
  .layout .right {
    padding: 40px 32px !important;
  }
}

/* ============================================================
   MOBILE LARGE — max-width: 768px
   ============================================================ */
@media (max-width: 768px) {

  /* ── Navigation home ── */
  #navbar .navbar-links,
  #navbar .navbar-actions {
    display: none !important;
  }
  #navbar .hamburger {
    display: flex !important;
  }
  #navbar {
    padding: 0 16px !important;
  }

  /* ── Hero page accueil ── */
  #hero {
    padding: 88px 16px 56px !important;
    min-height: auto !important;
    align-items: flex-start !important;
  }
  .hero-inner,
  .hero-grid-layout {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .hero-right {
    display: none !important; /* cache l'image déco sur mobile */
  }
  .hero-title,
  h1.hero-title {
    font-size: 28px !important;
    line-height: 1.25 !important;
    margin-bottom: 12px !important;
  }
  .hero-desc {
    font-size: 14px !important;
    margin-bottom: 24px !important;
  }
  .hero-actions {
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
  }
  .hero-actions .btn {
    width: 100% !important;
    height: 52px !important;
    font-size: 15px !important;
  }
  .hero-stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    margin-top: 32px !important;
  }

  /* ── Sections générales ── */
  section,
  .section {
    padding: 48px 16px !important;
  }
  .container,
  .page-inner {
    padding-left: 16px !important;
    padding-right: 16px !important;
    max-width: 100% !important;
  }
  .section-title {
    font-size: 22px !important;
    line-height: 1.3 !important;
  }
  .section-desc,
  .section-sub {
    font-size: 13px !important;
  }

  /* ── Grilles ── */
  .plans-grid,
  .features-grid,
  .steps-grid,
  .trust-grid,
  .testimonials-grid,
  .footer-grid,
  .cards-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }

  /* ── Topbar pages internes ── */
  .topbar {
    padding: 0 16px !important;
    height: 56px !important;
  }
  .topbar-right .topbar-badge {
    display: none !important; /* cache infos non essentielles */
  }

  /* ── Contenu pages internes ── */
  .content {
    padding: 16px !important;
  }

  /* ── Formulaires ── */
  .layout .right,
  .form-container,
  .auth-card {
    padding: 24px 16px !important;
  }
  .form-row {
    grid-template-columns: 1fr !important;
  }
  .fg {
    flex-direction: column !important;
  }

  /* ── Cartes stat ── */
  .stat-card {
    padding: 16px !important;
  }
  .stat-value {
    font-size: 20px !important;
  }

  /* ── Tableau marchés ── */
  .markets-table-head,
  .markets-table-row {
    grid-template-columns: 2fr 1.5fr 1fr !important;
  }
  .markets-table-head > *:nth-child(n+4),
  .markets-table-row > *:nth-child(n+4) {
    display: none !important;
  }

  /* ── Footer ── */
  .footer-bottom {
    flex-direction: column !important;
    text-align: center !important;
    gap: 12px !important;
  }
  .footer-legal {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px !important;
  }

  /* ── Cookie banner ── */
  #cookie-banner {
    flex-direction: column !important;
    padding: 16px !important;
    gap: 12px !important;
  }
  .cookie-btns {
    width: 100% !important;
    flex-direction: row !important;
    gap: 8px !important;
  }
  .cookie-btns .btn {
    flex: 1 !important;
  }

  /* ── KYC steps ── */
  .step-indicators {
    gap: 4px !important;
  }
  .step-label {
    display: none !important;
  }

  /* ── Admin panels ── */
  .admin-stats {
    grid-template-columns: 1fr 1fr !important;
  }
  .action-btns {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .action-btns .btn {
    flex: 1 !important;
    min-width: 80px !important;
  }

  /* ── Tabs scrollables horizontalement ── */
  .tabs,
  .nav-tabs,
  .filter-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex-wrap: nowrap !important;
    scrollbar-width: none !important;
  }
  .tabs::-webkit-scrollbar { display: none !important; }

  /* ── Earn / Staking cards ── */
  .earn-grid,
  .staking-grid,
  .products-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── Support ── */
  .support-layout,
  .ticket-layout {
    grid-template-columns: 1fr !important;
  }

  /* ── Modal ── */
  .modal-box,
  .modal-content {
    margin: 16px !important;
    width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 32px) !important;
    overflow-y: auto !important;
  }

  /* ── Charts ── */
  .chart-container,
  #priceChart {
    max-height: 220px !important;
  }
}

/* ============================================================
   MOBILE PETIT — max-width: 480px (iPhone SE, petits Android)
   ============================================================ */
@media (max-width: 480px) {

  /* Hero encore plus compact */
  #hero {
    padding: 80px 12px 48px !important;
  }
  .hero-title {
    font-size: 24px !important;
  }
  .hero-stats {
    grid-template-columns: 1fr 1fr !important;
  }
  .hero-stat-value {
    font-size: 20px !important;
  }

  /* Stats 1 colonne sur très petit */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Admin stats 1 colonne */
  .admin-stats {
    grid-template-columns: 1fr !important;
  }

  /* Textes plus petits */
  .section-title {
    font-size: 20px !important;
  }
  body {
    font-size: 13px !important;
  }

  /* Boutons pleine largeur dans les cards */
  .plan-cta .btn,
  .card .btn-full {
    width: 100% !important;
  }

  /* Padding minimum */
  .content {
    padding: 12px !important;
  }

  /* Table : seulement nom + prix sur très petit */
  .markets-table-head,
  .markets-table-row {
    grid-template-columns: 1.8fr 1.2fr !important;
  }
  .markets-table-head > *:nth-child(n+3),
  .markets-table-row > *:nth-child(n+3) {
    display: none !important;
  }
  .markets-table-row .cell-action {
    display: flex !important;
  }

  /* OTP / 2FA inputs */
  .otp-inp,
  .code-inp {
    width: 40px !important;
    height: 48px !important;
    font-size: 18px !important;
  }

  /* Topbar */
  .topbar-title {
    font-size: 14px !important;
  }

  /* Tabs encore plus compacts */
  .tab-btn,
  .filter-btn {
    padding: 6px 12px !important;
    font-size: 12px !important;
  }
}

/* ============================================================
   GRAND MOBILE / PETITE TABLETTE — 480px à 768px
   ============================================================ */
@media (min-width: 481px) and (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .earn-grid,
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ============================================================
   TABLETTE — 768px à 1024px
   ============================================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .earn-grid,
  .products-grid,
  .plans-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .content {
    padding: 20px !important;
  }
  section {
    padding: 60px 24px !important;
  }
}

/* ============================================================
   UTILITAIRES RESPONSIVE
   ============================================================ */

/* Cacher sur mobile */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}
/* Cacher sur desktop */
@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}
/* Afficher seulement sur mobile */
.show-mobile { display: none !important; }
@media (max-width: 768px) {
  .show-mobile { display: flex !important; }
}

/* ── Anti-scroll horizontal global ─────────────────────────── */
@media (max-width: 1024px) {
  .page,
  .app-wrapper,
  #app {
    overflow-x: hidden !important;
  }
  *:not([style*="position:absolute"]):not([style*="position: absolute"]):not(.eye-btn):not(.ctry-drop):not(.country-dropdown):not(.modal-box):not(.modal-content) {
    max-width: 100%;
  }
  /* Éléments absolus : ne pas contraindre leur largeur */
  [style*="position:absolute"],
  .eye-btn,
  .ctry-drop,
  .country-dropdown,
  .input-suffix {
    max-width: none !important;
  }
  pre, code {
    white-space: pre-wrap !important;
    word-break: break-word !important;
  }
}

/* ── Ticker scrolling ───────────────────────── */
@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-track {
  animation: tickerScroll 25s linear infinite;
}

@media (max-width: 768px) {
  .ticker-track {
    animation-duration: 20s;
  }
}
