/* ===== RESET ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background .6s ease, color .6s ease;
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--ac);
  border-radius: 10px;
  opacity: .5;
}

/* ===== COLOR ACCENTS ===== */
[data-color="violet"] {
  --ac: #8b5cf6;
  --ac2: #a78bfa;
  --ac3: #c4b5fd;
  --acg: linear-gradient(135deg, #8b5cf6, #06b6d4);
  --acg2: linear-gradient(135deg, #c4b5fd, #a5f3fc);
  --glow: rgba(139, 92, 246, .35);
}

[data-color="blue"] {
  --ac: #3b82f6;
  --ac2: #60a5fa;
  --ac3: #93c5fd;
  --acg: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --acg2: linear-gradient(135deg, #93c5fd, #c4b5fd);
  --glow: rgba(59, 130, 246, .35);
}

[data-color="teal"] {
  --ac: #14b8a6;
  --ac2: #2dd4bf;
  --ac3: #5eead4;
  --acg: linear-gradient(135deg, #14b8a6, #3b82f6);
  --acg2: linear-gradient(135deg, #5eead4, #93c5fd);
  --glow: rgba(20, 184, 166, .35);
}

[data-color="rose"] {
  --ac: #f43f5e;
  --ac2: #fb7185;
  --ac3: #fda4af;
  --acg: linear-gradient(135deg, #f43f5e, #a855f7);
  --acg2: linear-gradient(135deg, #fda4af, #d8b4fe);
  --glow: rgba(244, 63, 94, .35);
}

[data-color="amber"] {
  --ac: #f59e0b;
  --ac2: #fbbf24;
  --ac3: #fcd34d;
  --acg: linear-gradient(135deg, #f59e0b, #ef4444);
  --acg2: linear-gradient(135deg, #fcd34d, #fca5a5);
  --glow: rgba(245, 158, 11, .35);
}

[data-color="mint"] {
  --ac: #10b981;
  --ac2: #34d399;
  --ac3: #6ee7b7;
  --acg: linear-gradient(135deg, #10b981, #06b6d4);
  --acg2: linear-gradient(135deg, #6ee7b7, #67e8f9);
  --glow: rgba(16, 185, 129, .35);
}

[data-color="indigo"] {
  --ac: #6366f1;
  --ac2: #818cf8;
  --ac3: #a5b4fc;
  --acg: linear-gradient(135deg, #6366f1, #a855f7);
  --acg2: linear-gradient(135deg, #a5b4fc, #d8b4fe);
  --glow: rgba(99, 102, 241, .35);
}

[data-color="pink"] {
  --ac: #ec4899;
  --ac2: #f472b6;
  --ac3: #f9a8d4;
  --acg: linear-gradient(135deg, #ec4899, #f43f5e);
  --acg2: linear-gradient(135deg, #f9a8d4, #fda4af);
  --glow: rgba(236, 72, 153, .35);
}

[data-color="orange"] {
  --ac: #f97316;
  --ac2: #fb923c;
  --ac3: #fdba74;
  --acg: linear-gradient(135deg, #f97316, #f59e0b);
  --acg2: linear-gradient(135deg, #fdba74, #fcd34d);
  --glow: rgba(249, 115, 22, .35);
}

[data-color="slate"] {
  --ac: #64748b;
  --ac2: #94a3b8;
  --ac3: #cbd5e1;
  --acg: linear-gradient(135deg, #64748b, #475569);
  --acg2: linear-gradient(135deg, #cbd5e1, #94a3b8);
  --glow: rgba(100, 116, 139, .35);
}

[data-color="emerald"] {
  --ac: #059669;
  --ac2: #10b981;
  --ac3: #34d399;
  --acg: linear-gradient(135deg, #059669, #3b82f6);
  --acg2: linear-gradient(135deg, #10b981, #93c5fd);
  --glow: rgba(5, 150, 105, .35);
}

[data-color="sand"] {
  --ac: #9d8d64;
  --ac2: #bdaa7b;
  --ac3: #d4cfb4;
  --acg: linear-gradient(135deg, #9d8d64, #7c6f49);
  --acg2: linear-gradient(135deg, #d4cfb4, #bdaa7b);
  --glow: rgba(157, 141, 100, .35);
}

.search-highlight {
  background: var(--ac);
  color: #fff;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: bold;
  box-shadow: 0 0 10px var(--glow);
}

/* ===== LIGHT THEME ===== */
:root,
[data-theme="light"] {
  --bg: #f0eef8;
  --bg2: #e8e4f5;
  --bgc: rgba(255, 255, 255, .72);
  --bgc-solid: #fff;
  --bgh: rgba(240, 238, 248, .82);
  --bgm: rgba(20, 10, 50, .22);
  --tx: #1a1640;
  --tx2: #64618a;
  --tx3: #9e9bb8;
  --bd: rgba(200, 195, 225, .45);
  --bds: rgba(200, 195, 225, .25);
  --sh: 0 2px 12px rgba(100, 80, 160, .06);
  --shl: 0 12px 40px rgba(100, 80, 160, .1);
  --glass-border: rgba(255, 255, 255, .5);
}

/* ===== DARK THEME ===== */
[data-theme="dark"] {
  --bg: #0c0a18;
  --bg2: #16122a;
  --bgc: rgba(25, 20, 45, .72);
  --bgc-solid: #19142d;
  --bgh: rgba(12, 10, 24, .88);
  --bgm: rgba(0, 0, 0, .5);
  --tx: #e4e0f5;
  --tx2: #9b96b8;
  --tx3: #5e5980;
  --bd: rgba(80, 70, 120, .3);
  --bds: rgba(80, 70, 120, .15);
  --sh: 0 2px 12px rgba(0, 0, 0, .2);
  --shl: 0 12px 40px rgba(0, 0, 0, .3);
  --glass-border: rgba(255, 255, 255, .06);
}

body {
  background: var(--bg);
  color: var(--tx);
}

/* ===== AMBIENT BLOBS ===== */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .35;
  animation: drift 18s ease-in-out infinite alternate;
}

[data-theme="dark"] .blob {
  opacity: .15;
}

.b1 {
  width: 500px;
  height: 500px;
  background: var(--ac);
  top: -10%;
  left: -10%;
  animation-delay: 0s;
}

.b2 {
  width: 400px;
  height: 400px;
  background: var(--ac2);
  bottom: -5%;
  right: -8%;
  animation-delay: -6s;
}

.b3 {
  width: 350px;
  height: 350px;
  background: var(--ac3);
  top: 40%;
  left: 50%;
  animation-delay: -12s;
}

@keyframes drift {
  0% {
    transform: translate(0, 0) scale(1)
  }

  50% {
    transform: translate(40px, -30px) scale(1.12)
  }

  100% {
    transform: translate(-20px, 25px) scale(.95)
  }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(28px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes tabIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(.9)
  }

  to {
    opacity: 1;
    transform: scale(1)
  }
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(.75)
  }

  60% {
    transform: scale(1.06)
  }

  100% {
    opacity: 1;
    transform: scale(1)
  }
}

@keyframes glowPulse {

  0%,
  100% {
    box-shadow: 0 0 20px var(--glow)
  }

  50% {
    box-shadow: 0 0 40px var(--glow)
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%)
  }

  100% {
    transform: translateX(100%)
  }
}

.an-down {
  animation: slideDown .6s cubic-bezier(.22, 1, .36, 1) both;
}

.an-up {
  animation: slideUp .65s cubic-bezier(.22, 1, .36, 1) both;
}

.an-pop {
  animation: popIn .5s cubic-bezier(.22, 1, .36, 1) both;
}

.d1 {
  animation-delay: .08s
}

.d2 {
  animation-delay: .16s
}

.d3 {
  animation-delay: .24s
}

.d4 {
  animation-delay: .32s
}

.d5 {
  animation-delay: .4s
}

/* ===== GLASS UTILITY ===== */
.glass {
  background: var(--bgc);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--glass-border);
}

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bgh);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid var(--bd);
  transition: background .6s, border-color .6s;
}

.hw {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-gem {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--acg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px var(--glow);
  transition: background .6s, box-shadow .6s, border-color .6s;
}

/* Image Upload Zones */
.image-upload-zone {
  position: relative;
  width: 100%;
  min-height: 100px;
  border: 2px dashed var(--bd);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .3s;
  background: var(--bg2);
  overflow: hidden;
  gap: 8px;
  padding: 10px;
}

.image-upload-zone:hover {
  border-color: var(--ac);
  background: rgba(139, 92, 246, 0.05);
}

.image-upload-zone i {
  width: 24px;
  height: 24px;
  color: var(--ac);
}

.image-upload-zone span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tx2);
}

.upload-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.up-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform .2s;
}

.up-remove:hover {
  transform: scale(1.1);
  background: #ef4444;
}

.image-upload-zone.has-image .upload-preview,
.image-upload-zone.has-image .up-remove {
  display: flex;
}

.image-upload-zone.has-image .up-msg {
  display: none;
}

.logo-gem i {
  width: 18px;
  height: 18px;
}

.logo-name {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -.01em;
}

.logo-name strong {
  font-weight: 800;
}

.hactions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Search */
.searchbar {
  display: flex;
  align-items: center;
  background: var(--bgc);
  backdrop-filter: blur(12px);
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 0 10px;
  gap: 6px;
  transition: all .3s;
}

.searchbar:focus-within {
  border-color: var(--ac);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .1);
}

.s-ico {
  width: 15px;
  height: 15px;
  color: var(--tx3);
}

.searchbar input {
  border: none;
  background: transparent;
  color: var(--tx);
  font-family: inherit;
  font-size: .82rem;
  padding: 7px 0;
  width: 140px;
  outline: none;
}

.searchbar input::placeholder {
  color: var(--tx3);
}

/* Header buttons */
.hbtn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--bd);
  background: var(--bgc);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx);
  transition: all .3s;
  position: relative;
  overflow: hidden;
}

.hbtn:hover {
  border-color: var(--ac);
  background: rgba(139, 92, 246, .08);
  transform: scale(1.1);
  box-shadow: 0 0 16px var(--glow);
}

.hbtn i {
  width: 16px;
  height: 16px;
  transition: opacity .4s, transform .4s;
}

.hbtn .ico-d,
.hbtn .ico-l {
  position: absolute;
}

.hbtn i {
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="light"] .ico-d {
  opacity: 0;
  transform: rotate(90deg);
}

[data-theme="light"] .ico-l {
  opacity: 1;
  transform: rotate(0);
}

[data-theme="dark"] .ico-l {
  opacity: 0;
  transform: rotate(-90deg);
}

[data-theme="dark"] .ico-d {
  opacity: 1;
  transform: rotate(0);
}

/* ===== PALETTE ===== */
.palette {
  position: fixed;
  top: 56px;
  right: 128px;
  z-index: 150;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shl);
  animation: popIn .3s ease both;
  transition: background .6s, border-color .6s;
}

.pal-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tx3);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.pal-label i {
  width: 13px;
  height: 13px;
}

.pal-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: all .25s;
  position: relative;
}

.dot:hover {
  transform: scale(1.2);
}

.dot.active {
  border-color: var(--tx);
  transform: scale(1.15);
}

.dot.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
}

.dot-violet {
  background: #8b5cf6;
}

.dot-blue {
  background: #3b82f6;
}

.dot-teal {
  background: #14b8a6;
}

.dot-rose {
  background: #f43f5e;
}

.dot-amber {
  background: #f59e0b;
}

.dot-mint {
  background: #10b981;
}

.dot-indigo {
  background: #6366f1;
}

.dot-pink {
  background: #ec4899;
}

.dot-orange {
  background: #f97316;
}

.dot-slate {
  background: #64748b;
}

.dot-emerald {
  background: #059669;
}

.dot-sand {
  background: #9d8d64;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 7px 16px;
  border-radius: 10px;
  border: none;
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .3s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(.96);
}

.bi {
  width: 15px;
  height: 15px;
  color: inherit;
}

.btn-glow {
  background: var(--acg);
  color: #fff;
  box-shadow: 0 4px 20px var(--glow);
  transition: box-shadow .3s, transform .3s;
}

.btn-glow:hover {
  box-shadow: 0 6px 30px var(--glow);
}

.btn-glow::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .2), transparent);
  transition: left .5s;
}

.btn-glow:hover::after {
  left: 100%;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--bd);
  color: var(--tx);
  border-radius: 10px;
}

.btn-outline:hover {
  border-color: var(--ac);
  color: var(--ac);
  box-shadow: 0 0 12px var(--glow);
}

.btn-soft {
  background: var(--bg2);
  color: var(--tx);
  border: 1px solid var(--bd);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 16px rgba(239, 68, 68, .3);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-sm {
  padding: 4px 10px;
  font-size: .72rem;
}

.btn-pill {
  border-radius: 20px;
  font-weight: 600;
  color: #fff;
  padding: 7px 18px;
}

.pill-1 {
  background: var(--acg);
  box-shadow: 0 3px 14px var(--glow);
}

.pill-2 {
  background: linear-gradient(135deg, var(--ac2), var(--ac));
  box-shadow: 0 3px 14px var(--glow);
}

.pill-3 {
  background: linear-gradient(135deg, var(--ac3), var(--ac2));
  color: var(--tx);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .08);
}

.pill-4 {
  background: var(--ac);
  color: #fff;
  box-shadow: 0 3px 14px var(--glow);
}

/* ===== HERO ===== */
.hero {
  position: relative;
  max-width: 1200px;
  margin: 20px auto 0;
  padding: 28px 32px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 24px;
  overflow: hidden;
  z-index: 1;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--acg2);
  opacity: .25;
  z-index: -1;
  transition: opacity .6s;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  z-index: -1;
}

.hero-glow {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--ac);
  filter: blur(80px);
  opacity: .15;
  right: -40px;
  top: -40px;
  animation: glowPulse 4s ease-in-out infinite;
  pointer-events: none;
}

.hero-text h2 {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.15;
  margin-bottom: 4px;
}

.gradient-text {
  background: var(--acg);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--bgc);
  backdrop-filter: blur(8px);
  border: 1px solid var(--bd);
  font-size: .68rem;
  font-weight: 600;
  color: var(--ac);
  margin-bottom: 10px;
  transition: color .6s;
}

