:root {
    --primary: #1560F1;
    --bg-dark: #121212;
    --bg-light: #f5f5f5;
    --text-dark: #f5f5f5;
    --text-light: #222;
    --box-dark: #1e1e1e;
    --box-light: #ffffff;
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    .datacenter-header {
        font-size: 1em;
        padding: 10px;
    }

    .server {
        padding: 15px;
    }
}

body {
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-dark);
    margin: 0;
    padding: 20px;
    transition: background 0.3s, color 0.3s;
}

body.light {
    background-color: var(--bg-light);
    color: var(--text-light);
}

.container {
    max-width: 900px;
    margin: auto;
    text-align: center;
}

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

h1 {
    font-size: 2em;
    color: var(--primary);
}

button#modeToggle {
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
}

.servers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.server {
    background-color: var(--box-dark);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    transition: transform 0.2s, background 0.3s;
}

body.light .server {
    background-color: var(--box-light);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.server:hover {
    transform: scale(1.02);
}

.online {
    color: #4caf50;
    font-weight: bold;
}

.offline {
    color: #f44336;
    font-weight: bold;
}

footer {
    margin-top: 40px;
    font-size: 0.9em;
    color: #aaa;
}

.buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
}

button:hover {
    background: #1049b5;
}

.announcement {
    margin-top: 30px;
    padding: 15px;
    background-color: #222;
    border-left: 5px solid var(--primary);
    text-align: left;
    font-size: 0.95em;
    color: white;
    border-radius: 10px;
    text-align: center;
    display: flex;
    justify-content: center;
}

.announcement-content {
    white-space: pre-wrap;
    text-align: center;
	margin-top: 30px;
	padding-bottom: 30px;
    padding: 15px;
    background-color: #222;
    color: white;
    border-radius: 10px;
    text-align: center;
    justify-content: center;
}

body.light .announcement-content {
    background-color: var(--box-light);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
	color: black;
}

body.light .announcement {
    background-color: #eee;
    color: #000;
}

.maintenance {
    color: #70b3ff;
    font-weight: bold;
}

.history {
    margin-top: 30px;
}

.history .maintenance-card {
    background-color: #70b3ff;
    border-left: 4px solid #1c85ff;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    color: #222;
    font-size: 0.95em;
    text-align: left;
    white-space: pre-line;
}

body.light .history {
    background: #f5f5f5;
    color: #222;
}

.maintenance-list {
    margin-top: 2em;
}

