/* Portail Client Einstein Productions — design system
   Palette et espacements repris de la maquette d'origine. */

:root {
  --bg-app: #f4f5f6;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --green: #16a34a;
  --green-dark: #15803d;
  --green-light: #dcfce7;
  --green-lighter: #f0fdf4;
  --green-border: #bbf7d0;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --red-border: #fecaca;
  --sidebar-bg: #0d1912;
  --sidebar-border: #1b2e22;
  --sidebar-active-bg: #16281b;
  --sidebar-active-fg: #34d399;
  --sidebar-inactive-fg: #a9b8ae;
  --sidebar-muted: #7c9186;
  --font: 'Inter', sans-serif;
  --radius-card: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  background: var(--bg-app);
  color: var(--text-primary);
}

::placeholder { color: var(--text-muted); }

a { color: inherit; text-decoration: none; }

button { font-family: inherit; }

img { max-width: 100%; }

[hidden] { display: none !important; }

/* ---------- Layout ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  align-self: flex-start;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 26px 8px;
}

.sidebar-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--sidebar-active-bg);
}

.sidebar-brand-name { color: #fff; font-weight: 800; font-size: 14px; letter-spacing: 0.3px; line-height: 1.15; }
.sidebar-brand-name.accent { color: var(--sidebar-active-fg); }

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

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.3px;
  cursor: pointer;
  color: var(--sidebar-inactive-fg);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-nav-item svg { flex-shrink: 0; }

.sidebar-nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-fg);
  font-weight: 700;
}

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }

.sidebar-howitworks {
  font-size: 12px;
  color: var(--sidebar-muted);
  cursor: pointer;
  padding: 0 8px;
  text-decoration: underline;
  text-decoration-color: #3a4c40;
  background: none;
  border: none;
  text-align: left;
}

.sidebar-user {
  border-top: 1px solid var(--sidebar-border);
  padding-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 8px;
}

.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #1b3123; color: var(--sidebar-active-fg);
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-name { color: #e5e7eb; font-weight: 700; font-size: 13px; }
.sidebar-user-company { color: var(--sidebar-muted); font-size: 11.5px; }
.sidebar-logout {
  background: none; border: none; cursor: pointer; color: var(--sidebar-muted);
  font-size: 11.5px; text-align: left; padding: 0; margin-top: 2px;
}
.sidebar-logout:hover { color: #e5e7eb; }

.content {
  flex: 1;
  padding: 30px 36px;
  min-width: 0;
}

/* ---------- Page header ---------- */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-title-row { display: flex; gap: 14px; }

.page-icon-badge {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.page-icon-badge img { width: 22px; height: 22px; object-fit: contain; }

.page-title { font-size: 24px; font-weight: 800; color: var(--text-primary); }
.page-subtitle { font-size: 13.5px; color: var(--text-secondary); margin-top: 2px; }

.page-actions { display: flex; gap: 10px; }

/* ---------- Buttons ---------- */

.btn {
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-default { background: #fff; border-color: var(--border); color: #374151; }
.btn-primary { background: var(--green); color: #fff; }
.btn-danger { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
.btn-sm { padding: 8px 14px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Card ---------- */

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 20px;
}

/* ---------- Badges / chips ---------- */

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  display: inline-block;
}

.tag-chip {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  display: inline-block;
}

.filter-chip {
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--border);
  color: #374151;
}
.filter-chip.active { background: var(--green); color: #fff; border-color: var(--green); font-weight: 700; }

/* ---------- Form controls ---------- */

.input, .select {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  color: var(--text-primary);
}
.select { font-weight: 600; color: #374151; cursor: pointer; }
textarea.input { width: 100%; min-height: 84px; resize: vertical; line-height: 1.5; }

.filters-row { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters-row .input { flex: 1; min-width: 220px; }

/* ---------- Global search ---------- */

.search-wrap { position: relative; }
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14); z-index: 50; max-height: 380px; overflow-y: auto;
}
.search-group-label { font-size: 11px; font-weight: 700; color: var(--text-secondary); letter-spacing: 0.4px; padding: 10px 14px 4px; }
.search-result-row { padding: 8px 14px; cursor: pointer; font-size: 13.5px; color: var(--text-primary); }
.search-result-row:hover { background: var(--border-light); }

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  padding-bottom: 12px;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border-top: none; border-left: none; border-right: none;
}
.tab.active { border-bottom-color: var(--green); color: var(--green); font-weight: 700; }
.tab-count {
  background: var(--border-light); color: var(--text-secondary);
  font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 10px;
}
.tab.active .tab-count { background: var(--green-light); color: var(--green-dark); }

/* ---------- KPI cards ---------- */

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-card); padding: 18px 20px; }
.kpi-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--green-light); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.kpi-label { font-size: 11.5px; font-weight: 700; color: var(--text-secondary); letter-spacing: 0.4px; margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; }
.kpi-delta { font-size: 12px; color: var(--green); font-weight: 600; margin-bottom: 10px; }

