/* ═══════════════════════════════════════════════════════════════════
   SABINA ADMIN — Charte unifiée
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --sabina-red: #D42020;
  --sabina-orange: #F07020;
  --sabina-grad: linear-gradient(135deg, #D42020 0%, #F07020 100%);
  --bg-app: #F5F3F0;
  --bg-card: #FFFFFF;
  --line: #E8E3DC;
  --text-strong: #1A1210;
  --text: #3D3530;
  --text-muted: #A09890;
  --green: #12B76A;
  --warning: #F59E0B;
  --error: #DC2626;
  --blue: #2563EB;
  --r: 14px;
  --r-lg: 20px;
  --sh-sm: 0 2px 8px rgba(30,15,5,.06);
  --sh: 0 4px 16px rgba(30,15,5,.08);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-app);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ═══ HEADER ═══ */
.admin-header {
  background: var(--bg-card);
  border-bottom: 1.5px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--sh-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.admin-header .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.admin-header .logo img {
  height: 38px;
  width: auto;
  border-radius: 10px;
}

.admin-header .brand {
  font-family: 'Sora', sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-strong);
  letter-spacing: -.4px;
}

.admin-header .brand em {
  font-style: normal;
  background: var(--sabina-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ═══ RECHERCHE ═══ */
.admin-search {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.admin-search input {
  width: 100%;
  padding: 11px 16px 11px 44px;
  background: var(--bg-app);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: all .15s;
}

.admin-search input:focus {
  background: #fff;
  border-color: var(--sabina-red);
  box-shadow: 0 0 0 4px rgba(212,32,32,.08);
}

.admin-search::before {
  content: '🔍';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
  opacity: .5;
}

.admin-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  margin-top: 6px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: var(--sh-md, 0 8px 24px rgba(30,15,5,.11));
  display: none;
  z-index: 200;
}

.admin-search-results.active { display: block; }

.admin-search-results .item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background .15s;
  text-decoration: none;
  color: inherit;
}

.admin-search-results .item:last-child { border-bottom: none; }
.admin-search-results .item:hover { background: var(--bg-app); }
.admin-search-results .item .emoji { font-size: 20px; }
.admin-search-results .item .name { font-weight: 600; font-size: 14px; }
.admin-search-results .item .url { font-size: 11px; color: var(--text-muted); }

/* ═══ ACTIONS HEADER ═══ */
.admin-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-app);
  border-radius: var(--r);
  font-size: 13px;
}

.admin-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sabina-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.admin-user .info .name {
  font-weight: 600;
  color: var(--text-strong);
  font-size: 13px;
}

.admin-user .info .role {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r);
  border: 1.5px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all .15s;
  text-decoration: none;
  color: var(--text);
}

.btn-icon:hover {
  border-color: var(--sabina-red);
  color: var(--sabina-red);
}

.btn-icon.logout:hover {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

.btn-login {
  padding: 10px 20px;
  background: var(--sabina-grad);
  color: #fff !important;
  border: none;
  border-radius: var(--r);
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(212,32,32,.25);
  transition: all .15s;
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(212,32,32,.35);
}

/* ═══ BANDEAU MÉTÉO ═══ */
.weather-card {
  background: linear-gradient(135deg, #2563EB 0%, #0891B2 100%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--sh);
}

.weather-card .icon {
  font-size: 42px;
}

.weather-card .temp {
  font-family: 'Sora', sans-serif;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

.weather-card .city {
  font-size: 13px;
  opacity: .9;
  margin-top: 4px;
}

/* ═══ PASTILLES STATUT ═══ */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-dot.green { background: var(--green); box-shadow: 0 0 8px rgba(18,183,106,.5); }
.status-dot.orange { background: var(--warning); box-shadow: 0 0 8px rgba(245,158,11,.5); }
.status-dot.red { background: var(--error); box-shadow: 0 0 8px rgba(220,38,38,.5); animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ═══ CARDS APPS ═══ */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.app-card {
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all .15s;
}

.app-card:hover {
  border-color: var(--sabina-red);
  box-shadow: var(--sh);
  transform: translateY(-2px);
}

.app-card .emoji {
  font-size: 28px;
  flex-shrink: 0;
}

.app-card .info {
  flex: 1;
  min-width: 0;
}

.app-card .name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-strong);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-card .url {
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
}

.app-card .status {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
}

/* ═══ MOBILE ═══ */
@media (max-width: 768px) {
  .admin-header {
    flex-wrap: wrap;
    padding: 12px;
  }
  .admin-search {
    order: 3;
    max-width: 100%;
    flex-basis: 100%;
  }
  .admin-user .info { display: none; }
  .app-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   AJOUTS v2 — Filtres, catégories, mode nuit
   ═══════════════════════════════════════════════════════════ */

/* Filtres par catégorie */
.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--r);
  border: 1.5px solid var(--line);
}

.filter-chip {
  padding: 6px 14px;
  background: var(--bg-app);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  color: var(--text);
}

.filter-chip:hover {
  border-color: var(--sabina-red);
  color: var(--sabina-red);
}

.filter-chip.active {
  background: var(--sabina-grad);
  color: #fff;
  border-color: transparent;
}

/* Sections par catégorie */
.app-category {
  margin-top: 24px;
}

.app-category h3 {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--line);
}

/* Toggle mode nuit */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--r);
  border: 1.5px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.theme-toggle:hover {
  border-color: var(--sabina-red);
  transform: scale(1.05);
}

/* Cartes améliorées */
.app-card {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 14px 16px !important;
  gap: 12px !important;
}

.app-card .left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.app-card .right {
  display: flex;
  gap: 6px;
  align-items: center;
}

.app-card .btn-mini {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}

.app-card .btn-mini.primary {
  background: var(--sabina-grad);
  color: #fff;
}

.app-card .btn-mini.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212,32,32,.3);
}

.app-card .btn-mini.secondary {
  background: var(--bg-app);
  color: var(--text);
  border: 1px solid var(--line);
}

.app-card .btn-mini.secondary:hover {
  background: #fff;
  border-color: var(--sabina-red);
  color: var(--sabina-red);
}

/* Mode nuit */
[data-theme="night"] {
  --bg-app: #1A1614;
  --bg-card: #241F1C;
  --line: #3D3530;
  --text-strong: #F5F0EB;
  --text: #DDD5CC;
  --text-muted: #A09890;
}

[data-theme="night"] body {
  background: var(--bg-app);
  color: var(--text);
}

[data-theme="night"] .admin-header,
[data-theme="night"] .app-card,
[data-theme="night"] .filter-chip {
  background: var(--bg-card);
  border-color: var(--line);
  color: var(--text);
}

/* Bandeau animé (vague) */
.sabina-gradient-animated {
  background: linear-gradient(90deg, #D42020 0%, #F07020 25%, #D42020 50%, #F07020 75%, #D42020 100%);
  background-size: 200% 100%;
  animation: waveGradient 8s ease-in-out infinite;
}

@keyframes waveGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
