/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0f1117;
  --bg-2:        #1a1d27;
  --bg-3:        #232636;
  --border:      #2e3148;
  --text:        #e2e4ef;
  --text-muted:  #7b7f9e;
  --accent:      #6c63ff;
  --accent-dim:  rgba(108,99,255,.15);
  --green:       #22c55e;
  --red:         #ef4444;
  --yellow:      #f59e0b;
  --radius:      10px;
  --sidebar-w:   220px;
  --font:        'Inter', sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ─── Layout ────────────────────────────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  padding: 0 6px;
}
.logo-icon { font-size: 22px; }
.logo-text  { font-size: 18px; font-weight: 700; color: var(--text); }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover  { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }

.sidebar-footer { margin-top: auto; }

.bot-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* ─── Main ──────────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px;
}

/* ─── View ──────────────────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}
.view-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

/* ─── Search ────────────────────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}
#search-input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 14px 9px 34px;
  width: 240px;
  transition: border-color .2s;
  outline: none;
}
#search-input:focus { border-color: var(--accent); }
#search-input::placeholder { color: var(--text-muted); }

/* ─── Grid de cards ─────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .2s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.card-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-anime  { background: rgba(108,99,255,.2); color: var(--accent); }
.badge-series { background: rgba(245,158,11,.15); color: var(--yellow); }

.card-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.card-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-link:hover { text-decoration: underline; }

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-icon {
  flex: 1;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  transition: all .15s;
}
.btn-icon:hover { background: var(--bg-3); color: var(--text); }
.btn-icon.danger:hover { border-color: var(--red); color: var(--red); }

/* ─── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 15px;
}
.empty-state button {
  margin-top: 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  font-size: 14px;
}

/* ─── Formulaire ────────────────────────────────────────────────────────────── */
.form-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.label-hint {
  font-weight: 400;
  font-size: 12px;
  margin-left: 6px;
}

input[type="text"],
input[type="url"],
input[type="number"],
select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .2s;
  width: 100%;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-muted); }
select option { background: var(--bg-3); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

/* ─── Boutons ───────────────────────────────────────────────────────────────── */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-secondary { background: var(--bg-3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .85; }

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 360px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal h3 { font-size: 17px; }
.modal p   { font-size: 14px; color: var(--text-muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ─── Toast ─────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 14px;
  color: var(--text);
  z-index: 200;
  transition: opacity .3s;
}
.toast.hidden { display: none; }

/* ─── Utilitaires ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  body { overflow: auto; }
  .app { flex-direction: column; height: auto; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; padding: 16px; border-right: none; border-bottom: 1px solid var(--border); }
  .nav { flex-direction: row; }
  .sidebar-footer { display: none; }
  .main { padding: 20px 16px; }
  .view-header { flex-direction: column; align-items: flex-start; }
  #search-input { width: 100%; }
  .search-wrap { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
}
