/* ==============================================================================
   IMT Atlantique • OpenSCHC Deploy
   Charte Graphique Officielle : Bleu Marine (#002D5A), Vert Émeraude (#00A389)
   Motifs Origami / Tangram géométriques
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* IMT Atlantique Brand Palette */
  --imta-navy: #002D5A;
  --imta-navy-dark: #001E3D;
  --imta-navy-light: #004B87;
  
  --imta-green: #00A389;
  --imta-green-hover: #008770;
  --imta-green-light: #E6F7F3;
  --imta-green-glow: rgba(0, 163, 137, 0.18);
  
  --imta-cyan: #00C29E;
  --imta-lime: #9BC53D;

  /* Neutrals */
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --border-color: #E2E8F0;
  --border-focus: #00A389;
  
  --text-main: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  
  /* Status Colors */
  --status-active: #059669;
  --status-pending: #D97706;
  --status-error: #DC2626;
  --status-info: #0284C7;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Spacing & Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(0, 45, 90, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 45, 90, 0.08);
  --shadow-lg: 0 12px 28px rgba(0, 45, 90, 0.12);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: var(--font-mono);
}

/* Origami / Tangram Geometric Background Motif */
.origami-pattern-bg {
  background-color: #002D5A;
  background-image: 
    linear-gradient(135deg, rgba(0, 163, 137, 0.25) 25%, transparent 25%),
    linear-gradient(225deg, rgba(0, 163, 137, 0.25) 25%, transparent 25%),
    linear-gradient(45deg, rgba(0, 75, 135, 0.3) 25%, transparent 25%),
    linear-gradient(315deg, rgba(0, 75, 135, 0.3) 25%, #002D5A 25%);
  background-position: 24px 0, 24px 0, 0 0, 0 0;
  background-size: 48px 48px;
  background-repeat: repeat;
}

/* Header & Navigation */
.navbar {
  background: #FFFFFF;
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 45, 90, 0.05);
}

.navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.brand-logo-img {
  height: 46px;
  width: 46px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0, 45, 90, 0.15);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--imta-navy);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title span {
  color: var(--imta-green);
}

.brand-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--imta-navy);
}

.user-badge-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--imta-navy), var(--imta-green));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Main Container */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* Origami Hero Banner */
.imta-hero-banner {
  background: linear-gradient(135deg, #002D5A 0%, #003B6D 45%, #00A389 100%);
  border-radius: var(--radius-lg);
  color: #FFFFFF;
  padding: 32px 36px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.imta-hero-banner::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  bottom: -20px;
  width: 320px;
  background: url('/static/img/imt_banner.jpg') no-repeat center right / cover;
  opacity: 0.28;
  clip-path: polygon(25% 0%, 100% 0%, 100% 100%, 0% 100%);
  pointer-events: none;
}

.hero-text h1 {
  margin: 0 0 8px;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero-text p {
  margin: 0;
  font-size: 0.98rem;
  opacity: 0.92;
  max-width: 650px;
  line-height: 1.5;
}

.hero-prefix-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

.btn-primary {
  background: var(--imta-green);
  color: #FFFFFF;
  box-shadow: 0 2px 6px var(--imta-green-glow);
}

.btn-primary:hover {
  background: var(--imta-green-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 163, 137, 0.3);
}

.btn-navy {
  background: var(--imta-navy);
  color: #FFFFFF;
}

.btn-navy:hover {
  background: var(--imta-navy-light);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: #CBD5E1;
}

.btn-outline-green {
  background: transparent;
  color: var(--imta-green);
  border: 1.5px solid var(--imta-green);
}

.btn-outline-green:hover {
  background: var(--imta-green-light);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* Cards & Grid */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-box {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--imta-navy);
}

.stat-box.accent-green::before {
  background: var(--imta-green);
}

.stat-box.accent-orange::before {
  background: var(--status-pending);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-val {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--imta-navy);
  margin: 4px 0 2px;
}

.stat-helper {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Devices Table / Cards */
.devices-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header-bar {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  background: #FFFFFF;
}

.card-header-bar h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--imta-navy);
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-row-item {
  border-bottom: 1px solid var(--border-color);
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 2.2fr 1.6fr 1.4fr 1.8fr auto;
  align-items: center;
  gap: 16px;
  transition: background-color 0.15s ease;
}

.device-row-item:last-child {
  border-bottom: none;
}

.device-row-item:hover {
  background-color: #F8FAFC;
}

.device-name-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--imta-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.device-desc-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.ipv6-chip {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--imta-navy);
  font-weight: 700;
}

.ipv6-chip-copy {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.ipv6-chip-copy:hover {
  color: var(--imta-green);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
}

.badge-active {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.badge-pending {
  background: #FFFBEB;
  color: #92400E;
  border: 1px solid #FCD34D;
}

.badge-error {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.badge-neutral {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #E2E8F0;
}

/* Workflow Steps Component */
.workflow-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0;
  padding: 12px 18px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.82rem;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-weight: 600;
}

.step-item.completed {
  color: var(--imta-green);
  font-weight: 700;
}

.step-item.active {
  color: var(--imta-navy);
  font-weight: 800;
}

.step-separator {
  color: #CBD5E1;
  font-size: 0.8rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 30, 61, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 24px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--imta-navy);
}

.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--imta-navy);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text-main);
  background: #FFFFFF;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--imta-green);
  box-shadow: 0 0 0 3px var(--imta-green-glow);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.4;
}

