/* Admin Panel Axiom - Styles */
:root {
  --axiom-bg: #0d0f1a;
  --axiom-bg-end: #1a1d2e;
  --axiom-panel: #0f1120;
  --axiom-line: #1e2130;
  --axiom-text: #e8eaef;
  --axiom-muted: #787c94;
  --axiom-accent: #c8d6ff;
  --axiom-accent-soft: #c8d6ff33;
  --axiom-red: #ff6b6b;
  --axiom-green: #4ecdc4;
}

/* Page
   Le selecteur doit porter sur <html> : c'est lui qui porte
   data-theme="axiom" dans index.html et login.html. */
html[data-theme="axiom"] {
  --bg: var(--axiom-bg);
  --bg-end: var(--axiom-bg-end);
  --panel: var(--axiom-panel);
  --line: var(--axiom-line);
  --text: var(--axiom-text);
  --muted: var(--axiom-muted);
  --accent: var(--axiom-accent);
  --accent-soft: var(--axiom-accent-soft);
}

/* Base : le panneau est un layout flex barre laterale + contenu */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  background: var(--bg);
  background-image: linear-gradient(135deg, var(--bg) 0%, var(--bg-end) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

code {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 0.92em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Page de connexion */
.login-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-header .brand-symbol svg {
  width: 44px;
  height: 44px;
  color: var(--accent);
}

.login-header h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin: 12px 0 4px;
}

.login-header p {
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-form .field label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.login-form .field input[type="password"] {
  width: 100%;
  padding: 11px 13px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s;
}

.login-form .field input[type="password"]:focus {
  border-color: var(--accent);
}

.login-form .field input::placeholder {
  color: var(--muted);
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 9px;
  color: var(--muted) !important;
  font-size: 12px !important;
  cursor: pointer;
  margin-bottom: 0 !important;
}

.checkbox-label input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity .15s;
}

.primary-button:hover {
  opacity: .88;
}

.primary-button svg {
  width: 17px;
  height: 17px;
}

.login-error {
  margin-top: 18px;
  padding: 11px 13px;
  font-size: 12px;
  color: var(--axiom-red);
  background: rgba(255, 107, 107, .1);
  border: 1px solid var(--axiom-red);
  border-radius: 8px;
}

.login-footer {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.login-footer p {
  margin: 4px 0;
}

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.brand-symbol svg {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

.brand strong {
  color: var(--text);
  font-size: 14px;
  letter-spacing: 1px;
}

nav ul {
  list-style: none;
  margin-top: 8px;
}

nav li {
  margin: 8px 0;
}

nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: background .15s, color .15s;
}

nav a:hover,
nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

nav a svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

nav a:hover svg,
nav a.active svg {
  color: var(--accent);
}

/* Content */
.content {
  flex: 1;
  padding: 32px;
  max-width: 1000px;
  margin-left: auto;
}

.header {
  margin-bottom: 24px;
}

.header h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.header p {
  color: var(--muted);
  font-size: 13px;
}

/* Dashboard Stats */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 20px;
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Quick Actions */
.quick-actions {
  margin-bottom: 24px;
}

.quick-actions h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  color: var(--muted);
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.action-btn {
  width: 100%;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.action-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Main content area */
.cards {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
}

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

.empty-symbol {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  color: var(--muted);
}

/* Forms (modals) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  width: 90%;
  max-width: 500px;
  animation: slideIn .2s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal h2 {
  margin: 0 0 16px 0;
  font-size: 15px;
  color: var(--text);
}

.modal .field {
  margin-bottom: 12px;
}

.modal .field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.modal .field input,
.modal .field select {
  width: 100%;
  padding: 8px 10px;
  background: var(--axiom-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
}

.modal .field input:focus,
.modal .field select:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

.modal-actions .btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.modal-actions .btn-cancel {
  background: var(--line);
  color: var(--muted);
}

.modal-actions .btn-save {
  background: var(--accent);
  color: var(--bg);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--panel);
  color: var(--muted);
  font-weight: 500;
}

tr:hover td {
  background: var(--accent-soft);
}

td.account-id {
  color: var(--accent);
  font-family: monospace;
  white-space: nowrap;
}

/* Boutons petits pour les actions dans les tableaux */
.btn-small {
  padding: 4px 8px;
  font-size: 11px;
  background: var(--line);
  color: var(--muted);
  border-radius: 4px;
  margin-right: 4px;
}
.btn-small:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

/* États de chargement et erreurs dans les sections */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}
.error {
  text-align: center;
  padding: 20px;
  color: var(--axiom-red);
  background: rgba(255,107,107,0.1);
  border-radius: 8px;
  border: 1px solid var(--axiom-red);
}

/* Responsive */
@media (max-width: 600px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    justify-content: space-between;
    padding-bottom: 12px;
  }

  .brand {
    order: 2;
    width: calc(100% - 80px);
  }

  nav {
    order: 3;
    flex: 1;
    justify-content: center;
  }

  nav ul {
    display: flex;
    gap: 12px;
    margin: 0;
  }

  nav a {
    justify-content: center;
    width: 40px;
    padding: 6px 0;
  }

  .content {
    margin-left: 0;
    padding: 16px;
  }
}