/* ---------- Video / thumbnail ---------- */

.thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #eef0ef;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11.5px;
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-duration {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.65); color: #fff;
  font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 5px;
}
.thumb-square { aspect-ratio: 1 / 1; height: auto; }
.video-pub-badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(107,114,128,0.92); color: #fff;
  font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px;
  display: flex; align-items: center; gap: 4px;
}
.video-pub-badge.is-published { background: rgba(22,163,74,0.92); }

.video-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 22px; }
.video-grid-compact { grid-template-columns: repeat(5, 1fr); gap: 16px; }
@media (max-width: 1300px) { .video-grid-compact { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1000px) { .video-grid-compact { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .video-grid-compact { grid-template-columns: repeat(2, 1fr); } }
.video-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; cursor: pointer; }
.video-card-body { padding: 14px 16px; }
.video-card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; line-height: 1.3; }
.video-card-date { font-size: 11.5px; color: var(--text-muted); margin-bottom: 8px; }

/* ---------- Sidebars (right column) ---------- */

.side-col { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.side-col-title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.summary-row { display: flex; justify-content: space-between; color: #374151; font-size: 13px; }
.summary-row.total { border-top: 1px solid var(--border-light); padding-top: 9px; color: var(--text-primary); font-weight: 700; }

/* ---------- Empty state ---------- */

.empty-state { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-card); }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6,13,9,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 30px;
}
.modal-box {
  background: #fff; border-radius: 18px; padding: 32px;
  max-width: 1040px; width: 100%; max-height: 90vh; overflow-y: auto;
}

/* ---------- Login page ---------- */

.login-shell {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  min-height: 100vh; gap: clamp(10px, 2vw, 30px); padding: 16px;
  background: radial-gradient(circle at 78% 32%, #1c3a25 0%, #0b1a11 55%, #060d09 100%);
}
.login-panel {
  flex: 0 0 auto; display: flex; flex-direction: column; justify-content: center;
  padding: 80px 90px; width: 680px; max-width: 100%;
}
.login-mascot {
  flex: 1 1 auto; display: flex; align-items: center; justify-content: center;
  min-width: 0;
}
.login-mascot img {
  max-width: 100%; max-height: 100vh; width: auto; height: auto;
  object-fit: contain;
  /* Coupe l'alpha résiduelle quasi nulle du PNG (invisible sur fond clair,
     visible en rectangle sur ce fond sombre) sans durcir les vrais bords
     du personnage — voir le filtre SVG #mascot-alpha-clip dans index.html. */
  filter: url(#mascot-alpha-clip);
}
@media (max-width: 1100px) {
  .login-mascot { display: none; }
}
.login-kicker { display: inline-flex; align-items: center; gap: 8px; color: #34d399; font-weight: 700; font-size: 17px; letter-spacing: 1px; margin-bottom: 22px; }
.login-kicker .dot { width: 6px; height: 6px; border-radius: 50%; background: #34d399; display: inline-block; }
.login-title { font-size: 56px; font-weight: 800; line-height: 1.05; color: #fff; letter-spacing: -1px; }
.login-title.outline { color: transparent; -webkit-text-stroke: 2px #fff; font-family: Arial; margin-bottom: 26px; }
.login-tagline { font-size: 13px; font-weight: 700; letter-spacing: 2.5px; color: #34d399; margin-bottom: 34px; }
.login-field {
  background: #152a1d; border: 1px solid #274232; border-radius: 10px;
  padding: 16px 18px; color: #e5e7eb; font-size: 15px; font-family: inherit; outline: none; width: 100%;
}
.login-fields { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.login-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; font-size: 13px; color: #9db3a5; }
.login-btn {
  background: #3fa66a; border: none; border-radius: 10px; padding: 16px; width: 100%;
  color: #062915; font-weight: 800; font-size: 14px; letter-spacing: 0.5px; cursor: pointer;
}
.login-footer { margin-top: 26px; font-size: 12px; color: #5f7568; }
.login-error { color: #fca5a5; font-size: 13px; margin-bottom: 14px; min-height: 18px; }

/* ---------- Utility ---------- */

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-8 { gap: 8px; }
.text-muted { color: var(--text-muted); }
.mt-16 { margin-top: 16px; }

@media (max-width: 900px) {
  .kpi-grid, .video-grid { grid-template-columns: repeat(2, 1fr); }
}
