/**
 * theme.css — Refonte visuelle (design uniquement)
 * Couche additive : ne remplace pas quetrainvest-custom.css, elle le surcharge.
 * À charger APRÈS <link href="/assets/css/quetrainvest-custom.css">.
 * Réf : brief_refonte_design.md / forex_app_mockups.html
 */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');
/* Icônes : on réutilise Bootstrap Icons (déjà chargé sur toutes les pages)
   plutôt que d'ajouter une nouvelle dépendance CDN (Tabler). */

:root {
  /* ---- Tokens du nouveau design system (brief §4) ---- */
  --bg:     #060A14;
  --screen: #0B1322;
  --card:   #111C30;
  --line:   #1C2942;
  --txt:    #EEF3FB;
  --txt2:   #8DA0C0;
  --txt3:   #5E7291;
  --em:     #12C48B;
  --emd:    #062A1E;
  --vio:    #8B7BF6;
  --viod:   #1A1732;
  --gold:   #E0A63C;
  --red:    #F87171;

  /* Triplets RGB (pour rgba() en dur dans certaines pages historiques) */
  --em-rgb:   18, 196, 139;
  --vio-rgb:  139, 123, 246;
  --gold-rgb: 224, 166, 60;
  --red-rgb:  248, 113, 113;

  /* ---- Pont vers les tokens --qtr-* déjà utilisés partout dans le site ----
     Le reste des pages est déjà construit sur ces variables : en les
     redéfinissant ici, toute l'interface hérite de la nouvelle palette
     sans qu'on ait à retoucher chaque composant existant. */
  --qtr-primary: var(--em);
  --qtr-primary-dark: #0EA576;
  --qtr-primary-light: #3DD9A5;
  --qtr-secondary: var(--vio);
  --qtr-secondary-dark: #7364E0;
  --qtr-accent: var(--gold);
  --qtr-success: var(--em);
  --qtr-warning: var(--gold);
  --qtr-danger: var(--red);
  --qtr-info: var(--vio);

  --qtr-gradient-primary: linear-gradient(135deg, var(--em) 0%, #0EA576 100%);
  --qtr-gradient-secondary: linear-gradient(135deg, var(--vio) 0%, var(--gold) 100%);
  --qtr-gradient-dark: linear-gradient(135deg, var(--card) 0%, var(--bg) 100%);
  --qtr-gradient-glass: linear-gradient(135deg, rgba(18, 196, 139, 0.10) 0%, rgba(139, 123, 246, 0.10) 100%);

  --qtr-bg-dark: var(--bg);
  --qtr-bg-dark-2: var(--screen);
  --qtr-bg-dark-3: var(--card);
  --qtr-text-dark: var(--txt);
  --qtr-text-dark-secondary: var(--txt2);

  --qtr-shadow-sm: 0 2px 8px rgba(18, 196, 139, 0.10);
  --qtr-shadow-md: 0 4px 20px rgba(18, 196, 139, 0.15);
  --qtr-shadow-lg: 0 10px 40px rgba(18, 196, 139, 0.20);
  --qtr-shadow-glow: 0 0 30px rgba(18, 196, 139, 0.30);

  --qtr-font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --qtr-font-display: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;

  --qtr-radius: 16px;
  --qtr-radius-sm: 12px;
  --qtr-radius-lg: 24px;
}

/* Casse : jamais tout en majuscules pour les libellés (règle du brief) */
.qtr-menu-title,
.qtr-stat-label,
.qtr-table thead th {
  text-transform: none;
  letter-spacing: 0;
}

/* ============================================================
   Aplatissement des composants partagés (header / sidebar / cards)
   La maquette n'a ni flou ni glassmorphism : fond plein, bordure fine.
   ============================================================ */
.qtr-header {
  background: var(--screen);
  backdrop-filter: none;
  border-bottom: .5px solid var(--line);
}
.qtr-header.scrolled { background: var(--screen); box-shadow: none; }

.qtr-sidebar {
  background: var(--screen);
  backdrop-filter: none;
  border-right: .5px solid var(--line);
}
.qtr-sidebar-profile { background: transparent; border-bottom: .5px solid var(--line); }
.qtr-profile-card { background: var(--card); border: .5px solid var(--line); }

.qtr-card, .qtr-stat-card {
  background: var(--card);
  backdrop-filter: none;
  border: .5px solid var(--line);
  border-radius: 16px;
}
.qtr-card:hover, .qtr-stat-card:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--em);
}
.qtr-card::before, .qtr-stat-card::after { display: none; }

