/**
 * Portail client — thème v2 cockpit (opt-in via toggle JS).
 * Activation: body.client-portal.theme-v2-preview (le portail ne dépend pas de ThemeV2 côté employé).
 */

html body.client-portal.theme-v2-preview {
  background-color: var(--v2-bg0) !important;
  background-image: linear-gradient(180deg, var(--v2-bg1) 0%, var(--v2-bg0) 100%) !important;
  color: rgba(255, 255, 255, 0.92) !important;
}

html body.client-portal.theme-v2-preview .container,
html body.client-portal.theme-v2-preview .container-fluid {
  background: transparent !important;
  color: inherit !important;
}

/* Navbar portail Option A : verre cockpit + accent --cp-accent (#587AB1) */
html body.client-portal.theme-v2-preview .navbar-client {
  background: rgba(14, 26, 58, 0.78) !important;
  border-bottom: 1px solid var(--v2-stroke) !important;
  box-shadow: var(--v2-shadow) !important;
  color: rgba(255, 255, 255, 0.92) !important;
}

html body.client-portal.theme-v2-preview .navbar-client::before {
  background: var(--cp-accent, #587AB1) !important;
  opacity: 1;
}

html body.client-portal.theme-v2-preview .navbar-client .navbar-brand,
html body.client-portal.theme-v2-preview .navbar-client .navbar-brand *,
html body.client-portal.theme-v2-preview .navbar-client .nav-link,
html body.client-portal.theme-v2-preview .navbar-client .nav-link span,
html body.client-portal.theme-v2-preview .navbar-client .navbar-text,
html body.client-portal.theme-v2-preview .navbar-client .cp-profile-link {
  color: rgba(255, 255, 255, 0.88) !important;
}

html body.client-portal.theme-v2-preview .navbar-client .navbar-brand small {
  color: var(--v2-muted) !important;
}

html body.client-portal.theme-v2-preview .navbar-client .cp-navicon {
  color: var(--cp-accent, #587AB1) !important;
}

html body.client-portal.theme-v2-preview .navbar-client .nav-link:hover,
html body.client-portal.theme-v2-preview .navbar-client .nav-link.active,
html body.client-portal.theme-v2-preview .navbar-client .cp-profile-link:hover,
html body.client-portal.theme-v2-preview .navbar-client .cp-profile-link--active {
  color: #fff !important;
  background-color: rgba(var(--cp-accent-rgb, 88, 122, 177), 0.22) !important;
}

html body.client-portal.theme-v2-preview .navbar-client .nav-link.active::after {
  background: var(--cp-accent, #587AB1) !important;
}

html body.client-portal.theme-v2-preview .navbar-client .btn.cp-nav-btn {
  border-color: rgba(var(--cp-accent-rgb, 88, 122, 177), 0.55) !important;
  color: rgba(255, 255, 255, 0.95) !important;
  background: rgba(var(--cp-accent-rgb, 88, 122, 177), 0.18) !important;
}

html body.client-portal.theme-v2-preview .navbar-client .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%28255, 255, 255, 0.92%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Bandeau module (cp-module-header) — accent portail */
html body.client-portal.theme-v2-preview .cp-module-header {
  background: linear-gradient(135deg, rgba(var(--cp-accent-rgb, 88, 122, 177), 0.55), rgba(14, 26, 58, 0.72)) !important;
  border: 1px solid var(--v2-stroke) !important;
  box-shadow: var(--v2-shadow) !important;
}

html body.client-portal.theme-v2-preview .cp-module-header .btn {
  background: rgba(255, 255, 255, 0.10) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: rgba(255, 255, 255, 0.95) !important;
}

html body.client-portal.theme-v2-preview .cp-module-header .form-control,
html body.client-portal.theme-v2-preview .cp-module-header .form-select {
  background: rgba(255, 255, 255, 0.10) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: rgba(255, 255, 255, 0.95) !important;
}

/* Cartes listées (tickets/machines/...) */
html body.client-portal.theme-v2-preview .ticket-card,
html body.client-portal.theme-v2-preview .machine-card,
html body.client-portal.theme-v2-preview .employe-card,
html body.client-portal.theme-v2-preview .facture-card,
html body.client-portal.theme-v2-preview .devis-card,
html body.client-portal.theme-v2-preview .procedure-card,
html body.client-portal.theme-v2-preview .cp-procedure-card,
html body.client-portal.theme-v2-preview .faq-card,
html body.client-portal.theme-v2-preview .cp-faq-card,
html body.client-portal.theme-v2-preview .card {
  background: rgba(14, 26, 58, 0.55) !important;
  border: 1px solid var(--v2-stroke) !important;
  box-shadow: var(--v2-shadow) !important;
  color: rgba(255, 255, 255, 0.92) !important;
}

html body.client-portal.theme-v2-preview .card-header,
html body.client-portal.theme-v2-preview .card-header.bg-white {
  background: rgba(6, 11, 26, 0.55) !important;
  border-bottom: 1px solid var(--v2-stroke) !important;
  color: rgba(255, 255, 255, 0.95) !important;
}

html body.client-portal.theme-v2-preview .badge.bg-light,
html body.client-portal.theme-v2-preview .badge.bg-light.text-dark,
html body.client-portal.theme-v2-preview .badge.text-bg-light {
  background: rgba(255, 255, 255, 0.12) !important;
  color: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid var(--v2-stroke) !important;
}

/* cas fréquent: <span class="badge bg-light text-dark"> */
html body.client-portal.theme-v2-preview .badge.bg-light.text-dark,
html body.client-portal.theme-v2-preview .badge.bg-light.text-dark.border {
  color: rgba(255, 255, 255, 0.92) !important;
  border-color: var(--v2-stroke) !important;
}

html body.client-portal.theme-v2-preview .text-muted {
  color: var(--v2-muted) !important;
}

html body.client-portal.theme-v2-preview .bg-light {
  background-color: rgba(255, 255, 255, 0.06) !important;
  color: rgba(255, 255, 255, 0.9) !important;
}

html body.client-portal.theme-v2-preview code.bg-light,
html body.client-portal.theme-v2-preview pre.bg-light,
html body.client-portal.theme-v2-preview .border.rounded.bg-light,
html body.client-portal.theme-v2-preview .border.rounded.p-2.bg-light {
  background-color: rgba(6, 11, 26, 0.45) !important;
  border-color: var(--v2-stroke) !important;
  color: rgba(255, 255, 255, 0.9) !important;
}

/* Cartes "blanches" définies en inline CSS dans les vues portail */
html body.client-portal.theme-v2-preview .ticket-card,
html body.client-portal.theme-v2-preview .machine-card,
html body.client-portal.theme-v2-preview .employe-card,
html body.client-portal.theme-v2-preview .facture-card,
html body.client-portal.theme-v2-preview .devis-card,
html body.client-portal.theme-v2-preview .procedure-card,
html body.client-portal.theme-v2-preview .cp-procedure-card,
html body.client-portal.theme-v2-preview .faq-card,
html body.client-portal.theme-v2-preview .cp-faq-card,
html body.client-portal.theme-v2-preview .stat-card,
html body.client-portal.theme-v2-preview .cp-group {
  background: rgba(14, 26, 58, 0.55) !important;
  border: 1px solid var(--v2-stroke) !important;
  box-shadow: var(--v2-shadow) !important;
  color: rgba(255, 255, 255, 0.92) !important;
}

html body.client-portal.theme-v2-preview .cp-dashboard-subtitle {
  color: var(--v2-muted) !important;
}

html body.client-portal.theme-v2-preview .cp-hub-section-title {
  color: rgba(255, 255, 255, 0.95) !important;
}

html body.client-portal.theme-v2-preview .cp-hub-section-sub,
html body.client-portal.theme-v2-preview .cp-hub-tile-desc {
  color: var(--v2-muted) !important;
}

html body.client-portal.theme-v2-preview .cp-hub-tile {
  background: rgba(14, 26, 58, 0.55) !important;
  border-color: rgba(var(--cp-accent-rgb, 88, 122, 177), 0.35) !important;
  box-shadow: var(--v2-shadow) !important;
  color: rgba(255, 255, 255, 0.92) !important;
}

html body.client-portal.theme-v2-preview .cp-hub-tile:hover,
html body.client-portal.theme-v2-preview .cp-hub-tile:focus-visible {
  border-color: var(--cp-accent, #587AB1) !important;
}

html body.client-portal.theme-v2-preview .cp-hub-tile-ico {
  background: rgba(var(--cp-accent-rgb, 88, 122, 177), 0.18) !important;
  border-color: rgba(var(--cp-accent-rgb, 88, 122, 177), 0.35) !important;
  color: var(--cp-accent, #587AB1) !important;
}

html body.client-portal.theme-v2-preview .cp-hub-tile-value,
html body.client-portal.theme-v2-preview .cp-hub-tile-meta {
  color: var(--cp-accent, #587AB1) !important;
}

/* Inputs génériques */
html body.client-portal.theme-v2-preview .form-control,
html body.client-portal.theme-v2-preview .form-select,
html body.client-portal.theme-v2-preview textarea {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid var(--v2-stroke) !important;
  color: rgba(255, 255, 255, 0.95) !important;
}

html body.client-portal.theme-v2-preview label,
html body.client-portal.theme-v2-preview .form-label {
  color: rgba(255, 255, 255, 0.88) !important;
}

/* Modale globale du portail (#appModal dans layout) */
html body.client-portal.theme-v2-preview #appModal .modal-content {
  background: rgba(14, 26, 58, 0.98) !important;
  border: 1px solid var(--v2-stroke) !important;
  box-shadow: var(--v2-shadow) !important;
  color: rgba(255, 255, 255, 0.92) !important;
}

html body.client-portal.theme-v2-preview #appModal .modal-header {
  background: linear-gradient(135deg, rgba(var(--cp-accent-rgb, 88, 122, 177), 0.55), rgba(14, 26, 58, 0.72)) !important;
  border-bottom: 1px solid var(--v2-stroke) !important;
}

html body.client-portal.theme-v2-preview #appModal .modal-title,
html body.client-portal.theme-v2-preview #appModal .modal-title * {
  color: #fff !important;
}

html body.client-portal.theme-v2-preview #appModal .cp-modal-title-icon {
  color: rgba(var(--cp-accent-rgb, 88, 122, 177), 0.95) !important;
}

html body.client-portal.theme-v2-preview #appModal .modal-body {
  background: rgba(6, 11, 26, 0.55) !important;
}

html body.client-portal.theme-v2-preview #appModal .modal-footer {
  background: rgba(6, 11, 26, 0.65) !important;
  border-top: 1px solid var(--v2-stroke) !important;
}