.hero-chip i {
  width: 12px;
  height: 12px;
}

.hero p {
  color: var(--tx2);
  font-size: .85rem;
  max-width: 360px;
}



/* Admin bar */
.admin-bar {
  max-width: 1200px;
  margin: 12px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  animation: slideUp .4s ease both;
}

/* ===== TABS ===== */
.tabs {
  max-width: 1200px;
  margin: 26px auto 36px;
  /* Augmenté davantage pour aérer l'interface */
  display: flex;
  gap: 3px;
  background: var(--bgc);
  backdrop-filter: blur(12px);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  transition: all .6s;
}

.tab {
  padding: 6px 18px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--tx2);
  font-family: inherit;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .3s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tab i {
  width: 14px;
  height: 14px;
}

.tab:hover {
  color: var(--tx);
  transform: translateY(-1px);
}

.tab.active {
  background: var(--acg);
  color: #fff;
  box-shadow: 0 2px 12px var(--glow);
}

/* ===== CONTENT ===== */
.main {
  flex: 1;
  position: relative;
  z-index: 1;
}

.sec {
  max-width: 1200px;
  margin: 14px auto 0;
  padding: 0 24px;
  display: none;
  /* Caché par défaut */
}

.sec.active-tab {
  display: block !important;
  animation: tabIn 0.4s cubic-bezier(.22, 1, .36, 1) both;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px;
  color: var(--tx3);
}