.qtr-btn-primary { background: var(--em); color: var(--emd); box-shadow: none; }
.qtr-btn-primary:hover { transform: none; box-shadow: none; filter: brightness(1.08); }
.qtr-btn-secondary { background: #182338; border-color: var(--line); }

.qtr-user-menu, .qtr-btn-icon { background: #182338; border-color: var(--line); }
.qtr-menu-item.active { background: var(--emd); border-color: transparent; }
.qtr-menu-item:hover { background: rgba(var(--em-rgb), 0.08); transform: none; }

/* ============================================================
   Composants réutilisables ajoutés par la refonte
   ============================================================ */

.rx-pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 7px; display: inline-flex; align-items: center; gap: 4px; line-height: 1.6; }
.rx-pill.up { color: var(--em); background: var(--emd); }
.rx-pill.dn { color: var(--red); background: #2A1414; }

.rx-btn-primary { background: var(--em); color: var(--emd); font-family: 'Sora', sans-serif; font-weight: 600; border: none; border-radius: 13px; padding: 13px; text-align: center; }
.rx-btn-secondary { background: #182338; color: var(--txt); font-family: 'Sora', sans-serif; font-weight: 500; border: none; border-radius: 13px; padding: 13px; text-align: center; }

.rx-field { background: #0E1728; border: .5px solid var(--line); border-radius: 12px; padding: 12px 14px; color: var(--txt); }
.rx-field::placeholder { color: var(--txt3); }
.rx-field:focus { border-color: var(--em); outline: none; box-shadow: 0 0 0 3px rgba(18, 196, 139, 0.12); }

.rx-card { background: var(--card); border: .5px solid var(--line); border-radius: 16px; padding: 14px; }

/* Flex-row utilitaire — nommée rx-row (et non "row") pour ne pas entrer en
   collision avec la grille Bootstrap .row chargée sur ces pages. */
.rx-row { display: flex; align-items: center; }

/* ============================================================
   Bottom navigation mobile (Accueil / Marché / Portefeuille / Profil)
   ============================================================ */
.rx-bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 0;
  max-width: 460px;
  margin: 0 auto;
  background: rgba(11, 19, 34, 0.92);
  backdrop-filter: blur(16px);
  border-top: .5px solid var(--line);
  border-left: .5px solid var(--line);
  border-right: .5px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}
.rx-bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #42597B; font-size: 21px; text-decoration: none;
  flex: 1 1 0; max-width: 115px;
}
.rx-bottom-nav a span { font-size: 10px; font-family: 'Inter', sans-serif; font-weight: 500; }
.rx-bottom-nav a.active { color: var(--em); }
.rx-bottom-nav a:focus-visible { outline: 2px solid var(--em); outline-offset: 2px; border-radius: 8px; }

body.rx-has-bottom-nav { padding-bottom: 78px; }

/* ============================================================
   Splash overlay (écran de chargement, retiré en JS au window.load)
   ============================================================ */
.rx-splash {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px;
  transition: opacity .4s ease, visibility .4s ease;
}
.rx-splash.rx-splash-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.rx-splash-mark {
  width: 88px; height: 88px; border-radius: 26px; background: var(--em);
  display: flex; align-items: center; justify-content: center; color: var(--emd); font-size: 42px;
}
.rx-splash-title { font-family: 'Sora', sans-serif; font-size: 28px; font-weight: 700; letter-spacing: -1px; color: var(--txt); text-align: center; }
.rx-splash-tagline { font-size: 10px; letter-spacing: 3px; text-transform: uppercase; color: var(--txt2); text-align: center; margin-top: 6px; }
.rx-splash-bar { width: 130px; height: 4px; background: #182338; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.rx-splash-bar span { display: block; width: 0%; height: 100%; background: var(--em); animation: rx-splash-fill 0.9s ease forwards; }
@keyframes rx-splash-fill { from { width: 0%; } to { width: 100%; } }
.rx-splash-hint { position: absolute; bottom: 26px; font-size: 10px; color: var(--txt3); }

@media (prefers-reduced-motion: reduce) {
  .rx-splash, .rx-splash-bar span { animation: none !important; transition: none !important; }
}

/* ============================================================
   Utilitaires de mise en page (dashboard, wallet, etc.)
   ============================================================ */
.rx-hero-value { font-family: 'Sora', sans-serif; font-size: 30px; font-weight: 700; color: var(--txt); line-height: 1.2; }
.rx-muted { color: var(--txt2); font-size: 12px; }
.rx-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rx-grid-2 .rx-card { padding: 12px 14px; }

.rx-quick-actions { display: flex; justify-content: space-around; gap: 8px; margin: 4px 0 18px; flex-wrap: wrap; }
.rx-quick-action { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; cursor: pointer; background: none; border: none; }
.rx-quick-action .rx-quick-icon { width: 46px; height: 46px; border-radius: 14px; background: #182338; color: var(--txt); display: flex; align-items: center; justify-content: center; font-size: 20px; transition: background .2s ease, color .2s ease; }
.rx-quick-action.rx-primary .rx-quick-icon { background: var(--em); color: var(--emd); }
.rx-quick-action span:last-child { font-size: 11px; color: var(--txt2); }
.rx-quick-action:hover .rx-quick-icon { filter: brightness(1.1); }

.rx-list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; }
.rx-list-row + .rx-list-row { border-top: .5px solid var(--line); }
.rx-list-left { display: flex; align-items: center; gap: 10px; }
.rx-list-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rx-list-icon.up { background: var(--emd); color: var(--em); }
.rx-list-icon.vio { background: var(--viod); color: var(--vio); }
.rx-list-icon.muted { background: #182338; color: var(--txt2); }
.rx-list-title { font-size: 13px; color: var(--txt); font-weight: 500; }
.rx-list-sub { font-size: 11px; color: var(--txt2); }
.rx-list-amount { font-size: 13px; font-weight: 600; }
.rx-list-amount.up { color: var(--em); }
.rx-list-amount.vio { color: var(--vio); }
.rx-list-amount.muted { color: var(--txt2); }

@media (max-width: 480px) {
  .rx-hero-value { font-size: 26px; }
}

/* ============================================================
   Coquille mono-colonne (app mobile-first, centrée même en desktop)
   ============================================================ */
body.rx-app { background: var(--bg); }
.rx-shell { max-width: 460px; margin: 0 auto; padding: 18px 16px 24px; min-height: 100vh; }
body.rx-has-bottom-nav .rx-shell { padding-bottom: 90px; }

.rx-app-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 0 18px; }
.rx-app-header-left { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.rx-app-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--em); color: var(--emd); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; overflow: hidden; flex-shrink: 0; }
.rx-app-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rx-app-greeting-xs { display: block; font-size: 11px; color: var(--txt2); }
.rx-app-greeting-name { display: block; font-size: 14px; font-weight: 600; color: var(--txt); }
.rx-app-title { font-family: 'Sora', sans-serif; font-size: 19px; font-weight: 600; color: var(--txt); }
.rx-header-icon-btn { position: relative; background: none; border: none; color: var(--txt2); font-size: 20px; cursor: pointer; padding: 6px; text-decoration: none; display: inline-flex; }
.rx-header-icon-btn:hover { color: var(--em); }
.rx-bell-dot { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

.rx-back-header { display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; padding: 2px 0 18px; gap: 8px; }
.rx-back-header .rx-back-btn { color: var(--txt2); font-size: 20px; text-decoration: none; display: inline-flex; }
.rx-back-header .rx-back-btn:hover { color: var(--em); }
.rx-back-header .rx-app-title { text-align: center; font-size: 16px; }

.rx-app-header-left { border: none; background: none; padding: 0; cursor: pointer; }

/* ============================================================
   Menu tiroir (drawer) — ouvert au clic sur l'avatar de l'en-tête
   ============================================================ */
.rx-drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1200;
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
}
.rx-drawer-overlay.open { opacity: 1; visibility: visible; }
.rx-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 82%; max-width: 320px; z-index: 1300;
  background: var(--screen); border-right: .5px solid var(--line);
  transform: translateX(-100%); transition: transform .25s ease;
  overflow-y: auto; padding-bottom: 20px;
}
.rx-drawer.open { transform: translateX(0); }
.rx-drawer-head { display: flex; align-items: center; gap: 10px; padding: 18px 16px 12px; }
.rx-drawer-sep { border-top: .5px solid var(--line); margin: 8px 0; }
.rx-drawer-nav { display: flex; flex-direction: column; padding: 4px 8px; }
.rx-drawer-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 10px;
  color: var(--txt); text-decoration: none; font-size: 13px;
}
.rx-drawer-nav a i { width: 18px; text-align: center; color: var(--txt2); font-size: 16px; }
.rx-drawer-nav a:hover { background: rgba(var(--em-rgb), .08); }

