/* ============================================================
   DigiGP — Digi Gestion de Production — mydgp.fr
   Feuille de style principale v2.0
   ============================================================ */

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

:root {
  --primary:    #1b3d6e;
  --primary-l:  #2451a0;
  --primary-d:  #122a4e;
  --accent:     #f0820f;
  --success:    #22a06b;
  --danger:     #e5484d;
  --warn:       #f59e0b;
  --light:      #f1f5f9;
  --border:     #cbd5e1;
  --text:       #1e293b;
  --muted:      #64748b;
  --card-bg:    #ffffff;
  --nav-h:      64px;
  --sidebar-w:  220px;
  --radius:     12px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 12px 36px rgba(0,0,0,.15), 0 4px 8px rgba(0,0,0,.08);
}

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

body {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  background: var(--light);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--primary-l); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- NAVBAR ---- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: linear-gradient(135deg, var(--primary-d) 0%, var(--primary) 55%, var(--primary-l) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.28);
}
.nav-brand {
  display: flex; align-items: center; gap: 11px;
  font-size: 1.22rem; font-weight: 700; letter-spacing: .2px;
}
.brand-badge {
  background: var(--accent);
  width: 36px; height: 36px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 800; letter-spacing: 0; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(240,130,15,.45);
}
.nav-brand span { color: var(--accent); }
.nav-brand small { font-size: .63rem; font-weight: 400; opacity: .5; margin-left: 1px; }
.nav-user { display: flex; align-items: center; gap: 10px; font-size: .87rem; }
.nav-user > span { opacity: .85; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-block; padding: 8px 18px;
  border-radius: 7px; border: none; cursor: pointer;
  font-size: .88rem; font-weight: 600;
  transition: background .15s, transform .1s, box-shadow .15s;
  text-decoration: none; line-height: 1.4; letter-spacing: .1px;
  font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--primary-l); color: #fff; box-shadow: 0 2px 8px rgba(36,81,160,.28); }
