/* admin/assets/style.css — EcoScore brand-library admin */
:root {
  --bg: #14181f;
  --surface: #1b2129;
  --surface-2: #222a34;
  --border: #2c3744;
  --text: #e2e8f0;
  --text-dim: #93a1b3;
  --accent: #4ec86e;
  --accent-dim: rgba(78, 200, 110, 0.15);
  --danger: #ff5b5b;
  --danger-dim: rgba(255, 91, 91, 0.12);
  --pink: #c04da1;
  --radius: 10px;
  --radius-sm: 6px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Login ── */
.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px 32px; width: 340px; text-align: center;
}
.login-card .brand { font-size: 22px; font-weight: 700; color: var(--accent); }
.login-card h1 { font-size: 17px; margin: 14px 0 2px; }
.login-card .sub { color: var(--text-dim); font-size: 12.5px; margin: 0 0 20px; }
.login-card label { display: block; text-align: left; font-size: 12px; color: var(--text-dim); margin-bottom: 12px; }
.login-card input {
  width: 100%; margin-top: 4px; padding: 9px 11px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px;
}

/* ── Layout ── */
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 22px;
}
.topbar .logo { font-size: 21px; letter-spacing: -0.3px; }
.topbar .logo-eco { font-weight: 800; color: var(--accent); }
.topbar .logo-skm { font-weight: 300; color: #fff; }
.credits { display: inline-flex; align-items: center; gap: 7px; margin-left: 18px; flex-wrap: wrap; }
.credits__word { font-size: 11px; font-weight: 300; color: var(--text-dim); font-style: italic; }
.credits__name { font-size: 12px; font-weight: 600; color: #fff; }
.credits__logo { height: 23px; width: auto; opacity: 0.95; vertical-align: middle; }
.credits__logo--wide { height: 20px; }
.site-footer { text-align: center; color: var(--text-dim); font-size: 11px; padding: 26px 0 18px; opacity: 0.65; }

/* ── Material thumbnail grid (inside an opened brand) ── */
/* Small SQUARE thumbnails with rounded corners, in the same compact spirit as
   the brand cards. The image is cropped to fill the square (object-fit cover). */
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.mat-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.mat-card__thumb { aspect-ratio: 1 / 1; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.mat-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.mat-card__thumb--empty img { display: none; }
.mat-card__thumb--empty::after { content: "—"; color: var(--text-dim); font-size: 20px; }
.mat-card__name { font-size: 10.5px; padding: 7px 8px 3px; word-break: break-word; line-height: 1.3; }
.mat-card__row { display: flex; align-items: center; justify-content: space-between; padding: 3px 8px 8px; gap: 6px; }
.mat-card__row .btn.danger { padding: 3px 7px; font-size: 11px; }
.lang-toggle {
  font-size: 12px; font-weight: 700; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 9px; margin-right: 4px;
}
.lang-toggle:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.lang-toggle--corner { position: fixed; top: 16px; right: 18px; }
.site-footer { text-align: center; color: var(--text-dim); font-size: 11px; padding: 24px 0 18px; opacity: 0.7; }
.login-copyright { margin-top: 18px; font-size: 10.5px; color: var(--text-dim); opacity: 0.7; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--text-dim); font-size: 12.5px; }
.topbar .who b { color: var(--text); }
.topbar .role-badge {
  font-size: 10.5px; padding: 2px 8px; border-radius: 20px; margin-left: 6px;
  background: var(--accent-dim); color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px;
}
.nav { display: flex; gap: 4px; padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--border); }
.nav a {
  padding: 10px 16px; color: var(--text-dim); font-size: 13px; font-weight: 500;
  border-bottom: 2px solid transparent;
}
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav a:hover { text-decoration: none; color: var(--text); }
.wrap { max-width: 1700px; margin: 0 auto; padding: 24px 40px; }
.wrap.wide { max-width: 1700px; }

/* ── Components ── */
h2 { font-size: 16px; margin: 0 0 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.row { display: flex; align-items: center; gap: 12px; }
.muted { color: var(--text-dim); font-size: 12.5px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.12s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #0c1118; border-color: var(--accent); width: 100%; justify-content: center; padding: 10px; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: transparent; background: var(--danger-dim); padding: 5px 10px; font-size: 12px; }
.btn.danger:hover { border-color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 600; }
td { padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }

input[type=text], input[type=password], select {
  padding: 8px 10px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 13px;
}
input[type=file] { color: var(--text-dim); font-size: 13px; }

/* Custom file picker — hides the native (browser-language) control and shows
   a translated button + filename, so it follows the EN/FR toggle. */
.filepick { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.filepick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.filepick__btn {
  display: inline-flex; align-items: center; white-space: nowrap;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 500;
}
.filepick:hover .filepick__btn { border-color: var(--accent); }
.filepick__name { color: var(--text-dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filepick--sm .filepick__btn { padding: 5px 10px; font-size: 12px; }
label.field { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 12px; }
label.field input, label.field select { display: block; width: 100%; margin-top: 4px; }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert.ok { background: var(--accent-dim); color: var(--accent); }
.alert.err { background: var(--danger-dim); color: var(--danger); }

.pill { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--surface-2); color: var(--text-dim); }
.brand-tag { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--accent); }

.audit { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--text-dim); white-space: pre-wrap; line-height: 1.7; }

/* ── View subnav (Par marque / Tout afficher) ── */
.subnav { display: flex; gap: 6px; margin-bottom: 16px; }
.subnav a {
  padding: 6px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
}
.subnav a.on { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.subnav a:hover { text-decoration: none; color: var(--text); }

/* ── Brand cards grid ── */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.brand-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 12px; text-align: center; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; transition: all 0.12s; color: var(--text);
  min-height: 150px;
}
.brand-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.brand-card__name { font-weight: 600; font-size: 13.5px; }
.brand-card__count { font-size: 11.5px; color: var(--text-dim); }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; color: var(--text); font-weight: 600;
  font-size: 20px; text-transform: uppercase;
  background: none; border: 1px solid var(--text-dim);
}
/* A real logo shows larger than the initial circle (no background, no rounding,
   no padding so a white transparent PNG reads clearly) but stays within the
   compact square card. */
.avatar--logo {
  width: 96px; height: 96px; border-radius: 0; background: none; overflow: visible;
  border: none;
}
.avatar--logo img { width: 100%; height: 100%; object-fit: contain; padding: 0; }
h2 .avatar { width: 30px; height: 30px; font-size: 15px; vertical-align: -9px; margin-right: 8px; }
h2 .avatar--logo { width: 40px; height: 40px; vertical-align: -12px; }

/* ── Leaf icons (reused from the EcoScore plugin set) ── */
.ico { width: 16px; height: 16px; vertical-align: -3px; display: inline-block; flex: 0 0 16px; }
.btn .ico { margin-right: 2px; }
.btn.danger .ico { width: 14px; height: 14px; }
.topbar .logo-ico { width: 22px; height: 22px; vertical-align: -5px; margin-right: 4px; }
h2 .ico { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; }

/* On filled coloured buttons (primary), the leaf must read in WHITE so it
   stands out against the green/coloured background. */
.btn.primary .ico { filter: brightness(0) invert(1); }
.btn.primary .ico.ico--asis { filter: none; }
.ico--asis { filter: none; }

/* Tint helpers — recolour a (dark-drawn) leaf SVG via filter so it matches
   the button label. brightness(0) makes it black first, then we shift.
   --ico-light: near-white leaf (for dark-background buttons).
   --ico-navy : navy-blue leaf (upload button, readable on green). */
.ico--light { filter: brightness(0) invert(0.9); }
.ico--navy  { filter: brightness(0) saturate(100%) invert(13%) sepia(60%) saturate(2200%) hue-rotate(205deg) brightness(95%) contrast(101%); }
/* When a tinted leaf sits on a primary button, the tint wins over the
   default white rule above. */
.btn.primary .ico.ico--navy { filter: brightness(0) saturate(100%) invert(13%) sepia(60%) saturate(2200%) hue-rotate(205deg) brightness(95%) contrast(101%); }

/* "Add / create" buttons: a small + badge sits at the base of the leaf.
   Wrap the icon in .ico-add to position the +. */
.ico-add { position: relative; display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; flex: 0 0 16px; }
.ico-add .ico { margin: 0; }
.ico-add::after {
  content: "+";
  position: absolute; right: -5px; bottom: -4px;
  font-size: 13px; font-weight: 800; line-height: 1;
  color: #fff; text-shadow: 0 0 2px rgba(0,0,0,0.6);
}
