/* ============================================================
   RMM PHP - CSS Tailwind-like
   Pas de build step, on utilise Tailwind CDN dans le HTML
   ============================================================ */

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

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'DM Sans', system-ui, sans-serif;
  background-color: #F7F9FC;
  color: #1C2434;
  -webkit-font-smoothing: antialiased;
}

::selection { background: #3C50E0; color: white; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #E2E8F0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #8A99AF; }

/* ===== Composants custom (au-dessus de Tailwind) ===== */
.card {
  border-radius: 0.5rem;
  border: 1px solid #E2E8F0;
  background: #FFF;
  box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.08);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.375rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #3C50E0; color: white; }
.btn-primary:hover:not(:disabled) { background: #2235A8; }
.btn-secondary { background: white; color: #1C2434; border: 1px solid #E2E8F0; }
.btn-secondary:hover:not(:disabled) { background: #F7F9FC; }
.btn-danger { background: #EF4444; color: white; }
.btn-danger:hover:not(:disabled) { background: #DC2626; }

.input {
  width: 100%;
  border-radius: 0.375rem;
  border: 1px solid #E2E8F0;
  background: white;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  color: #1C2434;
  outline: none;
  transition: border 0.15s;
  font-family: inherit;
}
.input:focus { border-color: #3C50E0; }

.label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1C2434;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-success { background: rgba(16, 185, 129, 0.1); color: #10B981; }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: #F59E0B; }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: #EF4444; }
.badge-info { background: rgba(59, 130, 246, 0.1); color: #3B82F6; }
.badge-gray { background: #EFF4FB; color: #8A99AF; }

/* Sidebar */
.sidebar {
  background: #24303F;
  color: #DEE4EE;
}
.sidebar a {
  color: #DEE4EE;
  text-decoration: none;
}
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  transition: background 0.15s;
}
.sidebar .nav-item:hover { background: #1A222C; }
.sidebar .nav-item.active { background: #3C50E0; color: white; }

.spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid #E2E8F0;
  border-top-color: #3C50E0;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Status dot */
.status-dot {
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 9999px;
}
.status-dot.online { background: #10B981; animation: pulse 2s infinite; }
.status-dot.idle { background: #F59E0B; }
.status-dot.offline { background: #8A99AF; }
.status-dot.disabled { background: #EF4444; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Toast */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
}
.toast {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-left: 4px solid #3C50E0;
  min-width: 250px;
  animation: slidein 0.2s ease-out;
}
.toast.success { border-left-color: #10B981; }
.toast.error { border-left-color: #EF4444; }
@keyframes slidein {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Sparkline */
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 3rem;
}
.sparkline-bar {
  flex: 1;
  background: #3C50E0;
  border-radius: 2px;
  min-height: 2px;
}

/* Mosaic */
.mosaic {
  display: grid;
  gap: 0.75rem;
}
.mosaic-3 { grid-template-columns: repeat(3, 1fr); }
.mosaic-4 { grid-template-columns: repeat(4, 1fr); }
.mosaic-6 { grid-template-columns: repeat(6, 1fr); }
.mosaic-tile {
  position: relative;
  background: #000;
  border-radius: 0.5rem;
  overflow: hidden;
  aspect-ratio: 16/9;
  border: 1px solid #E2E8F0;
  transition: border 0.15s;
  cursor: pointer;
}
.mosaic-tile:hover { border-color: #3C50E0; }
.mosaic-tile img { width: 100%; height: 100%; object-fit: cover; }
.mosaic-tile .label-overlay {
  position: absolute;
  inset: auto 0 0 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  padding: 0.5rem;
  color: white;
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table thead th {
  background: #F7F9FC;
  border-bottom: 1px solid #E2E8F0;
  text-align: left;
  padding: 0.75rem 1.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #8A99AF;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.data-table tbody td {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #E2E8F0;
  font-size: 0.875rem;
}
.data-table tbody tr:hover { background: #F7F9FC; }
