@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #eef1f8;
  --surface: #ffffff;
  --ink: #1a1c2e;
  --muted: #6b7280;
  --purple: #6d5efc;
  --purple-2: #a855f7;
  --brand-grad: linear-gradient(135deg, #6d5efc 0%, #a855f7 55%, #ec4899 100%);
  --brand-grad-soft: linear-gradient(135deg, #eef0ff 0%, #f6edff 100%);
  --ring: rgba(109, 94, 252, .35);
  --shadow-sm: 0 2px 8px rgba(23, 25, 55, .06);
  --shadow-md: 0 10px 30px rgba(23, 25, 55, .10);
  --shadow-lg: 0 20px 50px rgba(23, 25, 55, .16);
  --radius: 16px;
}

* { -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(168, 85, 247, .12), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(109, 94, 252, .12), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, .navbar-brand { font-family: 'Sora', sans-serif; letter-spacing: -.01em; }

/* ============ ANIMATIONS ============ */
@keyframes fadeUp    { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn     { 0% { opacity: 0; transform: scale(.9); } 60% { transform: scale(1.02); } 100% { opacity: 1; transform: scale(1); } }
@keyframes floaty    { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shimmer   { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes gradientMove { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }

main > * { animation: fadeUp .5s both; }

/* Entrées en cascade pour les grilles */
.row.g-3 > [class^="col"], .row.g-4 > [class^="col"], .vstack > * { animation: fadeUp .5s both; }
.row.g-3 > [class^="col"]:nth-child(1), .vstack > *:nth-child(1) { animation-delay: .04s; }
.row.g-3 > [class^="col"]:nth-child(2), .vstack > *:nth-child(2) { animation-delay: .10s; }
.row.g-3 > [class^="col"]:nth-child(3), .vstack > *:nth-child(3) { animation-delay: .16s; }
.row.g-3 > [class^="col"]:nth-child(4), .vstack > *:nth-child(4) { animation-delay: .22s; }
.row.g-3 > [class^="col"]:nth-child(5), .vstack > *:nth-child(5) { animation-delay: .28s; }
.row.g-3 > [class^="col"]:nth-child(6), .vstack > *:nth-child(6) { animation-delay: .34s; }

@media (prefers-reduced-motion: reduce) {
  *, main > *, .row > [class^="col"] { animation: none !important; transition: none !important; }
}

/* ============ NAVBAR ============ */
.app-navbar {
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(23, 25, 55, .06);
  box-shadow: 0 4px 24px rgba(23, 25, 55, .05);
}
.navbar-brand {
  font-weight: 800;
  background: var(--brand-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.navbar-brand .bi { -webkit-text-fill-color: initial; color: var(--purple); }
.app-navbar .nav-link {
  position: relative; font-weight: 500; color: var(--muted); margin: 0 2px;
  border-radius: 10px; padding: .45rem .8rem !important; transition: color .2s, background .2s;
}
.app-navbar .nav-link:hover { color: var(--ink); background: rgba(109, 94, 252, .08); }
.app-navbar .nav-link::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px;
  background: var(--brand-grad); border-radius: 2px; transform: scaleX(0);
  transform-origin: left; transition: transform .25s ease;
}
.app-navbar .nav-link:hover::after { transform: scaleX(1); }

/* ============ AUTH ============ */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  position: relative; overflow: hidden;
}
.auth-wrapper::before, .auth-wrapper::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(60px); z-index: 0;
  animation: floaty 8s ease-in-out infinite;
}
.auth-wrapper::before { width: 340px; height: 340px; background: rgba(109, 94, 252, .35); top: -60px; left: -60px; }
.auth-wrapper::after  { width: 300px; height: 300px; background: rgba(236, 72, 153, .30); bottom: -60px; right: -40px; animation-delay: 2s; }
.auth-card {
  width: 100%; max-width: 440px; border: none; border-radius: 22px; position: relative; z-index: 1;
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg); animation: popIn .5s both;
}

/* ============ LOGIN ÉCRAN SCINDÉ ============ */
.login-split { display: flex; min-height: 100vh; }
.login-left, .login-right { flex: 1 1 50%; }

.login-left {
  position: relative; overflow: hidden; color: #fff;
  background: var(--brand-grad); background-size: 200% 200%;
  animation: gradientMove 12s linear infinite alternate;
  display: flex; align-items: center;
}
.login-left::before, .login-left::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .12); filter: blur(10px);
  animation: floaty 9s ease-in-out infinite;
}
.login-left::before { width: 320px; height: 320px; top: -80px; right: -60px; }
.login-left::after  { width: 240px; height: 240px; bottom: -70px; left: -50px; animation-delay: 2.5s; }
.login-left-inner { position: relative; z-index: 1; padding: 56px clamp(32px, 6vw, 80px); max-width: 620px; margin: 0 auto; }

.login-brand { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 1.6rem; margin-bottom: 40px; letter-spacing: -.02em; }
.login-headline { font-family: 'Sora', sans-serif; font-weight: 800; font-size: clamp(1.9rem, 3.5vw, 2.8rem); line-height: 1.12; margin-bottom: 16px; }
.login-sub { font-size: 1.05rem; opacity: .92; margin-bottom: 34px; max-width: 460px; }

.login-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 18px; }
.login-features li { display: flex; align-items: flex-start; gap: 14px; animation: fadeUp .6s both; }
.login-features li:nth-child(1) { animation-delay: .05s; }
.login-features li:nth-child(2) { animation-delay: .12s; }
.login-features li:nth-child(3) { animation-delay: .19s; }
.login-features li:nth-child(4) { animation-delay: .26s; }
.login-features li:nth-child(5) { animation-delay: .33s; }
.login-features li > i {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px;
  background: rgba(255, 255, 255, .18); display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.login-features li div { display: flex; flex-direction: column; }
.login-features li strong { font-weight: 700; }
.login-features li span { font-size: .88rem; opacity: .85; }
.login-foot { margin-top: 44px; font-size: .8rem; opacity: .75; }

.login-right { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--surface); }
.login-form-wrap { width: 100%; max-width: 400px; animation: fadeUp .5s both; }
.login-brand-mobile { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 1.4rem; margin-bottom: 24px; }
.login-right .input-group-text { background: transparent; border-right: 0; color: var(--muted); }
.login-right .input-group .form-control { border-left: 0; }
.login-right .input-group .form-control:focus { box-shadow: none; border-color: rgba(23,25,55,.12); }
.login-right .input-group:focus-within { box-shadow: 0 0 0 .2rem var(--ring); border-radius: 11px; }