.empty i {
  width: 36px;
  height: 36px;
  opacity: .3;
}

/* ===== CARDS ===== */
.card {
  position: relative;
  background: var(--bgc);
  backdrop-filter: blur(16px);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--sh);
  transition: all .35s cubic-bezier(.22, 1, .36, 1);
  animation: slideUp .5s cubic-bezier(.22, 1, .36, 1) both;
  overflow: visible;
  /* Permet au badge de déborder */
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

/* Nouveau Shimmer sans overflow:hidden sur le parent */
.card-shimmer {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.card-shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent);
  transition: left .6s ease;
}

.card:hover .card-shimmer::after {
  left: 150%;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 85%;
  /* Occupe presque toute la largeur tout en respectant l'arrondi */
  height: 3px;
  background: var(--acg);
  opacity: .35;
  transition: all .3s;
  border-radius: 0 0 6px 6px;
  z-index: 1;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shl);
  border-color: var(--ac);
}

.card:hover::before {
  opacity: 1;
}

/* Premium "NEW" Style */
.card.is-new {
  border-color: var(--ac);
  box-shadow: 0 0 20px var(--glow), var(--sh);
  animation: slideUp .5s cubic-bezier(.22, 1, .36, 1) both, cardGlowPulse 4s infinite ease-in-out;
  min-height: 260px;
  /* Assure un look premium même sans image */
}

.card:not(.folder-card) .card-title-row {
  margin-top: auto;
}

.folder-card {
  justify-content: flex-start;
  align-items: stretch;
  text-align: left;
  min-height: 180px;
}

.folder-card .fp-info {
  margin-top: 0;
  display: flex;
  flex-direction: column;
}

.folder-card .fp-title {
  order: -1;
  /* Titre en haut */
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--ac);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-card .fp-icon {
  position: absolute;
  bottom: 12px;
  right: 28px;
  /* Décalé vers la gauche pour éviter le débordement */
  opacity: 0.12;
  transform: scale(2.2);
  pointer-events: none;
  transition: all .5s;
}

