/* ============================================================
   ÉCOVILLAGE TRACKER - STYLES
   ============================================================ */
:root {
  --primary: #2d6a4f;
  --primary-light: #52b788;
  --primary-dark: #1b4332;
  --accent: #95d5b2;
  --bg: #f0faf4;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-light: #555;
  --border: #d8f3dc;
  --shadow: 0 2px 12px rgba(45,106,79,.10);
  --radius: 12px;
  --heart: #e74c3c;
  --muscle: #e67e22;
  --brain: #9b59b6;
  --flower: #e91e8c;
  --star: #f39c12;
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  min-height: 100vh;
}

/* ============================================================ NAVBAR */
.navbar {
  background: var(--primary-dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.nav-brand a {
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .3px;
}

.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 1.2rem;
  transition: all .2s;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,.2);
  color: white;
}

.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-user { font-size: .8rem; color: var(--accent); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-btn { background: none; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; cursor: pointer; font-size: 1.1rem; padding: 2px 6px; color: white; }
.btn-logout { color: rgba(255,255,255,.7); text-decoration: none; font-size: 1.1rem; }

/* ============================================================ LAYOUT */
.main-content { max-width: 1200px; margin: 0 auto; padding: 16px; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.page-title { font-size: 1.3rem; font-weight: 700; color: var(--primary-dark); }

/* ============================================================ CARDS */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  border: 1px solid var(--border);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.youth-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.youth-card:hover { border-color: var(--primary-light); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(45,106,79,.15); }

.youth-photo {
  width: 70px; height: 70px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-light);
  margin: 0 auto 8px;
  display: block;
  background: var(--accent);
}
.youth-photo-placeholder {
  width: 70px; height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; border: 3px solid var(--primary-light);
}

.youth-name { font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.youth-avg { font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.youth-avg small { font-size: .7rem; color: var(--text-light); font-weight: 400; }

.mini-bars { display: flex; gap: 3px; justify-content: center; margin-top: 8px; }
.mini-bar { width: 8px; border-radius: 4px; min-height: 4px; }

/* ============================================================ STAT CARDS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 12px; border: 1px solid var(--border); text-align: center; }
.stat-emoji { font-size: 1.8rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--primary-dark); }
.stat-label { font-size: .75rem; color: var(--text-light); margin-top: 2px; }

/* ============================================================ CATEGORY SCORES */
.cat-scores { display: flex; flex-direction: column; gap: 8px; }
.cat-row { display: flex; align-items: center; gap: 8px; }
.cat-emoji { font-size: 1.3rem; width: 30px; text-align: center; }
.cat-label { width: 80px; font-size: .82rem; color: var(--text-light); }
.cat-bar-wrap { flex: 1; background: #eee; border-radius: 10px; height: 10px; overflow: hidden; }
.cat-bar { height: 100%; border-radius: 10px; transition: width .5s; }
.cat-score-num { width: 28px; text-align: right; font-size: .85rem; font-weight: 700; }

/* ============================================================ FORMS */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.form-control {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .9rem;
  background: white; color: var(--text);
  transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--primary-light); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

textarea.form-control { resize: vertical; min-height: 70px; }

select.form-control { cursor: pointer; }

/* ============================================================ BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: .88rem; font-weight: 600; cursor: pointer;
  border: none; transition: all .2s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: #27ae60; color: white; }
.btn-success:hover { background: #1e8449; }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

/* ============================================================ SCORE SELECTOR */
.criteria-section { margin-bottom: 20px; }
.criteria-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px;
  margin-bottom: 8px; font-weight: 700; font-size: 1rem;
  cursor: pointer; user-select: none;
}
.criteria-header.heart { background: #fdecea; color: var(--heart); }
.criteria-header.muscle { background: #fef0e6; color: var(--muscle); }
.criteria-header.brain { background: #f5eef8; color: var(--brain); }
.criteria-header.flower { background: #fce4ec; color: var(--flower); }
.criteria-header.star { background: #fef9e7; color: var(--star); }

.criteria-body { border-left: 3px solid; padding-left: 12px; }
.criteria-body.heart { border-color: var(--heart); }
.criteria-body.muscle { border-color: var(--muscle); }
.criteria-body.brain { border-color: var(--brain); }
.criteria-body.flower { border-color: var(--flower); }
.criteria-body.star { border-color: var(--star); }

.criteria-item { padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.criteria-item:last-child { border-bottom: none; }
.criteria-name { font-size: .85rem; font-weight: 600; margin-bottom: 2px; }
.criteria-name-sub { font-size: .78rem; color: var(--text-light); margin-bottom: 8px; }

.score-selector { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.score-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; padding: 2px; opacity: .25;
  transition: all .15s; line-height: 1;
}
.score-btn.active { opacity: 1; transform: scale(1.15); }
.score-btn:hover { opacity: .7; }

.criteria-comment {
  width: 100%; padding: 5px 8px;
  border: 1px solid #e0e0e0; border-radius: 6px;
  font-size: .78rem; resize: none; min-height: 34px;
  color: var(--text); margin-top: 4px;
}
.criteria-comment:focus { outline: none; border-color: var(--primary-light); }

/* ============================================================ TIMER */
.timer-bar {
  background: var(--primary-dark); color: white;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; border-radius: 10px; margin-bottom: 16px;
  position: sticky; top: 56px; z-index: 50;
}
.timer-display { font-size: 1.2rem; font-weight: 700; font-family: monospace; }
.timer-btns { display: flex; gap: 6px; }
.timer-btn {
  background: rgba(255,255,255,.2); border: none; color: white;
  border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: .82rem;
}
.timer-btn:hover { background: rgba(255,255,255,.35); }

/* ============================================================ CHARTS */
.chart-container { position: relative; height: 220px; }
.chart-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.chart-tab {
  padding: 5px 12px; border-radius: 20px; font-size: .8rem;
  cursor: pointer; background: #eee; border: none; color: var(--text-light);
  font-weight: 500; transition: all .2s;
}
.chart-tab.active { background: var(--primary); color: white; }

/* ============================================================ TABLE */
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table th { background: var(--primary-dark); color: white; padding: 8px 10px; text-align: left; }
.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.data-table tr:hover td { background: #f0faf4; }
.data-table-wrap { overflow-x: auto; border-radius: var(--radius); }

/* ============================================================ ALERTS */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: .88rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ============================================================ LOGIN PAGE */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  padding: 20px;
}
.login-card {
  background: white; border-radius: 20px;
  padding: 40px 32px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo h1 { font-size: 1.4rem; color: var(--primary-dark); margin-top: 8px; }

/* ============================================================ BADGES */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-self { background: #e3f2fd; color: #1565c0; }
.badge-coach { background: #f3e5f5; color: #6a1b9a; }
.badge-admin { background: #fff3e0; color: #e65100; }

/* ============================================================ PHOTO UPLOAD */
.photo-upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; cursor: pointer;
  transition: border-color .2s;
}
.photo-upload-area:hover { border-color: var(--primary-light); }

/* ============================================================ DETAIL PAGE */
.youth-detail-header {
  display: flex; gap: 16px; align-items: center;
  flex-wrap: wrap; margin-bottom: 16px;
}
.youth-detail-photo {
  width: 90px; height: 90px; border-radius: 50%;
  object-fit: cover; border: 4px solid var(--primary-light);
  flex-shrink: 0;
}

.section-title { font-size: 1rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }

/* ============================================================ TABS */
.tab-nav { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tab-btn { padding: 7px 14px; border-radius: 8px; font-size: .85rem; cursor: pointer; background: #eee; border: none; color: var(--text-light); font-weight: 500; transition: all .2s; }
.tab-btn.active { background: var(--primary); color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================ RESPONSIVE */
@media (max-width: 640px) {
  .nav-brand a { font-size: .85rem; }
  .nav-user { display: none; }
  .main-content { padding: 10px; }
  .form-row { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .score-btn { font-size: 1.2rem; }
  .page-title { font-size: 1.1rem; }
}

@media (max-width: 400px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
  .score-btn { font-size: 1rem; }
}

/* ============================================================ MISC */
.text-center { text-align: center; }
.text-muted { color: var(--text-light); font-size: .85rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 12px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.hidden { display: none; }

.loading { text-align: center; color: var(--text-light); padding: 40px; font-size: .9rem; }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* Radar chart legend */
.radar-legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.radar-legend-item { display: flex; align-items: center; gap: 4px; font-size: .78rem; }
.radar-legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* Progress ring */
.progress-ring-wrap { display: inline-flex; flex-direction: column; align-items: center; }

.eval-session-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.eval-session-meta { font-size: .78rem; color: var(--text-light); }

.stars-display { letter-spacing: 1px; }

.collapsible-content { overflow: hidden; transition: max-height .3s; }
.collapsible-content.collapsed { max-height: 0; }