/* Dropdown Bootstrap réutilisé pour les notifications, aligné sur le thème sombre */
.dropdown-menu { background: var(--screen); border: .5px solid var(--line); }
.dropdown-menu .dropdown-item { color: var(--txt); }
.dropdown-menu .dropdown-item:hover { background: rgba(var(--em-rgb), .1); color: var(--txt); }

/* ============================================================
   Écrans d'authentification (Register / Login) — flat, sans verre/flou
   ============================================================ */
.rx-auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--bg); position: relative; z-index: 1; }
.rx-auth-card { width: 100%; max-width: 440px; background: var(--screen); border: .5px solid var(--line); border-radius: 24px; padding: 32px 24px; }
.rx-auth-logo { width: 60px; height: 60px; border-radius: 16px; background: var(--em); display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; overflow: hidden; color: var(--emd); font-size: 28px; }
.rx-auth-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.rx-auth-title { font-family: 'Sora', sans-serif; font-size: 26px; font-weight: 700; color: var(--txt); text-align: center; margin-bottom: 6px; }
.rx-auth-subtitle { color: var(--txt2); text-align: center; font-size: 13px; margin-bottom: 26px; line-height: 1.5; }

.rx-form-group { margin-bottom: 12px; }
.rx-label { display: block; font-size: 11px; color: var(--txt3); margin-bottom: 6px; font-weight: 500; }
.rx-field { background: #0E1728; border: .5px solid var(--line); border-radius: 12px; padding: 0 14px; display: flex; align-items: center; gap: 10px; transition: border-color .2s ease, box-shadow .2s ease; }
.rx-field:focus-within { border-color: var(--em); box-shadow: 0 0 0 3px rgba(var(--em-rgb), 0.12); }
.rx-field > i { font-size: 16px; color: var(--txt3); flex-shrink: 0; }
.rx-field input, .rx-field select { flex: 1; min-width: 0; width: 100%; background: transparent; border: none; outline: none; color: var(--txt); font-size: 14px; font-family: 'Inter', sans-serif; padding: 12px 0; }
.rx-field input::placeholder { color: var(--txt3); }
.rx-field select { cursor: pointer; }
.rx-field select option { background: var(--screen); color: var(--txt); }
.rx-field-btn { background: none; border: none; color: var(--txt3); cursor: pointer; padding: 8px; display: flex; align-items: center; }
.rx-field-btn:hover { color: var(--em); }
.rx-field.rx-field-accent { border-color: var(--em); }
.rx-field.rx-field-accent > i { color: var(--em); }
.rx-field-split { display: flex; gap: 10px; }
.rx-field-split .rx-field:first-child { flex: 0 0 auto; }
.rx-field-split .rx-field:last-child { flex: 1; }

.rx-checkbox-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 18px; font-size: 12px; color: var(--txt2); flex-wrap: wrap; }
.rx-checkbox-row label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.rx-checkbox-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--em); margin-top: 1px; flex-shrink: 0; }