.folder-card:hover .fp-icon {
  opacity: 0.25;
  transform: scale(2.5) rotate(-5deg);
}

.folder-card.has-cover .fp-title {
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.folder-card.has-cover .fp-info {
  margin-top: auto;
}

.fp-meta {
  font-size: 0.72rem;
  color: var(--tx3);
  font-weight: 500;
}

.card.folder-card.has-cover .fp-meta {
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}


.card.is-new::before {
  height: 4px;
  opacity: 1;
  background: linear-gradient(90deg, var(--ac), var(--ac2), var(--ac));
  background-size: 200% 100%;
  animation: shimmerBg 3s linear infinite;
}



@keyframes cardGlowPulse {

  0%,
  100% {
    box-shadow: 0 0 15px var(--glow), var(--sh);
  }

  50% {
    box-shadow: 0 0 30px var(--glow), var(--shl);
  }
}

@keyframes shimmerBg {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@keyframes scalePop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}






.drag-over {
  border-color: var(--ac) !important;
  background: rgba(139, 92, 246, .05) !important;
  transform: scale(1.02) !important;
}

/* ===== SORTING MODE (Organization) ===== */
.sorting-mode {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.sorting-mode .card {
  padding: 10px;
  min-height: auto;
  border-radius: 10px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 6px;
  box-shadow: none;
  border: 1px solid var(--bds);
  background: var(--bg2);
}

.sorting-mode .card:active {
  cursor: grabbing;
  transform: scale(0.95);
  border-color: var(--ac);
}

.sorting-mode .card .card-cover,
.sorting-mode .card .cb,
.sorting-mode .card .card-meta,
.sorting-mode .card .card-acts,
.sorting-mode .card.folder-card::before,
.sorting-mode .card::after,
.sorting-mode .card::before,
.sorting-mode .card .badge {
  display: none !important;
}

.sorting-mode .card h3,
.sorting-mode .card .fp-title {
  font-size: .75rem;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
}

.sorting-mode .card .card-title-row {
  margin: 0;
  justify-content: center;
}

.sorting-mode .card .fp-icon,
.sorting-mode .card .iti {
  width: 28px;
  height: 28px;
  margin: 0;
}

.sorting-mode .card .fp-icon i,
.sorting-mode .card .iti i {
  width: 14px;
  height: 14px;
}

.sorting-mode .card.folder-card {
  flex-direction: column;
  padding: 10px;
  gap: 6px;
}

.sorting-mode .card.folder-card .fp-info {
  gap: 0;
  align-items: center;
}

.sorting-mode .card.folder-card .fp-meta {
  font-size: .6rem;
  margin-top: 2px;
}

.sorting-placeholder {
  border: 2px dashed var(--ac);
  background: var(--acg);
  border-radius: 10px;
  min-height: 80px;
}

.card-cover {
  margin: -16px -18px 12px;
  height: 140px;
  overflow: hidden;
  border-radius: 14px 14px 0 0;
  /* Important since card has overflow:visible */
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s ease;
}

.card:hover .card-cover img {
  transform: scale(1.08);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  gap: 3px;
  font-size: .55rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(var(--badge-rgb, 139, 92, 246), .08);
  color: var(--badge-color, var(--ac));
  border: 1px solid rgba(var(--badge-rgb, 139, 92, 246), .15);
  transition: all .6s;
  flex-shrink: 0;
}

.badge-article {
  --badge-color: #a3b8ff;
  --badge-rgb: 163, 184, 255;
}

.badge-info {
  --badge-color: #f7e6b5;
  --badge-rgb: 247, 230, 181;
}

.badge-link {
  --badge-color: #abd9c8;
  --badge-rgb: 171, 217, 200;
}

.badge-folder {
  --badge-color: var(--ac);
  --badge-rgb: 139, 92, 246;
}

/* NEW badge must follow .badge to override background correctly */
.badge-new {
  position: absolute;
  top: -10px;
  left: -10px;
  background: var(--ac2) !important;
  color: #fff !important;
  font-weight: 800;
  padding: 4px 10px !important;
  border-radius: 8px 4px 8px 4px;
  box-shadow: 0 4px 12px var(--glow), 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem !important;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  transition: all 0.3s ease;
  opacity: 1 !important;
  transform: none;
  /* Reset accidental rotations */
}

.card:hover .badge-new {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--glow), 0 4px 8px rgba(0, 0, 0, 0.3);
}

.badge i {
  width: 9px;
  height: 9px;
}

.card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
  transition: color .3s, transform .3s;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card:hover h3 {
  color: var(--ac);
  transform: translateX(2px);
}

.card .cb {
  color: var(--tx2);
  font-size: .76rem;
  line-height: 1.5;
  max-height: 48px;
  overflow: hidden;
}

/* Version spécifique pour les cartes Info */
.card[class*="info-"] {
  min-height: 180px;
  /* Plus d'espace pour l'info */
}

.card[class*="info-"] .cb {
  font-size: 0.95rem;
  color: var(--tx);
  max-height: none;
  margin: auto 0;
  font-weight: 500;
  line-height: 1.4;
}

.card-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}

.cd {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: .66rem;
  color: var(--tx3);
  font-weight: 500;
}

.cd i {
  width: 11px;
  height: 11px;
}

.card-tags {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.ct {
  font-size: .62rem;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bg2);
  color: var(--tx2);
  font-weight: 600;
  transition: background .6s;
}

.card-url {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  color: var(--ac);
  font-size: .74rem;
  text-decoration: none;
  font-weight: 600;
  transition: all .2s;
}

.card-url:hover {
  text-decoration: underline;
  gap: 7px;
}

.card-url i {
  width: 12px;
  height: 12px;
}

.card-read {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  color: var(--ac);
  font-size: .74rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  padding: 0;
  transition: all .25s;
}

.card-read:hover {
  gap: 8px;
  color: var(--ac2);
}

