/* Variables CSS unifiées pour tous les thèmes ezserv */
:root {
  --bg: #000000; /*001a00*/
  --card: #000000; /*002600*/
  --border: #003300;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --blue: #007c00;
  --orange: #f59e0b;
  --green: #227cc5;
  --red: #ef4444;
  --grey: #353535;
  --purple: #a855f7;
  --cyan: #06b6d4;
  --rose: #f43f5e;
  --yellow: #f4ca3f;
  --orangevlc: #ff8800;
}

/* Reset et base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 12px;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 520px;
  margin-inline: auto;
}

/* Header commun */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

header h1 {
  margin: 0;
  font-size: 18px;
}

/* Boutons de base */
button {
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Classes de boutons communes */
.btn-primary {
  background: var(--green);
  color: #022c22;
}

.btn-secondary {
  background: var(--blue);
  color: white;
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-muted {
  background: var(--grey);
  color: white;
}

/* Inputs communs */
input[type="text"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

/* Cards communes */
.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  background: var(--card);
}

/* Barres de progression communes */
.bar {
  height: 8px;
  background: var(--bg);
  border-radius: 8px;
  overflow: hidden;
}

.fill {
  height: 100%;
  width: 0%;
  background: var(--green);
  transition: width 0.2s linear;
}

/* Animation de chargement */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* États de chargement */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Messages vides */
.empty {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Système de notifications (toasts) */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 4px solid;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.3s ease;
}

.toast.success {
  border-color: var(--green);
}

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

.toast.warning {
  border-color: var(--orange);
}

.toast.info {
  border-color: var(--blue);
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

.toast.hiding {
  animation: slideOut 0.3s ease forwards;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 600px) {
  body {
    padding: 8px;
    max-width: 100%;
  }

  header h1 {
    font-size: 16px;
  }

  button {
    padding: 8px 10px;
    font-size: 13px;
  }

  .card {
    padding: 8px;
  }

  #toast-container {
    left: 8px;
    right: 8px;
    max-width: none;
  }
}

@media (min-width: 601px) {
  body {
    max-width: 520px;
  }
}

/* ============================================
   BOUTONS STANDARDISES
   ============================================ */

.btn-refresh {
  background: var(--blue);
  color: white;
}

.btn-action {
  background: var(--green);
  color: #022c22;
}

.btn-cancel {
  background: var(--red);
  color: white;
}

.btn-secondary {
  background: var(--blue);
  color: white;
}

.btn-neutral {
  background: var(--grey);
  color: white;
}

/* Header avec boutons multiples */
header .btn-group {
  display: flex;
  gap: 8px;
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 8px;
}

.section-header h3 {
  margin: 0;
  font-size: 15px;
}

/* ============================================
   GROUPES DE FICHIERS (communs)
   ============================================ */

.group {
  margin-bottom: 16px;
}

.group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  cursor: pointer;
  user-select: none;
}

.group-header:hover {
  background: var(--border);
}

.group-header input {
  flex: 0 0 auto;
}

.group-header span {
  flex: 1 1 auto;
  font-weight: 500;
  color: var(--text);
}

.group-header .count {
  font-size: 12px;
  color: var(--muted);
}

.group-files {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 8px;
}

/* ============================================
   RESPONSIVE ADDITIONNEL
   ============================================ */

@media (max-width: 400px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  header .btn-group {
    width: 100%;
  }

  header .btn-group button {
    flex: 1;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .section-header button {
    width: 100%;
  }
}
