/**
 * Watchdog Contrôl'Eau - Feuille de style principale (Thème Clair Pro & Responsive Mobile)
 */

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

body {
  background-color: #fafafa;
  color: #171717;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  padding: 40px 20px;
}

.page {
  max-width: 720px;
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Header & Actions
   ========================================================================== */

.header {
  margin-bottom: 24px;
}

.header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title-box {
  display: flex;
  flex-direction: column;
}

h1 {
  font-size: 20px;
  font-weight: 700;
  color: #171717;
  letter-spacing: -0.01em;
}

.header-subtitle {
  font-size: 12px;
  color: #737373;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.btn {
  background: #ffffff;
  border: 1px solid #d4d4d4;
  border-radius: 6px;
  color: #171717;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: #f5f5f5;
  border-color: #a3a3a3;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #171717;
  border-color: #171717;
  color: #ffffff;
}

.btn-primary:hover {
  background: #262626;
}

/* ==========================================================================
   Bannière de Statut & Diagnostic
   ========================================================================== */

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 8px;
  font-weight: 500;
  margin-bottom: 24px;
  line-height: 1.4;
}

.banner-ok {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.banner-warn {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
}

.banner-err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.banner-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  margin-top: 4px;
  flex-shrink: 0;
}

.banner-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.banner-solution {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.9;
}

.banner-time {
  font-size: 11px;
  color: #737373;
  align-self: flex-start;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ==========================================================================
   Conteneur & Listes de Services
   ========================================================================== */

.services-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Master Project Card Wrapper */
.project-master-card {
  background: #ffffff;
  border: 1px solid #d4d4d4;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.project-master-header {
  padding: 14px 18px;
  background: #f5f5f5;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
  gap: 12px;
}

.project-master-header:hover {
  background: #ebebeb;
}

.project-master-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.header-right-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.chevron-icon {
  font-size: 10px;
  color: #737373;
  transition: transform 0.25s ease;
}

.project-master-card.collapsed .chevron-icon,
.group-block.collapsed .chevron-icon {
  transform: rotate(-90deg);
}

.project-master-card.collapsed .project-master-body,
.group-block.collapsed .service-list {
  display: none;
}

.project-master-title {
  font-size: 15px;
  font-weight: 700;
  color: #171717;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-master-subtitle {
  font-size: 12px;
  color: #737373;
  display: block;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-master-body {
  display: flex;
  flex-direction: column;
}

.sub-group-block {
  border-bottom: 1px solid #e5e5e5;
}

.sub-group-block:last-child {
  border-bottom: none;
}

.sub-group-header {
  padding: 10px 18px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #525252;
  background: #fafafa;
  border-bottom: 1px solid #f0f0f0;
}

.margin-top-lg {
  margin-top: 8px;
}

.group-block {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.group-header {
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #404040;
  background: #fafafa;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  gap: 10px;
}

.group-header:hover {
  background: #f0f0f0;
}

.group-tag {
  font-size: 11px;
  font-weight: 500;
  color: #737373;
  background: #e5e5e5;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.group-subdesc {
  font-size: 12px;
  font-weight: 400;
  color: #737373;
}

.service-list {
  display: flex;
  flex-direction: column;
}

.service-step-item {
  display: flex;
  flex-direction: column;
  position: relative;
}

.service-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: #ffffff;
  position: relative;
  z-index: 2;
  gap: 12px;
  border-bottom: 1px solid #f9f9f9;
}

.service-step-item:last-child .service-row,
.service-list .service-row:last-child {
  border-bottom: none;
}

.service-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.step-num-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f5f5f5;
  border: 1px solid #d4d4d4;
  color: #525252;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-num-badge.step-ok {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}

.step-num-badge.step-err {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.service-info-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.service-title-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.service-name {
  font-weight: 600;
  color: #171717;
  font-size: 13.5px;
  line-height: 1.3;
}

.service-target {
  font-size: 11.5px;
  color: #737373;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.service-sub {
  font-size: 12px;
  margin-top: 2px;
  line-height: 1.3;
  word-break: break-word;
}

.sub-info { color: #525252; }
.sub-warn { color: #ea580c; font-weight: 500; }
.sub-err { color: #dc2626; font-weight: 600; }

.service-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.service-latency {
  font-size: 12px;
  color: #737373;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.status-ok { background: #f0fdf4; color: #16a34a; }
.status-warn { background: #fff7ed; color: #ea580c; }
.status-err { background: #fef2f2; color: #dc2626; }

.status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Trait vertical sous le centre de la puce numérotée */
.connector-link-wrapper {
  height: 10px;
  position: relative;
  background: #ffffff;
}

.connector-line-vert {
  width: 2px;
  height: 100%;
  position: absolute;
  left: 29px; /* Alignement au centre de la puce 24px avec padding 18px */
  background: #16a34a;
}

.connector-line-vert.link-ok {
  background: #16a34a;
}

.connector-line-vert.link-broken {
  background: #dc2626;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: #a3a3a3;
}

/* ==========================================================================
   Écran d'Authentification / Accès Sécurisé
   ========================================================================== */

.auth-card {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  max-width: 420px;
  margin: 40px auto;
  padding: 28px 24px;
  text-align: left;
}

.auth-card h2 {
  font-size: 16px;
  font-weight: 700;
  color: #171717;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 13px;
  color: #737373;
  line-height: 1.4;
  margin-bottom: 20px;
}

.auth-form {
  width: 100%;
}

.auth-input-group {
  display: flex;
  gap: 8px;
  width: 100%;
}

.auth-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d4d4d4;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.auth-input:focus {
  border-color: #171717;
}

.auth-error-msg {
  margin-top: 10px;
  font-size: 12px;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 7px 10px;
  border-radius: 4px;
}

/* ==========================================================================
   OPTIMISATIONS RESPONSIVE SMARTPHONE (Écrans <= 640px)
   ========================================================================== */

@media (max-width: 640px) {
  body {
    padding: 20px 12px;
  }

  .header {
    margin-bottom: 16px;
  }

  .header-main {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  h1 {
    font-size: 17px;
  }

  .header-subtitle {
    font-size: 11px;
  }

  .header-actions {
    gap: 6px;
  }

  .btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .banner {
    padding: 12px 14px;
    gap: 10px;
    margin-bottom: 16px;
  }

  .project-master-header {
    padding: 12px 14px;
  }

  .project-master-title {
    font-size: 14px;
  }

  .project-master-subtitle {
    font-size: 11px;
  }

  .sub-group-header {
    padding: 8px 14px;
    font-size: 10.5px;
  }

  .group-header {
    padding: 10px 14px;
    font-size: 12px;
  }

  .service-row {
    padding: 10px 14px;
    gap: 8px;
    align-items: flex-start;
  }

  .service-left {
    gap: 10px;
  }

  .step-num-badge {
    width: 22px;
    height: 22px;
    font-size: 10px;
    margin-top: 1px;
  }

  .service-title-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
  }

  .service-name {
    font-size: 13px;
    line-height: 1.25;
  }

  .service-target {
    font-size: 11px;
    color: #8c8c8c;
    word-break: break-all;
  }

  .service-sub {
    font-size: 11.5px;
  }

  .service-meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
  }

  .service-latency {
    font-size: 10.5px;
  }

  .status-badge {
    font-size: 10.5px;
    padding: 2px 6px;
  }

  .connector-line-vert {
    left: 24px; /* Alignement avec puce 22px et padding 14px (14 + 11 = 25px) */
  }

  .auth-card {
    margin: 20px auto;
    padding: 24px 18px;
  }
}