.maintenance-card {
    background-color: #70b3ff;
    border-left: 4px solid #1c85ff;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}
body:not(.light) .maintenance-card {
    color: #000; /* Texte noir dans le thème sombre pour contraste sur fond jaune */
}
body:not(.light) .maintenance-card {
    color: #000;
}
.maintenance-card strong {
    font-size: 1rem;
}
.maintenance-card p {
    margin: 0.3rem 0 0 0;
}
.posted-date {
    color: #666;
    font-size: 0.85em;
}

/* --- ADMIN: Formulaires et messages --- */

form {
    display: block;
	width: 100%;
    text-align: left;
    margin: 20px auto;
    max-width: 700px;
    background-color: var(--box-dark);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.form-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

body.light form {
    background-color: var(--box-light);
}

form textarea,
form input[type="text"],
form input[type="password"],
form input[type="datetime-local"] {
    width: 100%;
    padding: 10px;
    margin-top: 6px;
    margin-bottom: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1em;
    background-color: #1a1a1a;
    color: white;
}

body.light form textarea,
body.light form input {
    background-color: #fff;
    color: #000;
}

.success {
    color: #4caf50;
    font-weight: bold;
    margin-top: 10px;
}

.error {
    color: #f44336;
    font-weight: bold;
    margin-top: 10px;
}

/* --- ADMIN: Maintenance block (un bloc par serveur) --- */

body.light .maintenance-block {
    background-color: #f5f5f5;
    border-left-color: var(--primary);
}

.maintenance-block label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}
.datacenter {
    border-radius: 12px;
    margin-bottom: 25px;
    overflow: hidden;
    background-color: var(--box-dark);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

body.light .datacenter {
    background-color: var(--box-light);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.datacenter-header {
    background-color: #222;
    color: #fff;
    padding: 15px 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

body.light .datacenter-header {
    background-color: #ddd;
    color: #000;
}

.datacenter-header:hover {
    background-color: #333;
}

body.light .datacenter-header:hover {
    background-color: #ccc;
}

.datacenter-content {
    display: block; /* ouvert par défaut */
    padding: 20px;
    transition: all 0.3s ease;
}

.datacenter-content:not(.active) {
    display: none;
}

.datacenter-content ul,
.datacenter-content li {
    width: 100%;
    display: block;
    box-sizing: border-box;
}

.toggle-icon {
    font-size: 1em;
    transition: transform 0.2s ease;
}

.btn.red {
  background-color: #c0392b;
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
}
.btn.red:hover {
  background-color: #e74c3c;
}

.maintenance-block {
  background-color: #1e1e1e;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid #333;
  overflow: hidden; /* 👈 Évite le débordement */
}

.maintenance-block input,
.maintenance-block textarea,
.maintenance-block select {
  width: 100%;           /* 👈 Prend toute la largeur disponible */
  max-width: 100%;       /* 👈 Évite de dépasser */
  box-sizing: border-box; /* 👈 Inclut padding/border dans le width */
  margin-bottom: 10px;
}

.form-reset {
  display: inline-block;
  margin-left: 10px;
}

.sidebar-dc {
    padding: 15px;
    border-radius: 12px;
    max-width: 300px;
    background-color: var(--bg-secondary, #f1f1f1);
    color: var(--text-color, #000);
}

body.light .sidebar-dc {
    background-color: #fff;
    color: #000;
}

body:not(.light) .sidebar-dc {
    background-color: #222;
    color: #f0f0f0;
}

.sidebar-dc ul {
    list-style-type: none;
    padding-left: 0;
}

.sidebar-dc li {
    margin-bottom: 8px;
}

.sidebar-dc li ul {
    list-style-type: '↪ ';
    padding-left: 20px;
}

.sidebar-dc span {
    font-size: 12px;
    color: gray;
}

.centered-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Conteneur du formulaire */
.login-container {
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Formulaire */
.form-login {
  display: flex;
  flex-direction: column;
  width: 300px;
}

.form-login input {
  margin-bottom: 15px;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
}

.form-login button {
  padding: 10px;
  background-color: #333;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.form-login button:hover {
  background-color: #555;
}

.error {
  color: #ff4d4d;
  margin-top: 15px;
  text-align: center;
}

.legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.legend strong {
    margin-right: 10px;
}

.tag {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    color: #000;
    background-color: #ccc;
}

/* Couleurs des statuts */
.status-online {
    background-color: #4caf50; /* vert */
    color: white;
}
.status-maintenance {
    background-color: #1c85ff; /* bleu foncé */
    color: white;
}
.status-degraded {
    background-color: #ff9800; /* orange */
    color: black;
}
.status-partial {
    background-color: #ffeb3b; /* jaune */
    color: black;
}
.status-major {
    background-color: #f44336; /* rouge */
    color: white;
}

/* === Coloration complète du texte du bloc serveur selon le statut === */

.server.online {
    color: #4caf50; /* vert */
}

.server.offline {
    color: #f44336; /* rouge */
}

.server.incident.degrade {
    color: orange;
}

.server.incident.partiel {
    color: goldenrod;
}

.server.incident.majeur {
    color: #f44336;
}

.incident-list {
    margin-top: 40px;
    text-align: center;
}

/* Couleurs de fond selon le niveau */
.incident-card.degrade {
    background-color: #ffe08a; /* Orange clair */
    border-left: 5px solid #e0a800;
}
.incident-card.partiel {
    background-color: #fff3cd; /* Jaune clair */
    border-left: 5px solid #ffc107;
}
.incident-card.majeur {
    background-color: #f8d7da; /* Rouge clair */
    border-left: 5px solid #dc3545;
}

/* Bloc d'incident global */
.incident-card {
    border-radius: 8px;
    padding: 10px 15px;
    margin: 10px 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    color: black;
    display: block;
    margin-bottom: 16px;
}

/* Alignement spécifique */
.incident-list .incident-card {
    text-align: center; /* Incidents en cours => centré */
}

.history .incident-card {
    text-align: left; /* Historique => à gauche */
}

.incident-title {
    text-align: center;
}

.posted-date {
    font-size: 0.9em;
    color: #555;
}

.announcement-title {
    font-weight: bold;
}

.subscription-section h2 {
    text-align: center;
}

.subscription-section {
    margin-top: 40px;
    padding: 20px;
    border-radius: 8px;
    text-align: left;
}

.subscription-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.subscription-form input,
.subscription-form select,
.subscription-form button {
    padding: 8px;
    font-size: 16px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.subscription-form button {
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
}

.subscription-form button:hover {
    background-color: #0056b3;
}

.uptime-section {
    margin-top: 10px;
}

.uptime-bar {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.uptime-day {
    width: 8px;
    height: 20px;
    border-radius: 2px;
}

.uptime-day.online {
    background-color: #4CAF50; /* vert */
}

.uptime-day.offline {
    background-color: #F44336; /* rouge */
}

.server a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.badge {
	display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
	font-size: 12px;
    font-weight: bold;
}

.badge.green { background-color: #4caf50; color: white; }
.badge.blue { background-color: #2196f3; color: white; }
.badge.orange { background-color: #ff9800; color: white; }
.badge.yellow { background-color: #ffeb3b; color: black; }
.badge.red { background-color: #f44336; color: white; }
.badge.gray { background-color: #9e9e9e; color: white; }

.uptime-bar {
    width: 100%;
    background-color: #e0e0e0;
    height: 20px;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.uptime-fill {
    height: 100%;
    background-color: #4caf50;
}

.heatmap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 1em;
    max-width: 240px;
}
.heatmap-day {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}
.heatmap-day.online { background-color: #4caf50; }
.heatmap-day.partial { background-color: #ffc107; }
.heatmap-day.offline { background-color: #f44336; }

/* Mode clair appliqué dynamiquement */
.light-mode {
    background-color: #f5f5f5;
    color: #1e1e1e;
}

.light-mode .server,
.light-mode .incident-card,
.light-mode .maintenance-card,
.light-mode .latency-section {
    background-color: #ffffff;
    border: 1px solid #ccc;
    color: #1e1e1e;
}

.light-mode .heatmap-day.online { background-color: #81c784; }
.light-mode .heatmap-day.partial { background-color: #fff176; }
.light-mode .heatmap-day.offline { background-color: #e57373; }

.light-mode button {
    background-color: #e0e0e0;
    color: #000;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
	font-size: 12px;
    font-weight: bold;
}

.status-online { background-color: #28a745; color: white; }
.status-offline { background-color: #dc3545; color: white; }
.status-maintenance { background-color: #007bff; color: white; }
.status-degraded { background-color: #fd7e14; color: white; }
.status-partial { background-color: #ffc107; color: black; }
.status-major { background-color: #dc3545; color: white; }

/* Stats box */
.stats-box {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 20px;
}

.stats-box > div {
  color: black;
  flex: 1 1 180px;
  background: #000;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Alerts */
.alert {
  background: #ffeaea;
  color: #a94442;
  border-left: 5px solid #c9302c;
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 10px;
  font-weight: bold;
}

/* Section blocks */
.datacenter-section {
  margin-top: 40px;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Select box */
select {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background: white;
  font-size: 14px;
}

/* Chart canvas */
canvas {
  margin-top: 20px;
  max-width: 100%;
  height: auto;
}

/* Logs */
pre {
  padding: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}