.card-read i {
  width: 12px;
  height: 12px;
  transition: transform .25s;
}

.card-read:hover i {
  transform: translateX(3px);
}

.card-acts {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--bds);
}

/* Info icons */
.iti {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .4s ease;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.iti i {
  width: 20px;
  height: 20px;
}

.info-note .iti {
  background: rgba(139, 92, 246, .12);
  color: var(--ac);
}

.info-tip .iti {
  background: rgba(52, 211, 153, .15);
  color: #10b981;
}

.info-warning .iti {
  background: rgba(245, 158, 11, .15);
  color: #f59e0b;
}

.info-research .iti {
  background: rgba(6, 182, 212, .15);
  color: #0891b2;
}

/* ===== MODALS ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bgm);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .2s ease;
}

.modal {
  background: var(--bgc-solid);
  border: 1px solid var(--bd);
  border-radius: 18px;
  padding: 28px;
  width: 100%;
  box-shadow: var(--shl), 0 0 60px var(--glow);
  animation: scaleIn .35s cubic-bezier(.22, 1, .36, 1);
  position: relative;
  transition: all .6s;
}

.modal-sm {
  max-width: 380px;
  text-align: center;
}

.modal-lg {
  max-width: 560px;
}

/* ===== MODAL FULLSCREEN (articles) ===== */
.modal-fullscreen {
  max-width: 100vw;
  max-height: 100vh;
  width: 100%;
  height: 100%;
  border-radius: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.overlay:has(.modal-fullscreen) {
  align-items: stretch;
  padding: 0;
}

.modal-fullscreen #editor-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-fullscreen #fields-article {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 24px;
  overflow: hidden;
}

.modal-fullscreen .article-sidebar {
  width: 280px;
  min-width: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-fullscreen .article-editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.modal-fullscreen .article-editor-pane .fg {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-fullscreen .article-editor-pane .toolbar {
  flex-shrink: 0;
}

.modal-fullscreen .editor {
  max-height: none;
  flex: 1;
  min-height: 200px;
}

.modal-fullscreen .editor-options {
  flex-shrink: 0;
}

.m-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--acg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.m-icon i {
  width: 24px;
  height: 24px;
}

.m-icon.glow {
  box-shadow: 0 4px 24px var(--glow);
  animation: glowPulse 3s ease-in-out infinite;
}

.m-icon-danger {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 4px 20px rgba(239, 68, 68, .3);
}

.m-icon-danger i {
  width: 24px;
  height: 24px;
}

.modal h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.m-sub {
  color: var(--tx2);
  margin-bottom: 14px;
  font-size: .82rem;
}

.m-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: var(--bg2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx2);
  transition: all .25s;
}

.m-close i {
  width: 16px;
  height: 16px;
}

.m-close:hover {
  background: var(--ac);
  color: #fff;
  transform: rotate(90deg);
}

.m-acts {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

/* Reader */
#reader-view {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 20px 60px;
  animation: slideUp .5s cubic-bezier(.22, 1, .36, 1);
}

.reader-back-wrap {
  margin-bottom: 24px;
}

.reader-hero {
  position: relative;
  height: 420px;
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: -60px;
  box-shadow: var(--shl);
  z-index: 2;
}

.reader-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s;
}

.reader-hero:hover img {
  transform: scale(1.05);
}

.reader-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(0, 0, 0, 0.8));
}

.reader-hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px;
  color: #fff;
  z-index: 3;
}

.reader-hero-content h2 {
  font-size: 2.4rem;
  font-weight: 900;
  margin: 0 0 12px;
  line-height: 1.1;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.reader-hero .badge-new {
  top: 24px;
  right: 24px;
  left: auto;
  padding: 8px 16px !important;
  font-size: 0.8rem !important;
  background: var(--ac2);

  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  z-index: 100;
  border-radius: 10px 4px 10px 4px;
}

.reader-new-wrap {
  position: relative;
}

.reader-new-wrap .badge-new {
  top: 32px;
  right: 32px;
  left: auto;
  padding: 8px 16px !important;
}

.reader-card {
  background: var(--bgc-solid);
  border: 1px solid var(--bd);
  border-radius: 24px;
  padding: 80px 48px 48px;
  box-shadow: var(--sh);
  z-index: 1;
  position: relative;
}

.reader-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--bd);
  gap: 16px;
  flex-wrap: wrap;
}

.reader-body {
  font-size: 1.12rem;
  line-height: 1.8;
  color: var(--tx);
}

.reader-body img {
  max-width: 100%;
  border-radius: 16px;
  margin: 24px 0;
  box-shadow: var(--sh);
}

.reader-body a {
  color: var(--ac);
  font-weight: 600;
  text-decoration: underline;
}

.reader-body h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 40px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--bd);
}

.reader-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 24px 0 12px;
}

.reader-body blockquote {
  border-left: 4px solid var(--ac);
  padding: 16px 24px;
  margin: 24px 0;
  background: var(--bg2);
  border-radius: 0 12px 12px 0;
  font-style: italic;
  font-size: 1.1rem;
}

/* Reader responsive handled in main 768px/480px media queries */

/* ===== FORMS ===== */
.fg {
  margin-bottom: 12px;
  text-align: left;
}

.fg label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--tx2);
}

.li {
  width: 13px;
  height: 13px;
}

.fg input:not([type="checkbox"]),
.fg textarea,
.fg select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--bd);
  background: var(--bg);
  color: var(--tx);
  font-family: inherit;
  font-size: .82rem;
  transition: all .3s;
  outline: none;
  resize: vertical;
}

.fg input:not([type="checkbox"]):focus,
.fg textarea:focus,
.fg select:focus {
  border-color: var(--ac);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .1), 0 0 16px var(--glow);
}

.fg input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--ac);
  cursor: pointer;
  margin: 0;
}

#folder-items-selector label:hover {
  background: var(--bg2);
}

