/**
 * France Cascade - Interactive Department Map Stylesheet
 */

:root {
  --fc-map-primary: #f59e0b;
  --fc-map-primary-hover: #fbbf24;
  --fc-map-dark: #111827;
  --fc-map-bg-light: #111827;
  --fc-map-border: #334155;
  --fc-map-radius: 8px;
  
  /* Choropleth Density Scale */
  --fc-color-level-0: #334155;
  --fc-color-level-1: #a16207;
  --fc-color-level-2: #d97706;
  --fc-color-level-3: #ea580c;
  --fc-color-level-4: #ef4444;
}

.fc-map-wrapper {
  position: relative;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto 30px auto;
}

/* --- Filter Bar --- */
.fc-map-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #222;
  border-radius: var(--fc-map-radius);
}

.fc-map-filter-label {
  font-weight: 600;
  font-size: 14px;
  margin-right: 5px;
}

.fc-map-filter-btn {
  background: #1e293b;
  border: 1px solid #475569;
  color: #e2e8f0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fc-map-filter-btn:hover {
  background: #334155;
  color: #ffffff;
}

.fc-map-filter-btn.active { 
  background: #df0000;
  color: #111827;
  border-color: #df0000;
}

.fc-map-badge {
  display: inline-block;
  background: rgba(0,0,0,0.15);
  color: inherit;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 4px;
}

/* --- Map SVG Container --- */
.fc-map-container {
  position: relative;
  width: 100%;
  background: #282828;
  border-radius: var(--fc-map-radius);
  padding: 22px;
  box-sizing: border-box;
  /* ensure the map fits the frame exactly (no scroll) */
  overflow: hidden;
}

.fc-map-svg-holder {
  width: 100%;
  /* use a responsive aspect ratio so the SVG scales to fit the frame */
  aspect-ratio: 16 / 10;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fc-map-svg {
  width: 100%;
  height: 100%;
  max-height: none;
  display: block;
}

/* Ensure any included SVG scales to its container and cannot overflow */
.fc-map-container svg,
.fc-map-svg-holder svg,
.fc-map-svg svg {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block !important;
}

/* --- Dynamic Choropleth Fill Colors --- */
.fc-map-dept[data-level="0"], .departement[data-level="0"] { fill: var(--fc-color-level-0) !important; }
.fc-map-dept[data-level="1"], .departement[data-level="1"] { fill: var(--fc-color-level-1) !important; }
.fc-map-dept[data-level="2"], .departement[data-level="2"] { fill: var(--fc-color-level-2) !important; }
.fc-map-dept[data-level="3"], .departement[data-level="3"] { fill: var(--fc-color-level-3) !important; }
.fc-map-dept[data-level="4"], .departement[data-level="4"] { fill: var(--fc-color-level-4) !important; }

.fc-map-dept,
.departement[data-numerodepartement] {
  stroke: #94a3b8;
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.18));
  cursor: pointer;
  transition: fill 0.2s ease, stroke 0.2s ease, filter 0.2s ease;
}

.fc-map-dept:hover,
.fc-map-dept.hovered,
.departement[data-numerodepartement]:hover,
.departement[data-numerodepartement].hovered {
  stroke: #fde68a;
  stroke-width: 1.8;
  filter: drop-shadow(0 0 8px rgba(245, 77, 11, 0.7));
}

.fc-map-dept.active,
.departement[data-numerodepartement].active {
  stroke: #fff7d6;
  stroke-width: 2.4;
  filter: drop-shadow(0 0 12px #df0000);
}

/* --- Floating Tooltip --- */
.fc-map-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -120%);
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  padding: 8px 12px;
  border: 1px solid rgba(148, 163, 184, 0.48);
  border-radius: 6px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 100;
  backdrop-filter: blur(10px);
  white-space: nowrap;
}

.fc-map-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

.fc-tooltip-title {
  font-weight: 700;
  font-size: 14px;
  display: block;
}

.fc-tooltip-count {
  font-size: 12px;
  color: #fbbf24;
}

/* --- Legend --- */
.fc-map-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 15px;
  padding: 10px 15px;
  background: #222;
  border-radius: var(--fc-map-radius);
  font-size: 12px;
}

.fc-legend-items {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.fc-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fc-legend-color {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.1);
}

.fc-legend-color.level-0 { background: var(--fc-color-level-0); }
.fc-legend-color.level-1 { background: var(--fc-color-level-1); }
.fc-legend-color.level-2 { background: var(--fc-color-level-2); }
.fc-legend-color.level-3 { background: var(--fc-color-level-3); }
.fc-legend-color.level-4 { background: var(--fc-color-level-4); }

/* --- Members Display Panel --- */
.fc-map-members-panel {
  margin-top: 25px;
  background: #222;
  border-radius: var(--fc-map-radius);
  padding: 20px;
}

.fc-map-members-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #df0000;
}

.fc-map-members-header h3 {
  margin: 0;
  font-size: 18px;
  color: #f8fafc;
}

.fc-map-select-all-btn {
  margin-left: auto;
  margin-right: 12px;
  padding: 6px 10px;
  border: 1px solid #df0000;
  border-radius: 4px;
  background: transparent;
  color: #f8fafc;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.fc-map-select-all-btn:hover,
.fc-map-select-all-btn[aria-pressed="true"] {
  background: #df0000;
  color: #ffffff;
}

.fc-map-close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #666;
  cursor: pointer;
}

.fc-map-members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.fc-member-card {
  display: flex;
  position: relative;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: #111;
  border-radius: 8px;
  text-align: center;
}


.fc-member-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.fc-member-avatar {
  width: 150px;
  height: 150px!important;
  border-radius: 4px!important;
  object-fit: cover;
  margin-bottom: 8px;
}

.fc-member-name {
  font-weight: 700;
  font-size: 15px;
  margin: 0;
  color: #f8fafc;
}

.fc-member-role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  background: #334155;
  color: #e2e8f0;
  margin-top: 10px;
}

.fc-member-select-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  position: absolute;
  top: 18px;
  right: 30px;
  z-index: 1;
  margin: 0;
  padding: 0;
  border: 1px solid #df0000;
  border-radius: 50%;
  background-color: #df0000;
  color: #f8fafc;
  cursor: pointer;
}

.fc-member-select-btn i {
  font-family: Arial, sans-serif !important;
  font-size: 22px;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
}

.fc-member-select-btn i.fa-plus::before {
  content: '+';
}

.fc-member-select-btn i.fa-minus::before {
  content: '-';
}

.fc-member-select-btn:hover,
.fc-member-select-btn.delseltalent {
  background: #df0000;
  color: #ffffff;
}

/* hide the old profile button if present */
.fc-member-profile-btn { display: none !important; }

.fc-member-link:hover .fc-member-avatar {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}

/* --- Accessible Table Details --- */
.fc-map-accessible-details {
  margin-top: 25px;
  background: #222;
  border-radius: var(--fc-map-radius);
  padding: 12px 16px;
}

.fc-map-accessible-details summary {
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  color: #f8fafc;
}

.fc-map-table-responsive {
  margin-top: 15px;
  max-height: 350px;
  overflow-y: auto;
}

.fc-map-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.fc-map-table th, .fc-map-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #ccc;
  text-align: left;
}

.fc-map-table th {
  background: #aaa;
  font-weight: 700;
}

/* Loading Spinner */
.fc-map-loading {
  text-align: center;
  padding: 30px;
  font-weight: 600;
  color: #64748b;
}

@media (max-width: 600px) {
  .fc-map-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .fc-map-filter-btn {
    text-align: center;
  }
  .fc-map-members-grid {
    grid-template-columns: 1fr;
  }
}
