/* ─────────────────────────────────────────
   Reset
───────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: #0f172a;
}

/* ─────────────────────────────────────────
   Background
───────────────────────────────────────── */
.page, .dash-body {
  min-height: 100%;
  background:
    radial-gradient(900px 450px at 20% 10%, rgba(99,102,241,.35), transparent 60%),
    radial-gradient(900px 450px at 80% 30%, rgba(16,185,129,.25), transparent 55%),
    linear-gradient(180deg, #0b1020, #0b1020);
}
.page { display: grid; place-items: center; padding: 24px; }

/* ─────────────────────────────────────────
   Card (login)
───────────────────────────────────────── */
.card {
  width: min(420px, 100%);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
}
.card__header h1 { margin: 0; font-size: 26px; letter-spacing: .2px; color: #e2e8f0; }
.card__header p  { margin: 6px 0 0; color: rgba(226,232,240,.78); font-size: 14px; }

/* ─────────────────────────────────────────
   Form & Fields
───────────────────────────────────────── */
.form { margin-top: 18px; display: grid; gap: 14px; }
.form.no-mt { margin-top: 0; }
.field span { display: block; font-size: 12px; color: rgba(226,232,240,.78); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 12px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(15,23,42,0.55); color: #e2e8f0;
  outline: none; font-family: inherit; font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: rgba(226,232,240,.45); }
.field input:focus, .field select:focus {
  border-color: rgba(99,102,241,.7);
  box-shadow: 0 0 0 4px rgba(99,102,241,.18);
}
.field select option { background: #1e293b; }

.password { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.ghost {
  height: 44px; padding: 0 12px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(15,23,42,0.55); color: #e2e8f0; cursor: pointer;
  transition: transform .08s, border-color .2s;
}
.ghost:active { transform: scale(0.98); }
.ghost:focus  { outline: none; border-color: rgba(99,102,241,.7); box-shadow: 0 0 0 4px rgba(99,102,241,.18); }

.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 10px; color: rgba(226,232,240,.8); font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: #6366f1; }

/* ─────────────────────────────────────────
   Buttons
───────────────────────────────────────── */
.btn {
  width: 100%; border: none; border-radius: 12px; padding: 12px 14px;
  font-weight: 700; font-size: 15px; cursor: pointer; color: #0b1020;
  background: linear-gradient(90deg, #a78bfa, #60a5fa, #34d399);
  box-shadow: 0 10px 30px rgba(96,165,250,.22);
  transition: transform .08s, filter .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover    { filter: brightness(1.05); }
.btn:active   { transform: scale(0.99); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-sm {
  border: none; border-radius: 8px; padding: 5px 12px;
  font-size: 12px; font-weight: 700; cursor: pointer; color: #0b1020;
  background: linear-gradient(90deg, #a78bfa, #60a5fa, #34d399);
  transition: filter .2s;
}
.btn-sm:hover { filter: brightness(1.08); }

.btn-outline {
  background: transparent; border: 1px solid rgba(255,255,255,0.18);
  color: rgba(226,232,240,.8); border-radius: 10px; padding: 6px 14px;
  font-size: 13px; cursor: pointer; font-family: inherit; transition: all .2s;
}
.btn-outline:hover { border-color: rgba(99,102,241,.6); background: rgba(99,102,241,.1); color: #e2e8f0; }

.btn-danger {
  background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3);
  color: #f87171; border-radius: 8px; padding: 5px 10px;
  font-size: 12px; cursor: pointer; font-family: inherit; transition: all .2s;
}
.btn-danger:hover { background: rgba(239,68,68,.22); border-color: rgba(239,68,68,.5); }

.btn-logout {
  background: transparent; border: 1px solid rgba(239,68,68,.35);
  color: #f87171; border-radius: 10px; padding: 6px 14px;
  font-size: 13px; cursor: pointer; font-family: inherit; transition: background .2s;
}
.btn-logout:hover { background: rgba(239,68,68,.1); }

.spinner {
  display: none; width: 16px; height: 16px;
  border: 2px solid rgba(11,16,32,0.3); border-top-color: #0b1020;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────
   Messages
───────────────────────────────────────── */
.msg { display: none; border-radius: 10px; padding: 10px 14px; font-size: 13px; line-height: 1.5; }
.msg.error   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.3);  color: #f87171; }
.msg.success { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.3); color: #34d399; }

/* ─────────────────────────────────────────
   Links & misc
───────────────────────────────────────── */
.link  { color: rgba(165,180,252,.95); text-decoration: none; font-size: 13px; cursor: pointer; }
.link:hover { text-decoration: underline; }
.small { margin: 8px 0 0; color: rgba(226,232,240,.72); font-size: 13px; text-align: center; }
.footer { margin-top: 14px; color: rgba(226,232,240,.55); font-size: 12px; }

/* ─────────────────────────────────────────
   Modal
───────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(6px);
  z-index: 200; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #111827; border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px; padding: 28px; width: min(460px, 100%);
  position: relative; animation: fadeUp .3s ease both;
  max-height: 90vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 20px; font-size: 20px; color: #e2e8f0; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: rgba(226,232,240,.5);
  font-size: 1.1rem; cursor: pointer;
}
.modal-close:hover { color: #e2e8f0; }

/* ─────────────────────────────────────────
   Nav
───────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11,16,32,0.88); backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; height: 58px;
}
.nav-logo {
  font-size: 16px; font-weight: 700;
  background: linear-gradient(90deg, #a78bfa, #60a5fa, #34d399);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-email { font-size: 13px; color: rgba(226,232,240,.5); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa, #34d399);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #0b1020;
}
.admin-badge {
  font-size: 12px; padding: 5px 13px; border-radius: 8px; font-weight: 600;
  background: rgba(167,139,250,.12);
  border: 1px solid rgba(167,139,250,.3); color: #c4b5fd;
  text-decoration: none;
  transition: border-color .2s, background .2s;
}
.admin-badge:hover { background: rgba(167,139,250,.22); border-color: rgba(167,139,250,.55); }

/* Pseudo dans la nav */
.nav-pseudo {
  font-size: 15px; font-weight: 600; color: #e2e8f0; letter-spacing: .01em;
}

/* Lien retour dashboard dans nav admin */
.nav-back {
  font-size: 13px; color: #a78bfa; text-decoration: none;
  padding: 5px 14px; border-radius: 20px;
  border: 1px solid rgba(167,139,250,.4);
  background: rgba(167,139,250,.08);
  transition: all .2s; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
.nav-back:hover { background: rgba(167,139,250,.18); border-color: rgba(167,139,250,.7); color: #c4b5fd; }

/* ─────────────────────────────────────────
   Dashboard layout
───────────────────────────────────────── */
.dash-main { max-width: 1180px; margin: 0 auto; padding: 36px 28px; }
.dash-header { margin-bottom: 28px; }
.dash-header h1 { font-size: 26px; color: #e2e8f0; margin: 0 0 4px; }
.dash-header p  { color: rgba(226,232,240,.55); font-size: 14px; margin: 0; }
.username-gradient {
  background: linear-gradient(90deg, #a78bfa, #60a5fa, #34d399);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 28px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.tab {
  padding: 10px 18px; font-size: 14px; color: rgba(226,232,240,.55);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .2s, border-color .2s;
  background: none; border-top: none; border-left: none; border-right: none; font-family: inherit;
}
.tab:hover  { color: #e2e8f0; }
.tab.active { color: #a78bfa; border-bottom-color: #a78bfa; }

/* Toolbar */
.toolbar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.search-wrap { flex: 1; min-width: 200px; position: relative; }
.search-wrap input {
  width: 100%; padding: 10px 14px 10px 38px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.06);
  color: #e2e8f0; font-family: inherit; font-size: 14px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-wrap input::placeholder { color: rgba(226,232,240,.35); }
.search-wrap input:focus { border-color: rgba(99,102,241,.7); box-shadow: 0 0 0 4px rgba(99,102,241,.18); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: rgba(226,232,240,.35); font-size: 14px; pointer-events: none; }
.filter-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
  color: rgba(226,232,240,.65); border-radius: 10px; padding: 8px 14px;
  font-size: 13px; cursor: pointer; font-family: inherit; transition: all .2s;
}
.filter-btn:hover, .filter-btn.active { border-color: rgba(99,102,241,.6); color: #e2e8f0; background: rgba(99,102,241,.15); }

/* ─────────────────────────────────────────
   App Grid & Cards
───────────────────────────────────────── */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); gap: 16px; }
.app-card {
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(8px); border-radius: 16px; padding: 20px;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  animation: fadeUp .4s ease both;
  display: flex;
  flex-direction: column;
  min-height: 160px;
}
.app-card:hover { transform: translateY(-3px); border-color: rgba(99,102,241,.45); box-shadow: 0 10px 36px rgba(99,102,241,.16); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.card-top-left { display: flex; align-items: center; gap: 12px; }
.app-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 600; }
.badge-active  { background: rgba(52,211,153,.15);  color: #34d399; border: 1px solid rgba(52,211,153,.3); }
.badge-beta    { background: rgba(167,139,250,.15); color: #a78bfa; border: 1px solid rgba(167,139,250,.3); }
.badge-new     { background: rgba(251,146,60,.15);  color: #fb923c; border: 1px solid rgba(251,146,60,.3); }
.badge-offline { background: rgba(248,113,113,.12); color: #f87171; border: 1px solid rgba(248,113,113,.25); }
.app-name { font-size: 15px; font-weight: 700; color: #e2e8f0; margin-bottom: 5px; }
.app-desc { color: rgba(226,232,240,.55); font-size: 13px; line-height: 1.5; margin-bottom: 14px; flex: 1; min-height: 0; }
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
}
.app-subdomain { font-size: 11px; color: rgba(226,232,240,.35); font-family: monospace; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* App card offline */
.app-card--offline {
  opacity: 0.6;
  cursor: default;
}
.app-card--offline:hover {
  transform: none;
  border-color: rgba(255,255,255,0.12);
  box-shadow: none;
}
.btn-offline {
  background: rgba(248,113,113,.12);
  color: #f87171;
  border: 1px solid rgba(248,113,113,.3);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-restricted {
  background: rgba(167,139,250,.1);
  color: #a78bfa;
  border: 1px solid rgba(167,139,250,.3);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: not-allowed;
  pointer-events: none;
}

.add-card {
  background: transparent; border: 2px dashed rgba(255,255,255,0.14);
  border-radius: 16px; padding: 20px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  min-height: 160px; color: rgba(226,232,240,.4); font-size: 14px;
  transition: all .2s;
}
.add-card:hover { border-color: rgba(99,102,241,.5); background: rgba(99,102,241,.07); color: #e2e8f0; }
.add-icon { font-size: 1.8rem; }

/* ─────────────────────────────────────────
   Users table
───────────────────────────────────────── */
.table-wrap { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; overflow: hidden; }
.users-table { width: 100%; border-collapse: collapse; }
.users-table th {
  text-align: left; font-size: 11px; color: rgba(226,232,240,.45);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.users-table td { padding: 12px 14px; font-size: 14px; color: rgba(226,232,240,.85); border-bottom: 1px solid rgba(255,255,255,0.06); vertical-align: middle; }
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: rgba(255,255,255,0.03); }
.user-pseudo { font-weight: 600; color: #e2e8f0; }
.user-email  { font-size: 12px; color: rgba(226,232,240,.45); font-family: monospace; }

/* Empty state */
.empty-state { grid-column: 1/-1; text-align: center; padding: 50px 20px; color: rgba(226,232,240,.4); }
.empty-state span { font-size: 2.5rem; display: block; margin-bottom: 10px; }

/* ─────────────────────────────────────────
   Tooltips sur les boutons d'action
───────────────────────────────────────── */
.action-btn {
  position: relative;
}
.action-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.15);
  color: #e2e8f0;
  font-size: 11px;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.action-btn:hover::after {
  opacity: 1;
}

/* ─────────────────────────────────────────
   Animations
───────────────────────────────────────── */
@keyframes fadeUp { from { opacity:0; transform:translateY(18px); } to { opacity:1; transform:translateY(0); } }