.rx-link { color: var(--em); text-decoration: none; font-size: 12px; }
.rx-link:hover { text-decoration: underline; }

.rx-divider { display: flex; align-items: center; gap: 12px; color: var(--txt3); font-size: 11px; margin: 18px 0; }
.rx-divider::before, .rx-divider::after { content: ''; flex: 1; border-bottom: .5px solid var(--line); }

.rx-auth-alert { background: rgba(var(--red-rgb), 0.1); border: 1px solid rgba(var(--red-rgb), 0.3); border-radius: 12px; color: var(--red); padding: 12px 16px; margin-bottom: 16px; font-size: 13px; }
.rx-auth-alert ul { margin: 0; padding-left: 18px; }
.rx-auth-alert.rx-alert-success { background: rgba(var(--em-rgb), 0.1); border-color: rgba(var(--em-rgb), 0.3); color: var(--em); }

.rx-auth-footnote { text-align: center; color: var(--txt3); font-size: 12px; margin-top: 20px; line-height: 1.6; }
.rx-auth-footnote a { color: var(--em); text-decoration: none; }
.rx-auth-footnote a:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .rx-auth-card { padding: 24px 18px; border-radius: 18px; }
  .rx-auth-title { font-size: 22px; }
}

.rx-fee-box { background: rgba(var(--em-rgb), 0.08); border: 1px solid rgba(var(--em-rgb), 0.25); border-radius: 12px; padding: 12px 14px; font-size: 12px; color: var(--txt2); line-height: 1.7; }

