/* ═══════════════════════════════════════════════════════════
   AELIO — Emoji Manager · style.css
   Palette : blanc / gris très léger + bleu clair accent
   Style   : Premium Apple/Linear.app — même thème qu'Aelio
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=DM+Serif+Display:ital@0;1&display=swap');

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

:root {
  --blue:        #5BA4CF;
  --blue-light:  #A8CFEA;
  --blue-xlight: #E8F4FB;
  --blue-dark:   #3D7FAA;
  --ink:         #0F1419;
  --ink-2:       #374151;
  --ink-3:       #6B7280;
  --ink-4:       #9CA3AF;
  --line:        #E5E7EB;
  --line-soft:   #F3F6F9;
  --white:       #FFFFFF;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:      0 4px 16px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg:   0 16px 48px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
}

html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--line-soft);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'DM Serif Display', Georgia, serif; line-height: 1.15; }
em { font-style: italic; color: var(--blue); }
a  { color: inherit; text-decoration: none; }
code {
  font-family: 'SF Mono', 'Fira Mono', monospace;
  background: var(--blue-xlight);
  color: var(--blue-dark);
  padding: 2px 7px; border-radius: 5px; font-size: .88em;
}
.hidden { display: none !important; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--blue); color: var(--white);
  font-size: .95rem; font-weight: 600; font-family: inherit;
  padding: 13px 28px; border-radius: 10px;
  border: none; cursor: pointer;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 2px 12px rgba(91,164,207,.35);
}
.btn-primary:hover  { background: var(--blue-dark); transform: translateY(-1px); }
.btn-primary:active { transform: none; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: var(--ink-2);
  font-size: .9rem; font-weight: 500; font-family: inherit;
  padding: 11px 22px; border-radius: 10px;
  border: 1.5px solid var(--line); cursor: pointer;
  transition: border-color .2s, color .2s, transform .15s;
}
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

.btn-ghost-sm {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--ink-3);
  font-size: .82rem; font-weight: 500;
  padding: 7px 14px; border-radius: 8px;
  border: 1.5px solid var(--line); cursor: pointer;
  transition: border-color .2s, color .2s;
}
.btn-ghost-sm:hover { border-color: var(--blue); color: var(--blue); }

.btn-logout {
  background: none; border: 1.5px solid var(--line);
  border-radius: 8px; padding: 7px 14px;
  font-size: .82rem; font-weight: 600; font-family: inherit;
  color: var(--ink-3); cursor: pointer;
  transition: all .2s;
}
.btn-logout:hover { border-color: #DC2626; color: #DC2626; }

/* ── LOGIN ────────────────────────────────────────────────── */
#loginScreen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--line-soft);
}
.login-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 52px 44px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg); text-align: center;
}
.login-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 2.2rem; color: var(--ink); margin-bottom: 8px;
}
.login-sub { font-size: .9rem; color: var(--ink-3); margin-bottom: 36px; }
.login-field { text-align: left; margin-bottom: 20px; }
.login-label {
  display: block; font-size: .78rem; font-weight: 600;
  color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 8px;
}
.login-input {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--line); border-radius: 10px;
  font-size: .95rem; font-family: inherit; color: var(--ink);
  outline: none; transition: border-color .2s; background: var(--white);
}
.login-input:focus { border-color: var(--blue); }
#loginBtn { width: 100%; justify-content: center; }
.login-error {
  color: #DC2626; font-size: .85rem; margin-top: 14px;
  background: #FEF2F2; border: 1px solid #FECACA;
  border-radius: 8px; padding: 10px 14px;
}

/* ── NAV ──────────────────────────────────────────────────── */
#nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 64px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; }
.logo-text { font-family: 'DM Serif Display', serif; font-size: 1.3rem; color: var(--ink); }
.nav-sep   { color: var(--ink-4); font-size: 1rem; }
.nav-title { font-size: .88rem; font-weight: 500; color: var(--ink-3); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-badge {
  font-size: .78rem; font-weight: 700; color: var(--blue-dark);
  background: var(--blue-xlight); border: 1px solid var(--blue-light);
  padding: 4px 12px; border-radius: 100px;
}

/* ── MAIN ─────────────────────────────────────────────────── */
.main { max-width: 1100px; margin: 0 auto; padding: 40px 24px 80px; }

/* ── UPLOAD ZONE ──────────────────────────────────────────── */
.upload-zone {
  position: relative;
  border: 2px dashed var(--blue-light);
  border-radius: var(--radius);
  background: var(--blue-xlight);
  padding: 52px 24px; text-align: center;
  cursor: pointer; transition: all .25s;
  margin-bottom: 28px;
}
.upload-zone:hover, .upload-zone.drag {
  border-color: var(--blue);
  background: #d4eaf6;
}
.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0;
  cursor: pointer; width: 100%; height: 100%; z-index: 2;
}
.upload-icon {
  width: 56px; height: 56px;
  background: var(--white); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px; box-shadow: var(--shadow);
}
.upload-icon svg { width: 28px; height: 28px; stroke: var(--blue-dark); }
.upload-zone h3  { font-size: 1.15rem; font-weight: 600; color: var(--ink); margin-bottom: 8px; font-family: 'DM Sans', sans-serif; }
.upload-zone p   { font-size: .88rem; color: var(--ink-3); }
.upload-hint     { display: inline-block; margin-top: 12px; font-size: .8rem; font-weight: 600; color: var(--blue-dark); background: var(--white); border: 1px solid var(--blue-light); padding: 4px 14px; border-radius: 100px; }