.err {
  color: #ef4444;
  font-size: .72rem;
  margin-top: 3px;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  background: var(--bg2);
  border: 1.5px solid var(--bd);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  flex-wrap: wrap;
  transition: all .6s;
}

.tb {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx2);
  position: relative;
}

.tb:hover {
  background: var(--acg);
  color: #fff;
}

.tb i {
  width: 14px;
  height: 14px;
}

.tb-color-wrap {
  overflow: hidden;
}

.tb-color {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  inset: 0;
}

.tb-size {
  width: auto;
  min-width: 80px;
  background: transparent;
  border: none;
  color: var(--tx2);
  font-size: .8rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  height: 34px;
}

.tb-size:hover {
  background: var(--bg2);
  color: var(--ac);
}

.sep {
  width: 1px;
  height: 18px;
  background: var(--bd);
  margin: 0 3px;
}

.editor {
  min-height: 160px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  border: 1.5px solid var(--bd);
  border-radius: 0 0 10px 10px;
  background: var(--bg);
  color: var(--tx);
  font-family: inherit;
  font-size: .84rem;
  line-height: 1.65;
  outline: none;
  transition: border-color .3s;
}

.editor:focus {
  border-color: var(--ac);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .1);
}

.editor:empty::before {
  content: attr(data-placeholder);
  color: var(--tx3);
  pointer-events: none;
}

.editor img {
  max-width: 100%;
  border-radius: 6px;
  margin: 6px 0;
}

.editor a {
  color: var(--ac);
  text-decoration: underline;
}

.editor h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 8px 0 4px;
}

.editor h3 {
  font-size: .95rem;
  font-weight: 600;
  margin: 6px 0 3px;
}

.editor ul,
.editor ol {
  padding-left: 18px;
  margin: 4px 0;
}

.editor blockquote {
  border-left: 3px solid var(--ac);
  padding: 6px 10px;
  margin: 6px 0;
  background: rgba(139, 92, 246, .05);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

/* ===== FOOTER ===== */
.footer {
  border-top: 1px solid var(--bd);
  margin-top: 32px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: .72rem;
  color: var(--tx3);
  transition: border-color .6s;
}

.fi {
  width: 13px;
  height: 13px;
}

/* ===== RESPONSIVE — TABLET (max 1024px) ===== */
@media(max-width:1024px) {
  .hw {
    padding: 10px 18px;
  }

  .searchbar input {
    width: 120px;
  }

  .hero {
    margin: 16px 16px 0;
    padding: 24px;
    gap: 20px;
  }

  .hero-text h2 {
    font-size: 1.35rem;
  }

  .counter-ring {
    width: 50px;
    height: 50px;
  }

  .counter-ring span {
    font-size: 1.05rem;
  }

  .sec {
    padding: 0 16px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
  }

  .admin-bar {
    padding: 0 16px;
  }
}

/* ===== RESPONSIVE — SMALL TABLET / LARGE PHONE (max 768px) ===== */
@media(max-width:768px) {
  .hw {
    padding: 10px 16px;
    gap: 8px;
  }

  .searchbar {
    display: none;
  }

  .logo-name {
    font-size: .95rem;
  }

  .hbtn {
    width: 34px;
    height: 34px;
  }

  #auth-btn-text {
    display: none;
  }

  .hero {
    margin: 12px 14px 0;
    padding: 24px 20px;
    flex-direction: column;
    text-align: center;
    gap: 18px;
  }

  .hero-text h2 {
    font-size: 1.3rem;
  }

  .hero p {
    margin: 0 auto;
    font-size: .85rem;
    max-width: 100%;
  }

  .hero-chip {
    font-size: .65rem;
    padding: 4px 12px;
  }

  .hero-glow {
    width: 150px;
    height: 150px;
    right: 50%;
    top: 50%;
    transform: translate(50%, -50%);
  }

  .hero-counters {
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .counter-ring {
    width: 48px;
    height: 48px;
  }

  .counter-ring span {
    font-size: 1.05rem;
  }

  .counter-label {
    font-size: .6rem;
  }

  .admin-bar {
    padding: 0 14px;
    gap: 6px;
    margin-top: 14px;
    flex-wrap: wrap;
  }

  .admin-bar .btn-outline span {
    display: none;
  }

  .btn-pill {
    padding: 6px 14px;
    font-size: .72rem;
  }

  .tabs {
    margin: 14px 14px 0;
    padding: 4px;
    gap: 4px;
    overflow-x: auto;
    white-space: nowrap;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    padding: 6px 14px;
    font-size: .75rem;
    gap: 4px;
    flex-shrink: 0;
  }

  .tab i {
    width: 13px;
    height: 13px;
  }

  .sec {
    padding: 0 14px;
    margin-top: 14px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
  }

  .card {
    padding: 16px;
  }

  .card h3 {
    font-size: 1rem;
  }

  .card .cb {
    font-size: .76rem;
  }

  .card-acts {
    flex-wrap: wrap;
  }

  .card-acts .btn {
    min-height: 36px;
  }

  .reader-hero {
    height: 260px;
    border-radius: 16px;
    margin-bottom: -30px;
  }

  .reader-hero-content {
    padding: 20px;
  }

  .reader-hero-content h2 {
    font-size: 1.4rem;
  }

  .reader-card {
    padding: 50px 20px 28px;
    border-radius: 16px;
  }

  .reader-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 14px;
  }

  .reader-body {
    font-size: .95rem;
    line-height: 1.7;
  }

  .reader-body h2 {
    font-size: 1.3rem;
    margin: 28px 0 12px;
    padding-top: 16px;
  }

  .reader-body h3 {
    font-size: 1.1rem;
    margin: 20px 0 10px;
  }

  .reader-body blockquote {
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 1rem;
  }

  .modal {
    padding: 24px;
    border-radius: 16px;
    margin: 12px;
  }

  .overlay {
    align-items: flex-end;
  }

  .modal-lg {
    max-width: 100vw;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    margin: 0;
  }

  .modal-fullscreen {
    max-height: 100vh;
    border-radius: 0;
    overflow: hidden;
  }

  .modal-fullscreen #fields-article {
    flex-direction: column;
  }

  .modal-fullscreen .article-sidebar {
    width: 100%;
    min-width: 0;
    overflow-y: visible;
  }

  .modal-fullscreen .editor {
    max-height: none;
    flex: 1;
  }

  .modal-reader {
    max-width: 92vw;
    max-height: 85vh;
  }

  .toolbar {
    flex-wrap: wrap;
    gap: 2px;
  }

  .palette {
    right: 16px;
    top: 54px;
  }

  .btn-top {
    bottom: 24px;
    right: 16px;
  }

  .footer {
    padding: 16px;
  }

  .blob {
    opacity: .2;
  }

  [data-theme="dark"] .blob {
    opacity: .08;
  }
}

