@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

:root {
  --bg-color: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(148, 163, 184, 0.1);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #38bdf8;
  /* Sky blue */
  --accent-glow: rgba(56, 189, 248, 0.3);
  --danger-color: #ef4444;
  --success-color: #22c55e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  background-image:
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* Header */
header {
  width: 100%;
  padding: 2rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 2.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo span {
  font-size: 0.8rem;
  background: var(--card-bg);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--card-border);
  -webkit-text-fill-color: var(--text-secondary);
  color: var(--text-secondary);
}

/* User Menu */
.user-menu-container {
  position: relative;
  cursor: pointer;
}

.user-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.8);
  border: 2px solid var(--danger-color);
  /* Rouge par dÃ©faut (Non connectÃ©) */
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  transition: all 0.3s ease;
  text-transform: uppercase;
}

.user-avatar.connected {
  border: 3px solid var(--success-color);
  /* Vert si connectÃ©, plus Ã©pais */
  background: rgba(15, 23, 42, 0.9);
}

.user-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: 60px;
  /* Un peu plus bas que l'avatar */
  right: 0;
  background: #1e293b;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  width: 260px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 1000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* Pont invisible pour Ã©viter que le menu disparaisse au survol */
.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 0;
  width: 100%;
  height: 20px;
  background: transparent;
}

/* Afficher le menu UNIQUEMENT si connectÃ© (.logged-in) */
.user-menu-container.logged-in:hover .dropdown-menu,
.dropdown-menu:hover {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.dropdown-header {
  display: flex;
  flex-direction: column;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.5rem;
}

.dropdown-header strong {
  font-size: 1rem;
  color: var(--text-primary);
}

.dropdown-header span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.dropdown-menu a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.dropdown-menu a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.logout-item {
  color: var(--danger-color) !important;
}

.logout-item:hover {
  background: rgba(239, 68, 68, 0.1) !important;
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0.2rem 0;
}

/* Main Content */
main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  padding: 4rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  letter-spacing: -0.05em;
  background: linear-gradient(to right, #fff, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fadeInDown 0.8s ease-out;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.2rem;
  max-width: 600px;
  margin-bottom: 3rem;
  animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

/* Connect Button */
.btn-connect {
  padding: 1rem 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--accent-color), #0ea5e9);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  animation: fadeInUp 0.8s ease-out 0.4s backwards;
}

.btn-connect:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.connect-wrapper {
  margin-bottom: 4rem;
}

/* Services Grid */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  width: 100%;
  perspective: 1000px;
  opacity: 0.5;
  /* Default dimmed if logged out */
  filter: blur(2px);
  transition: all 0.5s ease;
  pointer-events: none;
  /* Disabled by default */
}

/* When connected, we remove blur and enable pointer events */
.services-grid.active {
  opacity: 1;
  filter: blur(0);
  pointer-events: all;
}

.service-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 2rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  text-decoration: none;
  color: var(--text-primary);
  transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s;
  position: relative;
  overflow: hidden;
}

.service-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-color);
  background: rgba(30, 41, 59, 0.9);
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(800px circle at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.06), transparent 40%);
  opacity: 0;
  transition: opacity 0.5s;
}

.service-card:hover::before {
  opacity: 1;
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Footer & Legal */
footer {
  margin-top: auto;
  padding: 3rem 1rem;
  width: 100%;
  border-top: 1px solid var(--card-border);
  background: rgba(15, 23, 42, 0.4);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 2rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent-color);
}

.security-notice {
  font-size: 0.75rem;
  color: #64748b;
  max-width: 600px;
  line-height: 1.4;
  margin-top: 1rem;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================= MODALES (Agences & Users) ================= */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.85);
  /* Dark blur */
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    padding: 35px;
    border-radius: 16px;
    width: 95%;
    max-width: 1400px; /* Amplitude maximale SOC */
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: modalAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  color: var(--text-secondary);
  font-size: 1.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close-modal:hover {
  color: var(--danger-color);
}

.modal-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--accent-color);
  background: rgba(56, 189, 248, 0.08);
  border-bottom: 2px solid var(--accent-color);
  box-shadow: inset 0 -10px 10px -10px var(--accent-glow);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 0.8rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
}

.form-control[type="file"] {
  padding: 0.5rem;
}