@media (max-width: 991px) {
  .login-left { display: none; }
  .login-right { flex-basis: 100%; }
}

/* ============ BOUTONS ============ */
.btn { border-radius: 12px; font-weight: 600; transition: transform .15s ease, box-shadow .2s ease, filter .2s; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary {
  border: none; background: var(--brand-grad); background-size: 200% 200%;
  box-shadow: 0 8px 20px -6px var(--ring);
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 12px 26px -6px var(--ring); animation: gradientMove 3s linear infinite; }
.btn-outline-primary { border-color: var(--purple); color: var(--purple); }
.btn-outline-primary:hover { background: var(--purple); border-color: var(--purple); }
.btn-outline-secondary:hover { transform: translateY(-1px); }

/* ============ CARTES ============ */
.card { border-radius: var(--radius); }
.card.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.card-header { border-top-left-radius: var(--radius) !important; border-top-right-radius: var(--radius) !important; }

/* Avatars */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  color: #fff; font-weight: 700; flex-shrink: 0; line-height: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .15); border: 2px solid rgba(255, 255, 255, .7);
}

/* Cartes de stats */
.stat-card {
  border-radius: 18px; overflow: hidden; position: relative;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card::after {
  content: ""; position: absolute; inset: 0; background: var(--brand-grad); opacity: 0;
  transition: opacity .25s; pointer-events: none;
}
.stat-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md) !important; }
.stat-icon {
  width: 56px; height: 56px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; transition: transform .25s ease;
}
.stat-card:hover .stat-icon { transform: rotate(-8deg) scale(1.08); }
.bg-purple-subtle { background: #ece9ff; }
.stat-card .h3 { font-family: 'Sora', sans-serif; font-weight: 800; }

/* Projet */
.project-card {
  transition: transform .2s ease, box-shadow .2s ease; overflow: hidden; position: relative;
}
.project-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--brand-grad); transform: scaleX(0); transform-origin: left; transition: transform .3s ease;
}
.project-card:hover::before { transform: scaleX(1); }
.project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md) !important; }
.project-key {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-grad); color: #fff; font-family: 'Sora', sans-serif;
  font-weight: 700; letter-spacing: .5px; padding: 5px 11px; border-radius: 10px; font-size: .8rem;
  box-shadow: 0 6px 14px -4px var(--ring);
}