/* Selection Cards (Rules / Connectivity) */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

.option-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  background: #FFFFFF;
  transition: all 0.15s ease;
  position: relative;
}

.option-card:hover {
  border-color: #94A3B8;
  background: var(--bg-subtle);
}

.option-card.selected {
  border-color: var(--imta-green);
  background: var(--imta-green-light);
}

.option-card-title {
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--imta-navy);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.option-card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #FFFFFF;
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--imta-green);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 420px;
  animation: slideInToast 0.25s ease-out;
}

.toast.toast-error {
  border-left-color: var(--status-error);
}

@keyframes slideInToast {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 900px) {
  .navbar-inner {
    height: auto;
    min-height: 64px;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .nav-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .main-content {
    padding: 16px 14px 40px;
  }
  .imta-hero-banner {
    padding: 22px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .imta-hero-banner::after {
    display: none;
  }
  .device-row-item {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }
  .options-grid {
    grid-template-columns: 1fr;
  }
  .card-header-bar {
    padding: 14px 16px;
  }
}

@media (max-width: 600px) {
  .brand-subtitle {
    display: none;
  }
  .hero-text h1 {
    font-size: 1.45rem;
  }
  .stat-val {
    font-size: 1.5rem;
  }
}

/* ==============================================================================
   Infobulles d'aide interactive & Dépannage (Que faire quand ça ne marche pas)
   ============================================================================== */
.help-bubble-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  outline: none;
}

.help-bubble-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  border: 1px solid currentColor;
  background: transparent;
  padding: 0;
  cursor: pointer;
  margin-left: 4px;
  transition: transform 0.15s ease, background-color 0.15s ease;
  flex-shrink: 0;
}

.help-bubble-btn:hover,
.help-bubble-wrap:hover .help-bubble-btn,
.help-bubble-wrap:focus-within .help-bubble-btn {
  transform: scale(1.18);
}

.help-bubble-btn.error {
  color: #DC2626;
  background: #FEE2E2;
  border-color: #FCA5A5;
}
.help-bubble-btn.warning {
  color: #B45309;
  background: #FEF3C7;
  border-color: #FCD34D;
}
.help-bubble-btn.info {
  color: var(--imta-navy);
  background: #E0E7FF;
  border-color: #C7D2FE;
}

.help-bubble-popover {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0F172A;
  color: #F8FAFC;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.76rem;
  line-height: 1.45;
  white-space: normal;
  width: max-content;
  max-width: 320px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  z-index: 120;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
  pointer-events: none;
  text-align: left;
}

.help-bubble-popover::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #0F172A transparent transparent transparent;
}

.help-bubble-wrap.align-left .help-bubble-popover {
  left: 0;
  transform: translateY(4px);
}
.help-bubble-wrap.align-left .help-bubble-popover::after {
  left: 14px;
  transform: none;
}

.help-bubble-wrap.align-right .help-bubble-popover {
  left: auto;
  right: 0;
  transform: translateY(4px);
}
.help-bubble-wrap.align-right .help-bubble-popover::after {
  left: auto;
  right: 14px;
  transform: none;
}

.help-bubble-wrap:hover .help-bubble-popover,
.help-bubble-wrap:focus-within .help-bubble-popover {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.help-bubble-wrap.align-left:hover .help-bubble-popover,
.help-bubble-wrap.align-left:focus-within .help-bubble-popover {
  transform: translateY(0);
}

.help-bubble-wrap.align-right:hover .help-bubble-popover,
.help-bubble-wrap.align-right:focus-within .help-bubble-popover {
  transform: translateY(0);
}

.help-bubble-popover strong {
  color: #FFFFFF;
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.help-bubble-popover code {
  background: rgba(255, 255, 255, 0.15);
  color: #6EE7B7;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  word-break: break-all;
}

.help-bubble-popover ul, .help-bubble-popover ol {
  margin: 6px 0 0;
  padding-left: 16px;
}

.help-bubble-popover li {
  margin-bottom: 4px;
}

.troubleshoot-guide-card {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-left: 4px solid #D97706;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: #92400E;
  margin-top: 8px;
}
.troubleshoot-guide-card.error {
  background: #FEF2F2;
  border-color: #FECACA;
  border-left-color: #DC2626;
  color: #991B1B;
}