.btn-primary:hover  { background: var(--primary); box-shadow: 0 4px 14px rgba(36,81,160,.38); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover   { background: #c0392b; }
.btn-warn     { background: var(--warn); color: #fff; }
.btn-warn:hover     { background: #d97706; }
.btn-outline  { background: transparent; border: 1.5px solid currentColor; color: inherit; }
.btn-outline:hover  { background: rgba(255,255,255,.12); }
.btn-full     { width: 100%; text-align: center; }
.btn-sm       { padding: 5px 12px; font-size: .82rem; border-radius: 6px; }

/* ---- UTILITIES ---- */
.hidden { display: none !important; }
.form-input {
  width: 100%; padding: 8px 11px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .88rem; background: #fff;
  color: var(--text); transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--primary-l); box-shadow: 0 0 0 3px rgba(36,81,160,.12); }

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 16px; font-size: .9rem;
}
.alert-error   { background: #fdecea; border: 1px solid #f5c6cb; color: #842029; }
.alert-success { background: #d1e7dd; border: 1px solid #a3cfbb; color: #0f5132; }
.alert-info    { background: #dbeafe; border: 1px solid #93c5fd; color: #1e40af; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .88rem; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: .95rem; transition: border-color .15s, box-shadow .15s;
  background: #fff; font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-l); outline: none;
  box-shadow: 0 0 0 3px rgba(36,81,160,.12);
}
.text-muted { color: var(--muted); font-size: .85rem; margin-bottom: 10px; }
.text-center { text-align: center; }

/* ---- AUTH PAGE ---- */
body.auth-page {
  background: linear-gradient(145deg, var(--primary-d) 0%, var(--primary) 45%, #1e5799 100%);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.auth-container { width: 100%; max-width: 420px; padding: 16px; }
.auth-logo { text-align: center; color: #fff; margin-bottom: 28px; }
.auth-brand-mark { margin-bottom: 16px; }
.auth-brand-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 68px; height: 68px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,.22) 0%, rgba(255,255,255,.08) 100%);
  border: 1.5px solid rgba(255,255,255,.28);
  font-size: 1.6rem; font-weight: 800; letter-spacing: -1px; color: #fff;
  position: relative;
}
.auth-brand-icon::after {
  content: ''; position: absolute; bottom: 0; left: 12px; right: 12px;
  height: 4px; background: var(--accent); border-radius: 2px;
  margin-bottom: 10px;
}
.auth-logo h1 { font-size: 2rem; font-weight: 800; letter-spacing: 1.5px; }
.auth-logo h1 span { color: var(--accent); }
.auth-logo h1 em { font-style: normal; font-size: .62em; font-weight: 400; opacity: .52; margin-left: 1px; }
.auth-logo p { opacity: .72; font-size: .9rem; letter-spacing: .3px; margin-top: 5px; }
.auth-card {
  background: var(--card-bg); border-radius: 16px;
  padding: 36px; box-shadow: var(--shadow-lg);
}
.auth-card h2 { margin-bottom: 22px; color: var(--primary); font-size: 1.25rem; font-weight: 700; }

/* ---- HOME ---- */
.home-main {
  padding-top: calc(var(--nav-h) + 48px);
  max-width: 980px; margin: 0 auto;
  padding-left: 20px; padding-right: 20px; padding-bottom: 80px;
}
.home-header { text-align: center; margin-bottom: 48px; }
.home-header-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(36,81,160,.08); color: var(--primary-l);
  border: 1px solid rgba(36,81,160,.18); border-radius: 20px;
  padding: 5px 16px; font-size: .75rem; font-weight: 700; letter-spacing: .7px;
  text-transform: uppercase; margin-bottom: 14px;
}
.home-header h1 { font-size: 2.2rem; font-weight: 800; color: var(--primary); letter-spacing: -.5px; }
.home-header p  { color: var(--muted); margin-top: 8px; font-size: .96rem; }

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
  gap: 20px;
}

.module-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 28px 26px; border-radius: 14px;
  color: #fff; text-decoration: none;
  background: var(--primary);        /* fallback si aucune classe couleur */
  transition: transform .2s, box-shadow .2s;
  box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}
.module-card::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 90px; height: 90px; border-radius: 50%;
  background: rgba(255,255,255,.07);
  transform: translate(28px,-28px); pointer-events: none;
}
.module-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}
.module-blue    { background: linear-gradient(135deg, #1a3a5c 0%, #2a5ea8 100%); }
.module-orange  { background: linear-gradient(135deg, #9b2335 0%, #e8691a 100%); }
.module-green   { background: linear-gradient(135deg, #145e36 0%, #22a06b 100%); }
.module-red     { background: linear-gradient(135deg, #5b2683 0%, #9b59b6 100%); }
.module-teal    { background: linear-gradient(135deg, #0d6659 0%, #17b89a 100%); }
.module-gold    { background: linear-gradient(135deg, #7d6608 0%, #d4ac0d 100%); }
.module-indigo  { background: linear-gradient(135deg, #9d155f 0%, #e91e8c 100%); }
/* Gestion de Projet */
.module-slate   { background: linear-gradient(135deg, #1e293b 0%, #475569 100%); }
.module-cyan    { background: linear-gradient(135deg, #0e4f6e 0%, #0891b2 100%); }
.module-violet  { background: linear-gradient(135deg, #3b1175 0%, #7c3aed 100%); }
.module-sky     { background: linear-gradient(135deg, #0c4a80 0%, #0284c7 100%); }
.module-emerald { background: linear-gradient(135deg, #064e3b 0%, #059669 100%); }
.module-amber   { background: linear-gradient(135deg, #78350f 0%, #d97706 100%); }
.module-rose    { background: linear-gradient(135deg, #881337 0%, #e11d48 100%); }
.module-fuchsia { background: linear-gradient(135deg, #701a75 0%, #c026d3 100%); }
.module-lime    { background: linear-gradient(135deg, #1a4d0a 0%, #65a30d 100%); }

.module-icon { font-size: 2.4rem; line-height: 1; }
.module-info h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: .3px; }
.module-info p  { opacity: .82; font-size: .88rem; margin-top: 5px; line-height: 1.4; }
.module-sections {
  display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap;
}
.module-sections span {
  background: rgba(255,255,255,.18); border-radius: 20px;
  padding: 4px 14px; font-size: .8rem; font-weight: 600;
}

/* ---- MODULE INNER PAGE ---- */
.module-page { padding-top: calc(var(--nav-h) + 32px); max-width: 900px; margin: 0 auto; padding-bottom: 60px; padding-left: 20px; padding-right: 20px; }
.module-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border);
  margin-bottom: 28px;
}
.module-tab {
  padding: 12px 28px; font-weight: 600; cursor: pointer;
  border-radius: 8px 8px 0 0; border: 2px solid transparent;
  transition: .15s; text-decoration: none; color: var(--muted); font-size: .9rem;
}
.module-tab.active, .module-tab:hover {
  background: var(--primary); color: #fff;
}
.tab-content { background: var(--card-bg); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-sm); }

/* ---- ADMIN LAYOUT ---- */
.admin-layout {
  display: flex;
  margin-top: var(--nav-h);
  min-height: calc(100vh - var(--nav-h));
}
.admin-sidebar {
  width: var(--sidebar-w); background: var(--primary);
  color: #fff; padding: 24px 0; flex-shrink: 0;
}
.admin-sidebar ul { list-style: none; }
.admin-sidebar li a {
  display: block; padding: 12px 24px;
  color: rgba(255,255,255,.75); font-size: .88rem; font-weight: 500;
  transition: .15s; letter-spacing: .1px;
}
.admin-sidebar li a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.admin-main { flex: 1; padding: 36px; }
.admin-main h1 { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-bottom: 24px; }
.admin-main h2 { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 16px; }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 8px;
}
.stat-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 22px;
  text-align: center; box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--accent);
}
.stat-number { font-size: 2.2rem; font-weight: 800; color: var(--primary); letter-spacing: -1px; }
.stat-label  { font-size: .8rem; color: var(--muted); margin-top: 4px; font-weight: 500; }

.card {
  background: var(--card-bg); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.admin-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.data-table {
  width: 100%; border-collapse: collapse; background: var(--card-bg);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); font-size: .88rem;
}
.data-table thead th {
  background: var(--primary); color: #fff; padding: 11px 14px; text-align: left;
  font-weight: 600; font-size: .85rem; letter-spacing: .2px;
}
.data-table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }

code { background: #eef2f7; padding: 2px 7px; border-radius: 5px; font-size: .85em; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: .77rem; font-weight: 700; letter-spacing: .2px; }
.badge-ok  { background: #dcfce7; color: #15803d; }
.badge-off { background: #fee2e2; color: #b91c1c; }

/* ---- SECTION TOGGLE (home) ---- */
.section-toggle {
  display: flex; gap: 18px; justify-content: center;
  margin-bottom: 44px;
}
.sec-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 22px 44px; border-radius: 16px; border: none; cursor: pointer;
  font-family: inherit; min-width: 230px;
  transition: transform .2s, box-shadow .2s, filter .2s;
  position: relative; overflow: hidden;
}
.sec-btn::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(255,255,255,.07);
  transform: translate(24px,-24px); pointer-events: none;
}
.sec-btn .sb-icon  { font-size: 2rem; line-height: 1; }
.sec-btn .sb-title { font-size: 1rem; font-weight: 700; color: #fff; letter-spacing: .2px; }
.sec-btn .sb-sub   { font-size: .74rem; color: rgba(255,255,255,.68); margin-top: 1px; }
/* Production = bleu marine */
.sec-btn-prod { background: linear-gradient(135deg, #1a3a5c 0%, #2451a0 100%);
                box-shadow: 0 6px 20px rgba(27,61,110,.35); }
/* Projet = orange accent */
.sec-btn-proj { background: linear-gradient(135deg, #92400e 0%, #f0820f 100%);
                box-shadow: 0 6px 20px rgba(240,130,15,.35); }
/* Inactif : légèrement atténué */
.sec-btn:not(.active) { filter: brightness(.65) saturate(.8); box-shadow: none; }
/* Actif : mis en avant */
.sec-btn.active { transform: translateY(-3px); outline: 3px solid rgba(255,255,255,.45); outline-offset: 2px; }
.sec-btn:hover  { transform: translateY(-4px); filter: brightness(1) saturate(1); }
.proj-level-label {
  font-size: .78rem; font-weight: 700; letter-spacing: .9px;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 14px; padding-left: 4px;
}

@media (max-width: 768px) {
  .modules-grid { grid-template-columns: 1fr; }
  .admin-two-col { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .section-toggle { flex-direction: column; align-items: center; }
  .sec-btn { min-width: 0; width: 100%; max-width: 320px; }
}
