/* ===========================================================================
   LOLASMM Panel Polish — contraste + responsive du panneau client connecté.
   Chargé EN DERNIER (priorité max). 100% additif, réversible, zéro logique.
   Itération 1 : tableaux (texte invisible) + cartes dashboard + responsive.
   =========================================================================== */

/* ---------------------------------------------------------------------------
   1. TABLEAUX DU PANNEAU (services, orders, refill, dripfeeds, subscriptions)
   Bug : cellules à fond blanc + texte blanc = invisible. On force fond
   transparent + texte clair, lisible sur le thème sombre.
   --------------------------------------------------------------------------- */
.app-content .table,
.app-content table {
  color: #e2e8f0 !important;
  background-color: transparent !important;
}
.app-content .table thead th,
.app-content table thead th {
  color: #94a3b8 !important;
  background-color: transparent !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.app-content .table tbody td,
.app-content table tbody td {
  color: #e2e8f0 !important;
  background-color: transparent !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  vertical-align: middle;
}
.app-content .table tbody tr:hover td,
.app-content table tbody tr:hover td {
  background-color: rgba(139, 92, 246, 0.07) !important;
}
/* Ligne de catégorie de services bien visible */
.app-content .table.services tr.service-category td,
.app-content #serv-table tr.service-category td {
  color: #c4b5fd !important;
  background-color: rgba(139, 92, 246, 0.10) !important;
  font-weight: 700;
}
/* Liens / icônes dans les tableaux */
.app-content .table a,
.app-content table a { color: #a78bfa !important; }
.app-content .table .icon-details { color: #a78bfa !important; }

/* ---------------------------------------------------------------------------
   2. CARTES DASHBOARD (.dash-intel .us-item) — texte trop pâle (opacity .5)
   --------------------------------------------------------------------------- */
.dash-intel .us-item,
.dash-intel .us-item * { color: #f1f5f9 !important; }
.dash-intel .us-item [style*="opacity"] { opacity: 0.9 !important; }
.dash-intel .us-item a { color: #c4b5fd !important; }

/* ---------------------------------------------------------------------------
   3. RESPONSIVE — tablette / mobile
   --------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  /* Tableaux larges : scroll horizontal propre au lieu de casser la page */
  .app-content .table-responsive { -webkit-overflow-scrolling: touch; }
  .app-content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 767.98px) {
  .app-content .us-item { padding: 0.85rem 1rem !important; }
  .app-content .us-item .ui-text { font-size: 1.45rem !important; }
  /* Cibles tactiles confortables */
  .app-content .btn,
  .app-content .dropdown-toggle,
  .app-content .form-control { min-height: 42px; }
  /* Cartes solde : empilage propre, padding réduit */
  .app-content .us-item .ui-title { font-size: 0.7rem !important; }
}

/* ===========================================================================
   ITÉRATION 2 — modales/dropdowns, boutons uniformes, sidebar responsive
   =========================================================================== */

/* ---- 4. MODALES bien centrées (le popup "~Instant ~Fast ~NR" sortait par-dessus le header) ---- */
.modal { z-index: 1080 !important; }
.modal-backdrop { z-index: 1070 !important; }
.modal.show, .modal.in, .modal[style*="display: block"], .modal[style*="display:block"] {
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.modal .modal-dialog {
  margin: auto !important;
  max-width: 520px;
  width: calc(100% - 32px);
}
.modal .modal-content {
  background: #12121f !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(139, 92, 246, 0.18) !important;
  border-radius: 16px !important;
}
.modal .modal-content .modal-title,
.modal .modal-content .modal-body { color: #e2e8f0 !important; }

/* Dropdown "Service Filter" : s'ouvre sous le bouton, pas par-dessus le header */
.app-content .dropdown-menu.filter-items,
.app-content .dropdown-menu {
  background: #12121f !important;
  border: 1px solid rgba(139, 92, 246, 0.2) !important;
  border-radius: 10px !important;
  max-height: 320px;
  overflow-y: auto;
  z-index: 1040;
}
.app-content .dropdown-menu .dropdown-item { color: #cbd5e1 !important; }
.app-content .dropdown-menu .dropdown-item:hover {
  background: rgba(139, 92, 246, 0.12) !important;
  color: #fff !important;
}

/* ---- 5. BOUTONS UNIFORMES (certains grands / certains petits) ---- */
.app-content .btn {
  border-radius: 10px !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  padding: 0.55rem 1.1rem !important;
  line-height: 1.4 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.app-content .btn-lg { padding: 0.7rem 1.5rem !important; font-size: 1rem !important; }
.app-content .btn-sm { padding: 0.4rem 0.8rem !important; font-size: 0.8rem !important; }
/* Boutons d'action principaux : dégradé elite cohérent */
.app-content .btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #6366f1) !important;
  border: none !important;
  color: #fff !important;
}
.app-content .btn-primary:hover { filter: brightness(1.08); }

/* ---- 6. SIDEBAR RESPONSIVE — drawer propre sur mobile/tablette (≤1024px) ---- */
@media (max-width: 1024px) {
  .app-container .app-sidebar {
    position: fixed !important;
    top: 0; left: 0;
    height: 100% !important;
    width: 264px !important;
    max-width: 82vw;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 1060 !important;
    overflow-y: auto;
  }
  /* dashMenuToggle() ajoute .sidebar-inact → on OUVRE le drawer sur mobile */
  .app-container .app-sidebar.sidebar-inact { transform: translateX(0) !important; }
  .app-content, .app-header,
  .app-content.sidebar-inact, .app-header.sidebar-inact { margin-left: 0 !important; }
  /* Backdrop (overlay créé par lolasmm-responsive.js) */
  .sidebar-overlay, .app-overlay, #sidebarOverlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1055;
    opacity: 0; visibility: hidden;
    transition: opacity 0.25s ease;
  }
  .sidebar-overlay.active, .app-overlay.active, #sidebarOverlay.active {
    opacity: 1; visibility: visible;
  }
  /* Bouton hamburger bien visible/tactile */
  .app-content .dash-menu-btn, .dash-menu-btn {
    display: inline-flex !important;
    align-items: center; justify-content: center;
    width: 44px; height: 44px;
    cursor: pointer;
  }
}

/* ===========================================================================
   ITÉRATION 3 — MOBILE : tableau Services → cartes lisibles (valeurs visibles)
   Le tableau connecté débordait à droite. Les <td> ont data-title → on les
   transforme en cartes label→valeur qui tiennent dans l'écran.
   =========================================================================== */
@media (max-width: 767.98px) {
  .app-content #serv-table thead { display: none; }
  .app-content #serv-table,
  .app-content #serv-table tbody { display: block; width: 100%; overflow: visible !important; }

  /* Ligne de catégorie : bandeau pleine largeur */
  .app-content #serv-table tr.service-category { display: block; }
  .app-content #serv-table tr.service-category td {
    display: block; width: 100%;
    border-radius: 8px; margin: 12px 0 6px;
    white-space: normal; text-align: center;
  }

  /* Chaque service = une carte */
  .app-content #serv-table tr.service {
    display: block;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(139, 92, 246, 0.16);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
  }
  .app-content #serv-table tr.service td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 5px 0; border: none !important;
    white-space: normal; text-align: right; font-size: 0.85rem;
  }
  .app-content #serv-table tr.service td::before {
    content: attr(data-title);
    color: #94a3b8; font-weight: 600; font-size: 0.7rem;
    text-transform: uppercase; letter-spacing: 0.03em;
    flex: 0 0 auto; text-align: left;
  }
  /* Nom du service : pleine largeur en tête de carte */
  .app-content #serv-table tr.service td[data-title="Service"] {
    display: block; text-align: left;
    font-weight: 600; color: #f1f5f9;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding-bottom: 8px; margin-bottom: 6px;
  }
  .app-content #serv-table tr.service td[data-title="Service"]::before { display: none; }

  /* "Service Filter" : cohérent avec le thème sombre (était blanc) */
  .app-content .btn-white {
    background: rgba(139, 92, 246, 0.12) !important;
    color: #c4b5fd !important;
    border: 1px solid rgba(139, 92, 246, 0.25) !important;
  }
  /* Topbar : icônes resserrées, pas de débordement */
  .app-header .container-fluid { flex-wrap: wrap; }
}

