/* ══ PORTFOLIO SINERGI SA — styles ═════════════════════════════════════════ */

/* == BASE == */
* { box-sizing: border-box; }
body, .content-wrapper, .right-side,
.sidebar-menu > li > a, label,
.selectize-input, .form-control, .btn,
p, h1, h2, h3, h4, h5, h6, span, div {
  font-family: 'Work Sans', 'Segoe UI', sans-serif !important;
}
body, .content-wrapper, .right-side { background-color: #f7f4f0 !important; color: #2c2018 !important; }

/* Focus clavier visible */
a:focus-visible, button:focus-visible, .btn:focus-visible,
.selectize-input.focus, input:focus-visible {
  outline: 2px solid #a98c4e !important; outline-offset: 2px;
}
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }

/* == HEADER == */
.main-header .navbar,
.main-header .logo        { background-color:#522400 !important; border-bottom:3px solid #a98c4e !important; }
.main-header .logo        { color:white !important; font-weight:700 !important; }
.main-header .logo:hover  { background-color:#3d1a00 !important; }
.main-header .navbar .sidebar-toggle,
.main-header .navbar .sidebar-toggle:hover { color:white !important; }

/* == SIDEBAR == */
.main-sidebar { background-color:#1c1208 !important; }
.sidebar-logo { background:#fff; text-align:center; box-shadow:0 2px 4px rgba(0,0,0,0.1); padding:6px 0; }
.sidebar-menu > li > a {
  color:#fff !important; font-size:13px !important; font-weight:500;
  padding:10px 15px 10px 20px; border-left:3px solid transparent;
}
.sidebar-menu > li.active > a,
.sidebar-menu > li:hover > a { background-color:#522400 !important; border-left:3px solid #a98c4e !important; color:white !important; }
.sidebar-menu > li > a > i   { color:#fff !important; margin-right:10px; }
.sidebar .shiny-input-container label {
  color:#fff !important; font-size:11px !important;
  text-transform:uppercase; letter-spacing:1px; font-weight:600;
}
.sidebar-field { padding:0 14px; }
.sidebar .shiny-input-container { margin-bottom:10px !important; }
.sidebar .selectize-input {
  background:#fff !important; color:#000 !important;
  border:1px solid #4a3520 !important; border-radius:0 !important; font-size:12px !important;
}
.sidebar .selectize-input.focus { border-color:#a98c4e !important; }
.sidebar .selectize-dropdown    { background:#2a1e12 !important; color:#e8d8c0 !important; border:1px solid #4a3520 !important; }
.sidebar .selectize-dropdown-content .option { color:#e8d8c0 !important; font-size:12px; padding:6px 12px; }
.sidebar .selectize-dropdown-content .option:hover,
.sidebar .selectize-dropdown-content .option.active { background:#522400 !important; color:white !important; }
.sidebar .form-control {
  background:#2a1e12 !important; color:#e8d8c0 !important;
  border:1px solid #4a3520 !important; border-radius:0 !important; font-size:12px !important;
}
.sidebar hr { border-color:#3a2a18 !important; margin:12px 14px; }
.sidebar-section-label {
  padding:8px 14px 3px; color:#fff;
  font-size:11px; text-transform:uppercase; letter-spacing:1.5px; font-weight:700;
}
.btn-sidebar-refresh {
  background:#522400 !important; border:none !important; color:white !important;
  font-weight:600 !important; width:calc(100% - 28px); margin:4px 14px;
  border-radius:0 !important; font-size:12px !important; letter-spacing:0.5px;
}
.btn-sidebar-refresh:hover { background:#a98c4e !important; }
.btn-sidebar-reset {
  background:transparent !important; border:1px solid #6b5338 !important;
  color:#e0d2b8 !important; width:calc(100% - 28px); margin:4px 14px;
  border-radius:0 !important; font-size:12px !important;
}
.btn-sidebar-reset:hover { background:#522400 !important; color:white !important; border-color:#522400 !important; }

/* == TITRES / EN-TÊTE DE PAGE == */
.page-header {
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px;
  margin-bottom:22px; padding-bottom:14px; border-bottom:1px solid #e0d8ce;
}
.page-header-tools { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
h2.page-title {
  font-size:1.2rem; font-weight:700; color:#522400; margin:0;
  letter-spacing:0.06em; text-transform:uppercase;
  border-left:4px solid #a98c4e; padding-left:12px;
}
.result-badge {
  background:#522400; color:white; padding:5px 16px;
  font-size:12px; font-weight:600; letter-spacing:0.5px;
  display:inline-flex; align-items:center; gap:6px;
}

/* == CARTES PORTFOLIO (grille responsive) == */
.cards-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:24px; }
.card-entrepreneur {
  background:white; padding:22px 18px;
  box-shadow:0 2px 12px rgba(82,36,0,0.07); transition:all 0.25s ease;
  text-align:center; min-height:300px; display:flex; flex-direction:column;
  justify-content:space-between; border-top:3px solid #cdc6c0; border-radius:0;
}
.card-entrepreneur:hover { transform:translateY(-6px); box-shadow:0 12px 30px rgba(82,36,0,0.14); border-top-color:#522400; }
.logo-wrapper  { width:88px; height:88px; margin:0 auto 12px auto; }
.logo-circle   { width:100%; height:100%; border-radius:50%; object-fit:cover; border:2px solid #cdc6c0; background:#f7f4f0; }
.logo-fallback { width:100%; height:100%; border-radius:50%; display:flex; align-items:center; justify-content:center; background:#522400; color:white; font-size:2rem; font-weight:700; border:2px solid #a98c4e; }
.ent-title     { font-weight:600; color:#2c2018; font-size:0.95rem; line-height:1.3; margin-bottom:8px; }
.badge-sector  { background:#f0ebe3; color:#522400; padding:3px 12px; font-size:0.78rem; font-weight:600; letter-spacing:0.4px; display:inline-block; margin-bottom:8px; }
.card-meta     { color:#5f5249; font-size:13px; margin:3px 0; }
.card-meta span { margin-left:5px; }
.card-programmes { display:flex; flex-wrap:wrap; justify-content:center; gap:4px; margin:8px 0 12px; }
.card-programmes .list-prog { margin:0; }
.btn-detail    { background:#522400; border:none; color:white; padding:9px 20px; font-weight:600; font-size:12px; letter-spacing:0.5px; text-transform:uppercase; width:100%; border-radius:0; transition:background 0.2s; cursor:pointer; }
.btn-detail:hover { background:#8a6f35; color:white; }

/* == KPI BOXES == */
.kpi-box    { padding:24px 20px; color:white; text-align:center; margin-bottom:20px; }
.kpi-box h3 { margin:0 0 5px; font-size:2.1rem; font-weight:700; letter-spacing:-0.02em; }
.kpi-box p  { margin:0; font-size:11px; text-transform:uppercase; letter-spacing:1px; font-weight:600; }
.kpi-brun   { background:#522400; }
.kpi-ocre   { background:#8a6f35; }          /* contraste AA avec texte blanc */
.kpi-rouge  { background:#8f342a; }
.kpi-bleu   { background:#42707c; }
.kpi-vert   { background:#a2bb9b; color:#2c2018 !important; }
.kpi-violet { background:#632f57; }
.kpi-gris   { background:#6f6a64; }
.kpi-vert p { color:#2c2018 !important; }

/* == PLOT CARDS == */
.plot-card { position:relative; background:white; padding:20px; margin-bottom:20px; box-shadow:0 2px 10px rgba(82,36,0,0.06); border-top:3px solid #522400; }
.plot-card-title { color:#522400; font-weight:700; font-size:12px; text-transform:uppercase; letter-spacing:1px; margin-bottom:16px; display:flex; align-items:center; gap:8px; }
.plot-card-title::after { content:''; flex:1; height:1px; background:#e8e0d5; }

/* == INDICATEUR DE CHARGEMENT (graphes, carte, listes en recalcul) == */
.recalculating { opacity:0.35; transition:opacity .2s; }
.plot-card:has(.recalculating)::after {
  content:''; position:absolute; top:50%; left:50%; width:34px; height:34px; margin:-17px 0 0 -17px;
  border:3px solid #e8e0d5; border-top-color:#522400; border-radius:50%;
  animation:spin .8s linear infinite;
}
@keyframes spin { to { transform:rotate(360deg); } }

/* == ÉTAT VIDE == */
.empty-state { text-align:center; padding:80px 20px; color:#8a6f35; }
.empty-state h4 { color:#5f5249; font-weight:600; margin-top:18px; }
.empty-state p  { color:#5f5249; }

/* == TOGGLE GRILLE / LISTE == */
.view-toggle { display:inline-flex; border:1px solid #522400; }
.view-toggle .btn { border:none !important; border-radius:0 !important; background:white !important; color:#522400 !important; font-size:12px !important; font-weight:600 !important; padding:5px 14px !important; }
.view-toggle .btn:hover { background:#f0ebe3 !important; }
.view-toggle .btn.active { background:#522400 !important; color:white !important; }

/* == VUE LISTE == */
.list-view { background:white; box-shadow:0 2px 10px rgba(82,36,0,0.06); border-top:3px solid #522400; margin-bottom:20px; overflow-x:auto; }
.list-view table { width:100%; border-collapse:collapse; font-size:13px; }
.list-view th { background:#f7f4f0; color:#522400; padding:10px 14px; text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.8px; font-weight:700; border-bottom:1px solid #e0d8ce; white-space:nowrap; }
.list-view td { padding:10px 14px; border-bottom:1px solid #f0ebe3; vertical-align:middle; color:#2c2018; }
.list-view tr:hover td { background:#fbf9f6; }
.list-logo { width:36px; height:36px; margin:0; }
.list-logo .logo-circle, .list-logo .logo-fallback { width:36px; height:36px; font-size:1rem; border-width:1px; }
.list-name { font-weight:600; color:#522400; }
.list-prog { display:inline-block; background:#f0ebe3; color:#522400; padding:2px 8px; font-size:12px; font-weight:600; margin:1px 3px 1px 0; }
.btn-detail-sm { background:#522400; border:none; color:white; padding:6px 12px; font-size:12px; font-weight:600; border-radius:0; white-space:nowrap; cursor:pointer; }
.btn-detail-sm:hover { background:#8a6f35; color:white; }

/* == PAGINATION == */
.pagination-bar { text-align:center; padding:20px 0 30px; }
.pagination-bar .btn { border-radius:0 !important; background:white !important; border:1px solid #cdc6c0 !important; color:#522400 !important; font-size:12px !important; font-weight:500 !important; }
.pagination-bar .btn:hover { background:#522400 !important; color:white !important; border-color:#522400 !important; }
.pagination-bar span { margin:0 16px; font-weight:600; font-size:13px; color:#5f5249; }

/* == MODAL / FICHE ENTREPRISE == */
.modal-header { background:#522400; color:white; border-radius:0; border:none; }
.modal-title  { color:white !important; font-weight:700; }
.modal-header .close { color:white !important; opacity:0.8; }
.modal-footer .btn-default { border-radius:0; }
.content-wrapper hr, .modal-body hr { border-color:#e0d8ce; }
.modal-logo { width:32px; height:32px; display:inline-block; vertical-align:middle; margin:0 10px 0 0; }
.modal-logo .logo-fallback { font-size:1rem; border-width:1px; }
.modal-section { padding-left:12px; margin-bottom:12px; }
.modal-section h5 { margin:0; font-weight:700; font-size:12px; text-transform:uppercase; letter-spacing:.8px; }
.modal-section-brun { border-left:3px solid #522400; }
.modal-section-brun h5 { color:#522400; }
.modal-section-ocre { border-left:3px solid #a98c4e; }
.modal-section-ocre h5 { color:#8a6f35; }
.modal-section-vert { border-left:3px solid #42707c; }
.modal-section-vert h5 { color:#42707c; }
.modal-description { white-space:pre-line; line-height:1.6; color:#2c2018; font-size:14px; margin-bottom:4px; }
.modal-table-wrap { overflow-x:auto; }
.modal-table { width:100%; border-collapse:collapse; font-size:13px; }
.modal-table th { background:#522400; color:white; padding:7px 10px; text-align:left; font-weight:600; letter-spacing:.3px; }
.modal-table td { padding:6px 10px; border-bottom:1px solid #e8e0d5; color:#2c2018; }
.modal-table tbody tr:nth-child(even) { background:#f7f4f0; }
.modal-table .mt-prog    { font-weight:600; color:#522400; }
.modal-table .mt-periode { color:#5f5249; font-size:12px; white-space:nowrap; }
.modal-actions { text-align:center; display:flex; gap:10px; justify-content:center; }
.btn-square { border-radius:0; }

/* == RESPONSIVE == */
@media (max-width: 991px) {
  .kpi-box h3 { font-size:1.8rem; }
}
@media (max-width: 767px) {
  .content-wrapper .content { padding:12px; }
  .page-header { margin-bottom:16px; }
  h2.page-title { font-size:1rem; }
  .cards-grid { grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:12px; }
  .card-entrepreneur { min-height:0; padding:16px 12px; }
  .logo-wrapper { width:64px; height:64px; }
  .logo-fallback { font-size:1.5rem; }
  .btn-detail { padding:8px 10px; font-size:11px; }
  .hide-sm { display:none; }
  .list-view td, .list-view th { padding:8px; }
  .kpi-box { padding:16px 12px; margin-bottom:12px; }
  .kpi-box h3 { font-size:1.6rem; }
  .plot-card { padding:14px; }
  .modal-dialog { margin:8px; }
}

/* == IMPRESSION == */
@media print {
  .main-sidebar, .main-header, .pagination-bar, .view-toggle { display:none !important; }
  .content-wrapper { margin-left:0 !important; background:white !important; }
  .plot-card, .kpi-box, .card-entrepreneur { box-shadow:none !important; break-inside:avoid; }
  * { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
}