/* Mobile responsive */
@media (max-width: 768px) {

  /* Header Layout */
  header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .logo {
    font-size: 1.75rem;
    /* Taille rÃ©duite mobile */
    flex-direction: column;
    align-items: center;
  }

  .logo img {
    height: 65px !important;
    width: 75px !important;
  }

  .logo span {
    font-size: 0.7rem;
    margin-top: 0.25rem;
  }

  .vpn-status {
    width: 100%;
    justify-content: center;
    font-size: 0.8rem;
  }

  /* Main Content */
  main {
    padding: 2rem 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  /* Grid 1 colonne */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .service-card {
    padding: 1.5rem;
  }
}

/* ==========================================================================
   COCKPIT HAUTE GOUVERNANCE (ADMIN PILOTAGE)
   ========================================================================== */
.admin-pilotage-container {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 25px;
    margin-top: 15px;
}

.admin-selection-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 25px;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.2);
}

.admin-list-container {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 280px;
    overflow-y: auto;
}

.promotion-search-zone {
    margin-top: 30px;
    background: rgba(0, 168, 232, 0.03);
    border-radius: 12px;
    padding: 30px;
    border: 1px solid rgba(0, 168, 232, 0.2);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.promotion-grid {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

.promotion-grid th {
    text-align: left;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.7;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.promotion-grid td {
    padding: 15px;
    font-size: 0.9em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.promotion-grid tr {
    cursor: pointer;
}

.promotion-grid tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.row-selected {
    background: rgba(0, 168, 232, 0.15) !important;
    box-shadow: inset 5px 0 0 var(--accent-color);
}

.action-bar-promotion {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.promotion-selected-badge {
    margin-right: auto;
    font-size: 0.95em;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.btn-promote {
    background: linear-gradient(135deg, #00a8e8 0%, #0072b1 100%);
    color: white;
    padding: 15px 45px;
    border-radius: 50px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 168, 232, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 15px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.btn-promote:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 168, 232, 0.6);
    filter: brightness(1.2);
}

.btn-promote:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
    cursor: not-allowed;
    filter: grayscale(1);
}

.admin-mini-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid var(--accent-color);
}

/* MODALE DE CONFIRMATION D"AUTORITÉ (ELITE DESIGN) */
.modal-overlay-confirm {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999 !important;
}

.confirm-modal-box {
    background: linear-gradient(145deg, #1e1e1e 0%, #0d0d0d 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 45px;
    width: 95%;
    max-width: 550px;
    text-align: center;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8), 0 0 50px rgba(0, 168, 232, 0.1);
    position: relative;
    overflow: hidden;
}

.confirm-modal-box::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, transparent, #ff9f1c, transparent);
}

.confirm-modal-icon {
    font-size: 3.5rem;
    color: #ff9f1c;
    margin-bottom: 25px;
    filter: drop-shadow(0 0 15px rgba(255, 159, 28, 0.5));
}

.confirm-modal-box h2 {
    font-size: 1.3rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 25px;
}

.confirm-modal-body {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 25px;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: left;
    border-left: 5px solid #ff9f1c;
    margin-bottom: 35px;
    white-space: pre-wrap;
    font-family: "Inter", sans-serif;
}

.confirm-modal-footer {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-cancel-modal, .btn-primary-confirm {
    padding: 14px 40px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-cancel-modal {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-cancel-modal:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-primary-confirm {
    background: linear-gradient(135deg, #e63946 0%, #b01e28 100%);
    color: white;
    border: none;
    box-shadow: 0 10px 25px rgba(230, 57, 70, 0.4);
}

.btn-primary-confirm:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 15px 35px rgba(230, 57, 70, 0.6);
    filter: brightness(1.1);
}


/* --- High Governance : Enrollment Campaign Styles --- */
.sub-tabs { display: flex; gap: 5px; margin-bottom: 15px; }
.tab-btn-sub { background: rgba(255,255,255,0.05); border: none; color: var(--text-secondary); padding: 8px 15px; border-radius: 6px; cursor: pointer; font-size: 0.85em; transition: all 0.2s; }
.tab-btn-sub:hover { background: rgba(255,255,255,0.1); color: white; }
.tab-btn-sub.active { background: var(--accent-light); color: white; font-weight: bold; }
