/* ============================================
   Dashboard Projets Meg & Noël
   Palette: teal #1B6B5A, gold #C4943A, ivory #FAFAF5, dark #1C1C1C
   Fonts: Playfair Display (headings), Source Sans 3 (body)
   ============================================ */

:root {
  --teal: #1B6B5A;
  --teal-light: #248F78;
  --teal-dark: #14503F;
  --gold: #C4943A;
  --gold-light: #D4A94E;
  --gold-bg: rgba(196, 148, 58, 0.12);
  --ivory: #FAFAF5;
  --dark: #1C1C1C;
  --white: #FFFFFF;
  --gray-100: #F5F5F0;
  --gray-200: #E8E8E2;
  --gray-300: #D0D0C8;
  --gray-400: #9E9E96;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --transition: 0.25s ease;
}

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

body {
  font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
  background: var(--ivory);
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Password gate ---- */

.gate-overlay {
  position: fixed;
  inset: 0;
  background: var(--teal-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.gate-overlay.hidden {
  display: none;
}

.gate-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 48px 40px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.gate-box h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  color: var(--teal);
  margin-bottom: 8px;
}

.gate-box p {
  color: var(--gray-400);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.gate-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.gate-input:focus {
  border-color: var(--teal);
}

.gate-input.error {
  border-color: #c0392b;
  animation: shake 0.4s ease;
}

.gate-btn {
  margin-top: 16px;
  width: 100%;
  padding: 12px;
  background: var(--teal);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.gate-btn:hover {
  background: var(--teal-light);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---- Main layout ---- */

.app {
  display: none;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.app.visible {
  display: block;
}

/* ---- Header ---- */

.header {
  text-align: center;
  margin-bottom: 48px;
}

.header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  color: var(--teal);
  margin-bottom: 8px;
  font-weight: 700;
}

.header .subtitle {
  font-size: 1.05rem;
  color: var(--gray-400);
  font-style: italic;
}

/* ---- Project grid ---- */

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 56px;
}

/* ---- Project card ---- */

.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 28px;
  transition: box-shadow var(--transition), border-color var(--transition);
  cursor: default;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  color: var(--dark);
  font-weight: 700;
}

.card-vision {
  color: var(--gray-400);
  font-size: 0.92rem;
  margin-top: 4px;
  font-style: italic;
}

/* Status badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge--actif {
  background: #E8F5E9;
  color: #2E7D32;
}

.badge--attente {
  background: #FFF8E1;
  color: #F57F17;
}

.badge--pause {
  background: var(--gray-100);
  color: var(--gray-400);
}

.badge--cadrage {
  background: #E3F2FD;
  color: #1565C0;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.badge--actif .badge-dot { background: #2E7D32; }
.badge--attente .badge-dot { background: #F57F17; }
.badge--pause .badge-dot { background: var(--gray-400); }
.badge--cadrage .badge-dot { background: #1565C0; }

/* Card summary (always visible) */

.card-summary {
  margin-top: 20px;
}

.card-row {
  margin-bottom: 12px;
}

.card-row-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal);
  margin-bottom: 2px;
}

.card-row-value {
  font-size: 0.95rem;
  color: var(--dark);
}

/* Expand toggle */

.card-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 0;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--teal);
  cursor: pointer;
  transition: color var(--transition);
}

.card-toggle:hover {
  color: var(--teal-light);
}

.card-toggle svg {
  transition: transform var(--transition);
}

.card.expanded .card-toggle svg {
  transform: rotate(180deg);
}

/* Expandable detail */

.card-detail {
  display: none;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}

.card.expanded .card-detail {
  display: block;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  color: var(--teal-dark);
  margin-bottom: 6px;
  font-weight: 700;
}

.detail-section-text {
  font-size: 0.93rem;
  color: var(--dark);
}

.learn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.learn-box {
  background: var(--gray-100);
  border-radius: 8px;
  padding: 16px;
}

.learn-box-who {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal);
  margin-bottom: 4px;
}

.learn-box-text {
  font-size: 0.9rem;
  color: var(--dark);
}

