/**
 * OCP Projets Manager — aesthetic layer
 * Charte: vert institutionnel OCP, présence, hiérarchie, motion sobre.
 */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&display=swap');

:root {
  --ocp-forest: #0d4f22;
  --ocp-deep: #146c2e;
  --ocp-leaf: #1e9e3e;
  --ocp-mint: #d8f5e3;
  --ocp-sand: #f4f7f2;
  --ocp-ink: #14201a;
  --ocp-muted: #5a6b60;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --border-soft: rgba(20, 108, 46, 0.1);
  --radius: 10px;
  --radius-lg: 16px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: 'Sora', 'DM Sans', sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

/* —— Atmosphere —— */
body {
  font-family: var(--font-body);
  color: var(--ocp-ink);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(30, 158, 62, 0.45), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(13, 79, 34, 0.55), transparent 50%),
    linear-gradient(165deg, #0a3d1a 0%, #146c2e 42%, #0f5224 100%);
  background-attachment: fixed;
  letter-spacing: 0.01em;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}

nav,
main,
.nav-backdrop,
#ocp-boot,
.toast,
.modal-overlay {
  position: relative;
  z-index: 1;
}

nav { z-index: 100; }
.modal-overlay { z-index: 1000; }
#ocp-boot { z-index: 99999; }

/* —— Navigation —— */
nav {
  background: rgba(8, 40, 18, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  padding: 6px 20px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.nav-brand {
  gap: 10px;
  margin-right: 14px;
  padding-right: 16px;
  border-right-color: rgba(255, 255, 255, 0.18);
}

.nav-brand img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

.nav-brand span {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.nav-btn {
  font-family: var(--font-body);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.78);
  transition: background 0.2s var(--ease-out), color 0.2s, transform 0.2s;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateY(-1px);
}

.nav-btn.active {
  background: linear-gradient(135deg, #22b34a, #178a34);
  color: #fff;
  box-shadow: 0 4px 14px rgba(30, 158, 62, 0.35);
}

#auth-bar {
  color: rgba(255, 255, 255, 0.88);
}

#auth-bar .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}

#auth-bar .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.nav-toggle {
  border-radius: 10px;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
}

/* —— Main shell —— */
main {
  max-width: 1240px;
  padding: 28px 22px 48px;
}

.page.active {
  animation: ocp-page-in 0.45s var(--ease-out);
}

@keyframes ocp-page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— Hero / dashboard banner —— */
.header-banner {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.08), transparent 40%),
    linear-gradient(135deg, #24b84d 0%, #1a8f38 45%, #0f5c26 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 30px 34px;
  margin-bottom: 26px;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.header-banner::before {
  content: 'OCP';
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(96px, 18vw, 180px);
  color: rgba(255, 255, 255, 0.06);
  letter-spacing: -0.06em;
  right: -8px;
  top: -36px;
}

.header-banner::after {
  content: '';
  position: absolute;
  inset: auto -20% -40% auto;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 65%);
  pointer-events: none;
}

.logo-circle {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.header-info h1 {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-info p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.88);
  margin-top: 4px;
}

.header-info small {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.85);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.avatar {
  background: linear-gradient(145deg, #2ec85a, #157a32);
  border-color: rgba(255, 255, 255, 0.5);
}

/* —— Page titles —— */
.page-header {
  margin-bottom: 22px;
  gap: 14px;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 3.2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f4fff7;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
}

/* —— Stats —— */
.stats-grid {
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: 0 10px 28px rgba(8, 40, 18, 0.12);
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--ocp-leaf);
  opacity: 0.85;
}

.stat-card.stat-blue::before { background: #3b82f6; }
.stat-card.stat-orange::before { background: #f97316; }
.stat-card.stat-purple::before { background: #7c6bc4; }
.stat-card.stat-teal::before { background: #0d9488; }

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(8, 40, 18, 0.16);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ocp-muted);
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ocp-ink);
}

.stat-sub {
  color: #7a8b80;
}

/* —— Cards —— */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 12px 32px rgba(8, 40, 18, 0.1);
  margin-bottom: 18px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ocp-ink);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(20, 108, 46, 0.08);
}

.card-title svg {
  color: var(--ocp-leaf);
}

