/* app.css — BY L'ATELIER SaaS */

/* ── Variables charte BY L'ATELIER ────────────────────────────────────────── */
:root {
  --color-bg:         #0f0f1a;
  --color-surface:    #1a1a2e;
  --color-surface-2:  #16213e;
  --color-gold:       #c8a96e;
  --color-gold-light: #e2c99a;
  --color-text:       #f0f0f0;
  --color-text-muted: #9a9ab0;
  --color-success:    #4caf50;
  --color-warning:    #ff9800;
  --color-danger:     #f44336;
  --color-border:     rgba(200,169,110,0.2);
  --radius:           8px;
  --radius-lg:        14px;
  --font:             'Inter', system-ui, sans-serif;
  --shadow:           0 4px 20px rgba(0,0,0,0.4);
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ── Barre statut réseau ───────────────────────────────────────────────────── */
#network-status {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

.status-bar.offline  { background: #c0392b; color: #fff; }
.status-bar.syncing  { background: var(--color-gold); color: var(--color-bg); }
.status-bar.error    { background: var(--color-warning); color: var(--color-bg); }

/* ── Layout ────────────────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; min-height: 100dvh; }

header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-gold);
  letter-spacing: 0.05em;
}

nav { display: flex; gap: 4px; }

nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

nav a:hover, nav a.active {
  color: var(--color-gold);
  background: rgba(200,169,110,0.1);
}

main {
  flex: 1;
  padding: 24px 20px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

/* ── Vues ──────────────────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-gold);
  margin-bottom: 12px;
}

/* ── Boutons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--color-gold);
  color: var(--color-bg);
}
.btn-primary:hover { background: var(--color-gold-light); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover { color: var(--color-text); border-color: var(--color-gold); }

/* ── Formulaires ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: var(--font);
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-gold);
}

/* ── Login ─────────────────────────────────────────────────────────────────── */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.login-logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-gold);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 0.1em;
}

.login-subtitle {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: 32px;
}

.login-error {
  background: rgba(244,67,54,0.15);
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

/* ── Liste clients / audits ────────────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.list-item:hover {
  border-color: var(--color-gold);
  background: var(--color-surface-2);
}

.list-item-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.list-item-sub {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ── Badge statut ──────────────────────────────────────────────────────────── */
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-brouillon  { background: rgba(154,154,176,0.2); color: var(--color-text-muted); }
.badge-en_cours   { background: rgba(255,152,0,0.2);   color: var(--color-warning); }
.badge-termine    { background: rgba(76,175,80,0.2);   color: var(--color-success); }
.badge-valide     { background: rgba(200,169,110,0.2); color: var(--color-gold); }
.badge-envoye     { background: rgba(33,150,243,0.2);  color: #64b5f6; }

/* ── Score ─────────────────────────────────────────────────────────────────── */
.score-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

/* ── Page titre ────────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
}

.page-sub {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  main { padding: 16px 12px; }
  header { padding: 0 12px; }
  .login-box { padding: 28px 20px; margin: 0 16px; }
  nav a span { display: none; }
}

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(200,169,110,0.3);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state-text { font-size: 1rem; margin-bottom: 20px; }