/* ---- 4 Maillons de l'Abondance ---- */

.maillons-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}

.maillons-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--teal-dark);
  margin-bottom: 16px;
  font-weight: 700;
}

.maillon {
  margin-bottom: 16px;
  position: relative;
}

.maillon.weakest {
  background: var(--gold-bg);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 12px;
  margin-left: -12px;
  margin-right: -12px;
}

.maillon-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.maillon-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--dark);
}

.maillon-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--teal);
  min-width: 30px;
  text-align: right;
}

.maillon.weakest .maillon-name {
  color: var(--gold);
}

.maillon.weakest .maillon-value {
  color: var(--gold);
}

.weakest-label {
  display: none;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-left: 8px;
}

.maillon.weakest .weakest-label {
  display: inline;
}

/* Custom range slider */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--gray-200);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--teal);
  border: 3px solid var(--white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--teal);
  border: 3px solid var(--white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.maillon.weakest input[type="range"]::-webkit-slider-thumb {
  background: var(--gold);
}

.maillon.weakest input[type="range"]::-moz-range-thumb {
  background: var(--gold);
}

/* Slider track fill */
input[type="range"] {
  background: linear-gradient(
    to right,
    var(--teal) 0%,
    var(--teal) var(--fill, 50%),
    var(--gray-200) var(--fill, 50%),
    var(--gray-200) 100%
  );
}

.maillon.weakest input[type="range"] {
  background: linear-gradient(
    to right,
    var(--gold) 0%,
    var(--gold) var(--fill, 50%),
    var(--gray-200) var(--fill, 50%),
    var(--gray-200) 100%
  );
}

/* Reflection textarea */

.reflection-block {
  margin-top: 20px;
}

.reflection-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 8px;
  line-height: 1.5;
}

.reflection-label .highlight {
  color: var(--gold);
  font-weight: 700;
}

.reflection-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px 14px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.93rem;
  line-height: 1.5;
  color: var(--dark);
  background: var(--white);
  outline: none;
  resize: vertical;
  transition: border-color var(--transition);
}

.reflection-textarea:focus {
  border-color: var(--gold);
}

.reflection-textarea::placeholder {
  color: var(--gray-300);
}

/* ---- Journal section ---- */

.journal-section {
  margin-top: 16px;
}

.journal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  color: var(--teal);
  margin-bottom: 20px;
  font-weight: 700;
}

.journal-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.journal-table th {
  background: var(--teal);
  color: var(--white);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  text-align: left;
}

.journal-table td {
  padding: 10px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--gray-100);
}

.journal-table tr:last-child td {
  border-bottom: none;
}

.journal-table tr:hover td {
  background: var(--gray-100);
}

.journal-date {
  color: var(--gray-400);
  font-weight: 600;
  white-space: nowrap;
}

.journal-project {
  font-weight: 700;
  color: var(--teal);
  white-space: nowrap;
}

.journal-who {
  color: var(--gray-400);
  white-space: nowrap;
}

/* ---- Footer ---- */

.footer {
  margin-top: 56px;
  text-align: center;
  padding: 24px 0;
  border-top: 1px solid var(--gray-200);
}

.footer p {
  font-size: 0.85rem;
  color: var(--gray-400);
  font-style: italic;
}

/* ---- Responsive ---- */

@media (min-width: 640px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .app {
    padding: 48px 32px 80px;
  }

  .header h1 {
    font-size: 2.6rem;
  }
}

@media (min-width: 960px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* On small screens, learn-grid stacks */
@media (max-width: 480px) {
  .learn-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 20px;
  }

  .journal-table th,
  .journal-table td {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .maillon.weakest {
    margin-left: -8px;
    margin-right: -8px;
    padding: 10px;
  }
}

/* ---- Logout button ---- */

.logout-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--gray-400);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  z-index: 100;
}

.logout-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}

/* ---- Saved indicator ---- */

.saved-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--teal);
  color: var(--white);
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease;
  z-index: 200;
  pointer-events: none;
}

.saved-toast.show {
  transform: translateX(-50%) translateY(0);
}