.upload-progress { margin-top: 20px; }
.progress-bar {
  width: 100%; max-width: 320px; height: 6px;
  background: var(--blue-light); border-radius: 100px;
  margin: 0 auto 8px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0; background: var(--blue);
  border-radius: 100px; transition: width .3s ease;
}
#progressText { font-size: .82rem; color: var(--blue-dark); font-weight: 600; }

/* ── API INFO BOX ─────────────────────────────────────────── */
.api-box {
  display: flex; align-items: center; gap: 16px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px;
  margin-bottom: 36px; flex-wrap: wrap;
}
.api-box-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  background: var(--blue-xlight); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.api-box-icon svg { stroke: var(--blue-dark); }
.api-box-content { flex: 1; min-width: 200px; }
.api-box-content strong { display: block; font-size: .92rem; color: var(--ink); margin-bottom: 4px; }
.api-box-content p { font-size: .83rem; color: var(--ink-3); }
.api-box-link { font-size: .85rem; font-weight: 600; color: var(--blue); white-space: nowrap; transition: color .2s; }
.api-box-link:hover { color: var(--blue-dark); }

/* ── GRID HEADER ──────────────────────────────────────────── */
.grid-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.grid-title { font-size: 1.8rem; color: var(--ink); margin-bottom: 4px; }
.grid-sub   { font-size: .88rem; color: var(--ink-3); }
.grid-sub strong { font-weight: 600; color: var(--ink-2); }
.count-badge {
  font-size: .8rem; font-weight: 700; color: var(--blue-dark);
  background: var(--blue-xlight); border: 1px solid var(--blue-light);
  padding: 5px 14px; border-radius: 100px; white-space: nowrap;
}

/* ── EMOJI GRID ───────────────────────────────────────────── */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}
.emoji-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.emoji-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.emoji-preview {
  height: 130px;
  display: flex; align-items: center; justify-content: center;
  background: var(--line-soft); border-bottom: 1px solid var(--line);
  position: relative;
}
.emoji-preview img {
  max-width: 80px; max-height: 80px;
  object-fit: contain; image-rendering: auto;
}
.emoji-preview .preview-loader {
  width: 28px; height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  position: absolute;
}
@keyframes spin { to { transform: rotate(360deg); } }

.emoji-body { padding: 14px; }
.emoji-name {
  font-size: .88rem; font-weight: 600; color: var(--ink);
  margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.emoji-format {
  font-family: 'SF Mono', 'Fira Mono', monospace;
  font-size: .7rem; color: var(--blue-dark);
  background: var(--blue-xlight); padding: 4px 8px;
  border-radius: 6px; display: block;
  margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.emoji-url {
  font-size: .7rem; color: var(--ink-4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 12px; display: block;
}
.emoji-actions { display: flex; gap: 6px; }
.btn-action {
  flex: 1; padding: 8px 4px;
  border-radius: 7px; border: 1.5px solid var(--line);
  background: transparent; font-size: .72rem; font-weight: 600;
  font-family: inherit; cursor: pointer; color: var(--ink-2);
  transition: all .2s; white-space: nowrap;
}
.btn-action:hover           { border-color: var(--blue);   color: var(--blue); }
.btn-action.copy:hover      { border-color: #16A34A; color: #16A34A; background: #DCFCE7; }
.btn-action.del:hover       { border-color: #DC2626; color: #DC2626; background: #FEE2E2; }
.btn-action.copied          { border-color: #16A34A; color: #16A34A; background: #DCFCE7; }

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 80px 24px; color: var(--ink-4);
}
.empty-icon {
  width: 64px; height: 64px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; box-shadow: var(--shadow-sm);
}
.empty-icon svg { width: 32px; height: 32px; stroke: var(--ink-4); }
.empty-state p    { font-size: 1rem; color: var(--ink-3); font-weight: 500; margin-bottom: 6px; }
.empty-state span { font-size: .88rem; color: var(--ink-4); }

/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--white); border-radius: var(--radius);
  padding: 36px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.modal h3    { font-size: 1.15rem; font-weight: 600; font-family: 'DM Sans', sans-serif; margin-bottom: 6px; }
.modal-sub   { font-size: .85rem; color: var(--ink-3); margin-bottom: 22px; }
.modal input {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--line); border-radius: 10px;
  font-size: .95rem; font-family: inherit; color: var(--ink);
  outline: none; transition: border-color .2s; background: var(--white);
  margin-bottom: 20px;
}
.modal input:focus { border-color: var(--blue); }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn-primary { flex: 1; justify-content: center; }
.modal-actions .btn-ghost   { flex: 1; justify-content: center; }

/* ── TOAST ────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 999;
  background: var(--ink); color: #fff;
  padding: 13px 22px; border-radius: 10px;
  font-size: .9rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.hidden { display: none; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .main { padding: 24px 16px 60px; }
  .login-card { padding: 36px 24px; }
  .nav-inner { padding: 0 16px; }
  .emoji-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .api-box { flex-direction: column; }
  .nav-right .btn-ghost-sm { display: none; }
}