/* ===== RESPONSIVE — PHONE (max 480px) ===== */
@media(max-width:480px) {
  .hw {
    padding: 10px 12px;
    gap: 6px;
  }

  .logo {
    gap: 6px;
  }

  .logo-gem {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .logo-gem i {
    width: 16px;
    height: 16px;
  }

  .logo-name {
    font-size: .85rem;
  }

  .hactions {
    gap: 4px;
  }

  .hbtn {
    width: 32px;
    height: 32px;
  }

  .hbtn i {
    width: 14px;
    height: 14px;
  }

  .btn-outline {
    padding: 5px 10px;
    font-size: .7rem;
    border-radius: 8px;
  }

  .bi {
    width: 13px;
    height: 13px;
  }

  .hero {
    margin: 10px 10px 0;
    padding: 20px 16px;
    gap: 16px;
    border-radius: 14px;
  }

  .hero-text h2 {
    font-size: 1.2rem;
  }

  .hero p {
    font-size: .8rem;
  }

  .hero-chip {
    font-size: .6rem;
    padding: 3px 10px;
    margin-bottom: 8px;
  }

  .hero-counters {
    gap: 10px;
    flex-wrap: wrap;
  }

  .counter-ring {
    width: 44px;
    height: 44px;
    border-width: 1.5px;
  }

  .counter-ring span {
    font-size: .95rem;
  }

  .counter-label {
    font-size: .55rem;
  }

  .admin-bar {
    padding: 0 10px;
    gap: 5px;
    margin-top: 12px;
  }

  .btn-pill {
    padding: 5px 10px;
    font-size: .68rem;
    flex: 0 1 auto;
  }

  .btn-pill .bi {
    display: none;
  }

  .tabs {
    margin: 12px 10px 0;
    padding: 3px;
    max-width: calc(100vw - 20px);
  }

  .tab {
    padding: 6px 10px;
    font-size: .7rem;
    flex-shrink: 0;
  }

  .tab span {
    display: none;
  }

  .sec {
    padding: 0 10px;
    margin-top: 12px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .card {
    padding: 14px;
    border-radius: 12px;
  }

  .card-cover {
    margin: -14px -14px 10px;
    height: 120px;
  }

  .card h3 {
    font-size: .95rem;
  }

  .card .cb {
    font-size: .74rem;
    max-height: 45px;
  }

  .card-title-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .badge {
    font-size: .6rem;
  }

  .ct {
    font-size: .6rem;
    padding: 2px 6px;
  }

  .reader-hero {
    height: 200px;
    border-radius: 12px;
    margin-bottom: -20px;
  }

  .reader-hero-content {
    padding: 16px;
  }

  .reader-hero-content h2 {
    font-size: 1.15rem;
    margin: 0 0 6px;
  }

  .reader-card {
    padding: 36px 16px 24px;
    border-radius: 14px;
  }

  .reader-head h2 {
    font-size: 1.15rem;
  }

  .reader-meta {
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
  }

  .reader-body {
    font-size: .88rem;
    line-height: 1.7;
  }

  .reader-body h2 {
    font-size: 1.15rem;
    margin: 24px 0 10px;
    padding-top: 14px;
  }

  .reader-body h3 {
    font-size: 1rem;
    margin: 16px 0 8px;
  }

  .reader-body blockquote {
    padding: 10px 14px;
    margin: 14px 0;
    font-size: .9rem;
  }

  .reader-body img {
    border-radius: 10px;
    margin: 16px 0;
  }

  .reader-back-wrap {
    margin-bottom: 14px;
  }

  .overlay {
    align-items: flex-end;
  }

  .modal {
    padding: 20px;
    border-radius: 14px;
    margin: 0;
  }

  .modal-sm {
    max-width: 100vw;
    border-radius: 14px 14px 0 0;
  }

  .modal-lg {
    max-width: 100vw;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 14px 14px 0 0;
  }

  .modal-fullscreen {
    max-height: 100vh;
    border-radius: 0;
    overflow: hidden;
  }

  .modal-fullscreen #fields-article {
    flex-direction: column;
  }

  .modal-fullscreen .article-sidebar {
    width: 100%;
    min-width: 0;
    overflow-y: visible;
  }

  .modal-fullscreen .editor {
    max-height: none;
    flex: 1;
    min-height: 120px;
  }

  .modal-reader {
    max-width: 100vw;
    max-height: 85vh;
    padding: 20px;
  }

  .m-icon,
  .m-icon-danger {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }

  .modal h2 {
    font-size: 1.1rem;
  }

  .m-sub {
    font-size: .8rem;
    margin-bottom: 12px;
  }

  .m-close {
    width: 28px;
    height: 28px;
    top: 10px;
    right: 10px;
  }

  .fg {
    margin-bottom: 10px;
  }

  .fg input,
  .fg textarea,
  .fg select {
    padding: 8px 10px;
    font-size: .8rem;
    border-radius: 8px;
  }

  .toolbar {
    padding: 4px;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
    gap: 2px;
  }

  .tb {
    width: 26px;
    height: 26px;
  }

  .tb-size {
    height: 26px;
    min-width: 70px;
    font-size: .72rem;
  }

  .editor {
    min-height: 120px;
    max-height: 200px;
    padding: 10px;
    font-size: .8rem;
    border-radius: 0 0 8px 8px;
  }

  .editor-options {
    flex-direction: row;
    gap: 10px;
  }

  .image-upload-zone {
    min-height: 80px;
  }

  .palette {
    right: 10px;
    top: 50px;
    padding: 12px 14px;
    border-radius: 12px;
  }

  .pal-dots {
    gap: 6px;
  }

  .dot {
    width: 28px;
    height: 28px;
  }

  .btn-top {
    bottom: 20px;
    right: 12px;
    width: 36px;
    height: 36px;
  }

  .btn-top i {
    width: 16px;
    height: 16px;
  }

  /* Folder view */
  #content-folder > div:first-child {
    flex-wrap: wrap;
    gap: 8px;
  }

  #folder-view-title {
    font-size: 1.1rem !important;
  }

  .footer {
    padding: 16px 12px;
    margin-top: 24px;
  }

  .blob {
    display: none;
  }

  /* Users modal */
  .user-create-form > div {
    flex-direction: column;
    align-items: stretch;
  }

  .user-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ===== MINIMAL PHONE (max 360px - e.g iPhone SE) ===== */