/* Alertes Bootstrap génériques (résultat JS dynamique) alignées sur le thème sombre */
.alert-success { background: rgba(var(--em-rgb), 0.12); border-color: rgba(var(--em-rgb), 0.35); color: var(--em); }
.alert-danger { background: rgba(var(--red-rgb), 0.12); border-color: rgba(var(--red-rgb), 0.35); color: var(--red); }

.rx-hidden { display: none !important; }

/* Ligne de menu (Profil, Paramètres, etc.) */
.rx-menu-link { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; text-decoration: none; color: var(--txt); font-size: 14px; }
.rx-menu-link + .rx-menu-link { border-top: .5px solid var(--line); }
.rx-menu-link .rx-menu-left { display: flex; align-items: center; gap: 12px; }
.rx-menu-link .rx-menu-left i { font-size: 17px; color: var(--txt2); width: 20px; text-align: center; }
.rx-menu-link .bi-chevron-right { color: var(--txt3); font-size: 13px; }
.rx-menu-link.danger { color: var(--red); }
.rx-menu-link.danger i { color: var(--red); }

/* Interrupteur (toggle) */
.rx-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.rx-switch input { opacity: 0; width: 0; height: 0; }
.rx-switch .rx-switch-slider { position: absolute; inset: 0; background: #182338; border-radius: 24px; transition: .2s; cursor: pointer; }
.rx-switch .rx-switch-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: var(--txt2); border-radius: 50%; transition: .2s; }
.rx-switch input:checked + .rx-switch-slider { background: var(--emd); }
.rx-switch input:checked + .rx-switch-slider::before { transform: translateX(20px); background: var(--em); }

/* Focus clavier visible (règle du brief) */
a:focus-visible, button:focus-visible, input:focus-visible, .rx-field:focus-visible {
  outline: 2px solid var(--em);
  outline-offset: 2px;
}