/* Utils */
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ticket-code { font-family: ui-monospace, 'SF Mono', monospace; font-size: .75rem; font-weight: 700; color: #8a8fa3; }

/* ============ KANBAN ============ */
.kanban-col {
  background: rgba(255, 255, 255, .55); backdrop-filter: blur(6px);
  border: 1px solid rgba(23, 25, 55, .05); border-radius: 16px; padding: 10px; height: 100%;
  transition: background .2s;
}
.kanban-head { padding: 6px 8px 12px; }
.kanban-body { min-height: 140px; transition: background .15s; border-radius: 12px; padding: 2px; }
.kanban-body.drag-over { background: rgba(109, 94, 252, .10); outline: 2px dashed var(--purple); outline-offset: -2px; }

.status-dot::before {
  content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 7px; vertical-align: middle; box-shadow: 0 0 0 3px rgba(0, 0, 0, .05);
}
.status-todo::before        { background: #97a0af; }
.status-in_progress::before { background: #6d5efc; }
.status-review::before      { background: #fb923c; }
.status-done::before        { background: #22c55e; }

.progress { border-radius: 20px; background: rgba(23, 25, 55, .06); overflow: hidden; }
.progress-bar { border-radius: 20px; transition: width .8s cubic-bezier(.22,1,.36,1); }
.progress-bar.status-todo        { background: #97a0af; }
.progress-bar.status-in_progress { background: linear-gradient(90deg,#6d5efc,#a855f7); }
.progress-bar.status-review      { background: linear-gradient(90deg,#fb923c,#f59e0b); }
.progress-bar.status-done        { background: linear-gradient(90deg,#22c55e,#10b981); }

.ticket-card {
  border: none; border-radius: 12px; cursor: grab; background: #fff;
  box-shadow: 0 2px 6px rgba(23, 25, 55, .08);
  transition: transform .15s ease, box-shadow .2s ease;
  animation: popIn .35s both;
}
.ticket-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.ticket-card:active { cursor: grabbing; }
.ticket-card.dragging { opacity: .4; transform: rotate(2deg) scale(1.02); }
.ticket-card .card-body { cursor: pointer; }

/* Badges */
.badge { font-weight: 600; border-radius: 8px; padding: .38em .6em; }

/* Epics / Stories */
.epic-chip {
  display: inline-block; color: #fff; font-size: .7rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; box-shadow: 0 4px 10px -3px rgba(0, 0, 0, .3);
}
.ticket-desc { white-space: pre-wrap; line-height: 1.7; }

/* Onglets */
.nav-tabs { border-bottom: 1px solid rgba(23, 25, 55, .08); gap: 4px; }
.nav-tabs .nav-link {
  border: none; color: var(--muted); font-weight: 600; border-radius: 10px 10px 0 0;
  padding: .6rem 1rem; transition: color .2s, background .2s;
}
.nav-tabs .nav-link:hover { color: var(--ink); background: rgba(109, 94, 252, .06); }
.nav-tabs .nav-link.active {
  color: var(--purple); background: transparent; position: relative;
}
.nav-tabs .nav-link.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px;
  background: var(--brand-grad); border-radius: 3px 3px 0 0; animation: fadeIn .3s;
}

/* Listes */
.list-group-item-action { transition: background .15s, transform .15s; }
.list-group-item-action:hover { background: rgba(109, 94, 252, .05); transform: translateX(3px); }

/* Modales */
.modal-content { border: none; border-radius: 20px; box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: rgba(23, 25, 55, .06); }

/* Champs */
.form-control, .form-select { border-radius: 11px; border-color: rgba(23, 25, 55, .12); transition: border-color .2s, box-shadow .2s; }
.form-control:focus, .form-select:focus { border-color: var(--purple); box-shadow: 0 0 0 .2rem var(--ring); }

/* Alertes flash */
.alert { border: none; border-radius: 14px; box-shadow: var(--shadow-sm); animation: fadeUp .4s both; }

/* ============ AGENDA / TIMELINE ============ */
.due-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 20px;
}
.sched-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(0,0,0,.04); }

.timeline { position: relative; padding-top: 22px; --label-w: 240px; }
/* Calque du repère "Aujourd'hui", aligné EXACTEMENT sur la zone des pistes */
.timeline-overlay {
  position: absolute; top: 22px; bottom: 0; left: var(--label-w); right: 0;
  pointer-events: none; z-index: 2;
}
.timeline-row { display: flex; align-items: center; padding: 5px 0; position: relative; }
.timeline-label {
  width: var(--label-w); flex-shrink: 0; font-size: .82rem; padding-right: 12px;
}
.timeline-track {
  position: relative; flex-grow: 1; height: 30px;
  background: repeating-linear-gradient(90deg, rgba(23,25,55,.04) 0 1px, transparent 1px 100%);
  background-size: calc(100% / 7) 100%;
  border-radius: 8px;
}
.timeline-bar {
  position: absolute; top: 4px; height: 22px; border-radius: 7px;
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 8px; color: #fff; font-size: .68rem; font-weight: 700;
  text-decoration: none; min-width: 26px; overflow: hidden;
  box-shadow: 0 3px 8px rgba(23,25,55,.18);
  transition: transform .15s ease, filter .15s ease;
}
.timeline-bar:hover { transform: translateY(-1px); filter: brightness(1.06); color: #fff; z-index: 3; }
.timeline-today {
  position: absolute; top: 0; bottom: 0; width: 2px; background: #ef4444;
}
.timeline-today span {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  background: #ef4444; color: #fff; font-size: .6rem; font-weight: 700;
  padding: 1px 6px; border-radius: 20px; white-space: nowrap;
}
@media (max-width: 767px) {
  .timeline { --label-w: 120px; }
  .timeline-label { font-size: .72rem; }
}

/* ============ NOTIFICATIONS ============ */
.nav-bell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px; color: var(--muted);
  transition: background .2s, color .2s;
}
.nav-bell:hover { background: rgba(109, 94, 252, .1); color: var(--purple); }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: #ef4444; color: #fff; font-size: .62rem; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  border: 2px solid #fff;
}
.notif-menu { width: 340px; max-height: 460px; overflow-y: auto; box-shadow: var(--shadow-lg); border: none; border-radius: 14px; }
.notif-menu .dropdown-item { white-space: normal; }
.notif-text { line-height: 1.3; }
.notif-unread { background: rgba(109, 94, 252, .06); }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--purple); flex-shrink: 0; margin-top: 6px; }
@media (max-width: 400px) { .notif-menu { width: 300px; } }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(109, 94, 252, .3); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(109, 94, 252, .5); background-clip: content-box; }