/* Modales portail: certains partials ciblent data-modal-context et injectent du legacy */
html body.client-portal.theme-v2-preview #appModal[data-modal-module="client-portal"] .modal-header {
  background: linear-gradient(135deg, rgba(var(--cp-accent-rgb, 88, 122, 177), 0.55), rgba(14, 26, 58, 0.72)) !important;
  border-bottom: 1px solid var(--v2-stroke) !important;
}

html body.client-portal.theme-v2-preview #appModal[data-modal-module="client-portal"] .modal-body {
  background: rgba(6, 11, 26, 0.55) !important;
}

/* Boutons cluster header (client-portal-modals.css) — glass v2 */
html body.client-portal.theme-v2-preview #appModal[data-modal-module="client-portal"] .modal-header .erp-modal-header-actions .btn,
html body.client-portal.theme-v2-preview #appModal[data-modal-module="client-portal"] .modal-header .erp-modal-header-actions a.btn,
html body.client-portal.theme-v2-preview #appModal[data-modal-module="client-portal"] .modal-header [id$="DetailsActionsHeader"] .btn,
html body.client-portal.theme-v2-preview #appModal[data-modal-module="client-portal"] .modal-header [id$="DetailsActionsHeader"] a.btn {
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  color: rgba(255, 255, 255, 0.95) !important;
}

html body.client-portal.theme-v2-preview #appModal[data-modal-module="client-portal"] .modal-header .erp-modal-header-actions .btn:hover,
html body.client-portal.theme-v2-preview #appModal[data-modal-module="client-portal"] .modal-header .erp-modal-header-actions a.btn:hover,
html body.client-portal.theme-v2-preview #appModal[data-modal-module="client-portal"] .modal-header [id$="DetailsActionsHeader"] .btn:hover,
html body.client-portal.theme-v2-preview #appModal[data-modal-module="client-portal"] .modal-header [id$="DetailsActionsHeader"] a.btn:hover {
  background: rgba(255, 255, 255, 0.20) !important;
  border-color: rgba(255, 255, 255, 0.40) !important;
}