@media(max-width:360px) {
  .logo-name strong {
    display: none;
  }

  .hactions {
    gap: 2px;
  }

  .hbtn {
    width: 28px;
    height: 28px;
  }

  .hbtn i {
    width: 13px;
    height: 13px;
  }

  .btn-outline {
    padding: 4px 8px;
    font-size: .65rem;
  }

  .bi {
    display: none;
  }

  #auth-icon {
    display: inline-block;
  }

  .admin-bar {
    gap: 4px;
  }

  .admin-bar .bi {
    display: inline-block;
  }

  .btn-pill {
    padding: 5px 8px;
    font-size: .65rem;
  }

  .tab {
    padding: 5px 8px;
    font-size: .65rem;
  }

  .hero {
    padding: 16px 12px;
    margin: 8px 8px 0;
  }

  .hero-text h2 {
    font-size: 1.05rem;
  }

  .reader-hero {
    height: 160px;
  }

  .reader-hero-content h2 {
    font-size: 1rem;
  }

  .reader-card {
    padding: 30px 12px 20px;
  }
}

/* ===== HOVER DISABLED ON TOUCH ===== */
@media(hover:none) {
  .card:hover {
    transform: none;
    box-shadow: var(--sh);
  }

  .card::after {
    display: none;
  }

  .btn:hover {
    transform: none;
  }

  .hbtn:hover {
    transform: none;
    box-shadow: none;
  }

  .counter-ring:hover {
    transform: none;
  }

  .dot:hover {
    transform: none;
  }
}

/* Reading Progress Bar */
.progress-bar {
  position: fixed;
  top: 60px;
  /* Just below header */
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--ac);
  box-shadow: 0 0 10px var(--glow);
  z-index: 150;
  transition: width 0.1s ease-out, opacity 0.3s;
  pointer-events: none;
  opacity: 0;
}

.progress-active {
  opacity: 1;
}

/* Back to top button for reader */
.btn-top {
  position: fixed;
  bottom: 80px; /* Bas à droite */
  right: 32px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bgc-solid);
  color: var(--ac);
  border: 1.5px solid var(--ac);
  box-shadow: 0 4px 12px var(--glow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all 0.4s cubic-bezier(.22, 1, .36, 1);
  opacity: 0;
  transform: translateY(20px) scale(0.8);
  pointer-events: none;
}

.btn-top.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.btn-top:hover {
  background: var(--ac);
  color: #fff;
  transform: scale(1.1);
}

.btn-top i {
  width: 20px;
  height: 20px;
}

/* ===== MODERATION BADGES ===== */
.badge-pending {
  --badge-color: #f59e0b;
  --badge-rgb: 245, 158, 11;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

.badge-rejected {
  --badge-color: #ef4444;
  --badge-rgb: 239, 68, 68;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

/* ===== MODERATION TAB BADGE ===== */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  margin-left: 4px;
}

/* ===== MODERATION ITEMS ===== */
.mod-item {
  position: relative;
}

.mod-actions {
  display: flex;
  gap: 6px;
  padding: 8px 0 0;
  justify-content: center;
}

/* ===== USERS MANAGEMENT ===== */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg2);
  border-radius: 10px;
  border: 1px solid var(--bd);
  transition: all .2s;
}

.user-row:hover {
  border-color: var(--ac);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-info strong {
  font-size: .85rem;
}

.user-acts {
  display: flex;
  gap: 4px;
}

.badge-admin { --badge-color: #8b5cf6; --badge-rgb: 139, 92, 246; }
.badge-moderator { --badge-color: #3b82f6; --badge-rgb: 59, 130, 246; }
.badge-user { --badge-color: #10b981; --badge-rgb: 16, 185, 129; }
.badge-reader { --badge-color: #6b7280; --badge-rgb: 107, 114, 128; }
.badge-active { --badge-color: #10b981; --badge-rgb: 16, 185, 129; }
.badge-deactivated { --badge-color: #ef4444; --badge-rgb: 239, 68, 68; }

.user-create-form {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--bd);
}

.user-create-form .fg {
  margin-bottom: 0;
}

/* ===== UTILITY CLASSES ===== */
.icon-sm {
  width: 13px;
  height: 13px;
}

.icon-md {
  width: 14px;
  height: 14px;
}

.editor-options {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--bd);
}

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.checkbox-wrap input[type="checkbox"] {
  width: 17px;
  height: 17px;
  cursor: pointer;
}

/* ===== FOCUS STATES ===== */
.btn:focus-visible,
.tab:focus-visible,
.hbtn:focus-visible,
.tb:focus-visible:not(.tb-size),
.dot:focus-visible {
  outline: 2px solid var(--ac);
  outline-offset: 2px;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