/* —— Tables —— */
.table-wrap {
  border-radius: 12px;
  border: 1px solid rgba(20, 108, 46, 0.08);
  background: #fff;
}

th {
  background: #f3faf5;
  color: #4d6356;
  font-size: 11px;
  letter-spacing: 0.06em;
  border-bottom-color: rgba(20, 108, 46, 0.1);
}

td {
  border-bottom-color: rgba(20, 108, 46, 0.06);
}

tr:hover td {
  background: #f7fcf8;
}

/* —— Buttons —— */
.btn {
  border-radius: 10px;
  font-family: var(--font-body);
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s, background 0.18s, border-color 0.18s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, #24b84d, #178a34);
  box-shadow: 0 6px 16px rgba(30, 158, 62, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2ec85a, #146c2e);
  box-shadow: 0 8px 20px rgba(30, 158, 62, 0.34);
}

.btn-secondary {
  background: #fff;
  border: 1px solid rgba(20, 108, 46, 0.16);
  color: #254032;
}

.btn-secondary:hover {
  background: #f3faf5;
  border-color: rgba(30, 158, 62, 0.35);
}

.icon-btn {
  border-radius: 8px;
  color: #5f7267;
}

.icon-btn:hover {
  background: #eef8f1;
  color: var(--ocp-deep);
}

/* —— Filters / tabs —— */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 8px 24px rgba(8, 40, 18, 0.08);
  margin-bottom: 16px;
}

.filter-bar h3 {
  font-family: var(--font-display);
  color: var(--ocp-deep);
}

.filter-tab,
.sub-tab {
  border-radius: 10px !important;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.filter-tab:hover,
.sub-tab:hover {
  transform: translateY(-1px);
}

.filter-tab.active,
.sub-tab.active {
  background: linear-gradient(135deg, #24b84d, #178a34) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(30, 158, 62, 0.25);
}

/* —— Badges —— */
.badge {
  border-radius: 8px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

/* —— I4.0 summary strips —— */
.cal-i40-summary,
.eq-i40-summary,
.prj-i40-summary,
.equip-i40-summary,
.dash-i40-summary,
.rap-i40-summary,
.admin-i40-summary,
.sec-i40-summary {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 45%),
    linear-gradient(135deg, #0c2818, #153f26 55%, #0f2f1c) !important;
  border: 1px solid rgba(74, 222, 128, 0.18);
  border-radius: 16px !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.cal-i40-kpi strong {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

/* —— Equipe / event cards —— */
.equipe-card {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(8, 40, 18, 0.08);
  transition: transform 0.22s var(--ease-out), box-shadow 0.22s;
}

.equipe-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(8, 40, 18, 0.12);
}

.event-card,
.alert-card {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  transition: transform 0.2s var(--ease-out);
}

.event-card:hover,
.alert-card:hover {
  transform: translateY(-2px);
}

/* —— Modals —— */
.modal {
  border-radius: 18px;
  border: 1px solid rgba(20, 108, 46, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.modal-header {
  background: linear-gradient(180deg, #f7fcf8, #fff);
  border-bottom-color: rgba(20, 108, 46, 0.1);
}

.modal-header h3 {
  font-family: var(--font-display);
  color: var(--ocp-deep);
}

.modal-tab.active {
  color: var(--ocp-leaf);
  border-bottom-color: var(--ocp-leaf);
}

.form-control:focus {
  border-color: var(--ocp-leaf);
  box-shadow: 0 0 0 3px rgba(30, 158, 62, 0.14);
}

/* —— Admin —— */
.admin-card {
  border: 1px solid var(--border-soft);
  box-shadow: 0 10px 26px rgba(8, 40, 18, 0.08);
}

.admin-card h3 {
  font-family: var(--font-display);
  color: var(--ocp-deep);
  margin-bottom: 10px;
}

/* —— Toast —— */
.toast {
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.25);
}

/* —— Dashboard project blocks —— */
.dashboard-projet-block {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  margin-bottom: 12px;
  transition: box-shadow 0.22s, transform 0.22s var(--ease-out);
}

.dashboard-projet-block:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(8, 40, 18, 0.1);
}

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
  .page.active,
  .stat-card,
  .btn,
  .nav-btn,
  .equipe-card,
  .event-card,
  .alert-card,
  .dashboard-projet-block {
    animation: none !important;
    transition: none !important;
  }
}
