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

body {
  font-family: Arial, sans-serif;
  font-size: 17px;
  background: #f5f7fa;
  color: #222;
  padding-bottom: 100px;
}

/* ===== LOGIN ===== */

#screen-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1F4E79;
  padding: 20px;
}

.login-box {
  background: white;
  border-radius: 20px;
  padding: 36px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-icon {
  font-size: 36px;
  color: #1F4E79;
  margin-bottom: 10px;
}

.login-logo h1 {
  font-size: 22px;
  color: #1F4E79;
  margin-bottom: 6px;
}

.login-logo p {
  font-size: 14px;
  color: #777;
}

.login-error {
  background: #fff0f0;
  border-left: 4px solid #dc3545;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  color: #721c24;
  margin-bottom: 16px;
}

.login-box input {
  display: block;
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.login-box input:focus { border-color: #1F4E79; }

.password-wrap {
  position: relative;
  margin-bottom: 12px;
}

.password-wrap input {
  margin-bottom: 0;
  padding-right: 46px;
}

.toggle-pw {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 44px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.toggle-pw:hover { color: #1F4E79; }

.login-box button:not(.toggle-pw) {
  width: 100%;
  padding: 14px;
  background: #1F4E79;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 4px;
}

.login-box button:not(.toggle-pw):active { opacity: 0.85; }

/* ===== HEADER ===== */

header {
  background: #1F4E79;
  color: white;
  padding: 16px 16px 12px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

#date-today { font-size: 15px; opacity: 0.9; }
#jour-protocole { font-size: 13px; opacity: 0.65; margin-top: 2px; }

#logout-btn {
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

#progress-bar-container { padding: 0; }
#progress-text { font-size: 13px; opacity: 0.8; margin-bottom: 6px; }
#progress-bar { background: rgba(255,255,255,0.2); border-radius: 10px; height: 8px; overflow: hidden; }
#progress-fill { background: #4CAF50; height: 100%; width: 0%; border-radius: 10px; transition: width 0.4s ease; }

/* ===== WARNING ===== */

.warning {
  background: #fff3cd;
  border-left: 5px solid #ffc107;
  padding: 12px 16px;
  margin: 12px 12px 0;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ===== MOMENTS ===== */

main { padding: 10px 12px 0; }

.moment-card {
  background: white;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  overflow: hidden;
}

.moment-card.completed { border-left: 5px solid #28a745; }
.moment-card.completed .moment-header { background: #e8f5e9; }

.moment-header {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  background: #f0f4f8;
  gap: 12px;
}

.moment-check {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid #2E75B6;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
  background: white;
  transition: all 0.2s;
}

.moment-card.completed .moment-check { background: #28a745; border-color: #28a745; color: white; }

.moment-title-block { flex: 1; }
.moment-time { font-size: 12px; color: #2E75B6; font-weight: bold; }
.moment-title { font-size: 15px; font-weight: bold; color: #1F4E79; margin-top: 2px; }

.moment-body { padding: 0 16px 12px; }

.action-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  user-select: none;
}

.action-item:last-child { border-bottom: none; }
.action-item.disabled { opacity: 0.38; cursor: default; pointer-events: none; }

.action-check {
  width: 24px; height: 24px;
  border-radius: 5px;
  border: 2px solid #ccc;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
  transition: all 0.15s;
  background: white;
  font-size: 14px;
}

.action-item.checked .action-check { background: #2E75B6; border-color: #2E75B6; color: white; }
.action-item.checked .action-text { text-decoration: line-through; color: #aaa; }

.action-text { font-size: 15px; line-height: 1.4; flex: 1; }

.tag-attention {
  display: inline-block;
  background: #fff3cd;
  color: #856404;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: bold;
}

/* ===== HISTORIQUE / CALENDRIER ===== */

#historique {
  margin: 20px 12px 0;
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

#historique h2 {
  font-size: 16px;
  color: #1F4E79;
  margin-bottom: 14px;
}

#calendrier {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s;
}

.cal-day:active { transform: scale(0.92); }

.cal-day .cal-num {
  font-size: 11px;
  font-weight: bold;
  color: white;
  line-height: 1;
}

.cal-day .cal-label {
  font-size: 9px;
  color: rgba(255,255,255,0.75);
  margin-top: 1px;
}

.cal-day.green   { background: #28a745; }
.cal-day.orange  { background: #fd7e14; }
.cal-day.red     { background: #dc3545; }
.cal-day.empty   { background: #e0e0e0; }
.cal-day.empty .cal-num { color: #999; }
.cal-day.future  { background: #dce6f0; }
.cal-day.future .cal-num { color: #2E75B6; }
.cal-day.today   { box-shadow: 0 0 0 2px #1F4E79; }

#calendrier-legende {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 12px;
  color: #666;
  align-items: center;
}

.leg {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 3px;
  margin-right: 3px;
  vertical-align: middle;
}

.leg-green  { background: #28a745; }
.leg-orange { background: #fd7e14; }
.leg-red    { background: #dc3545; }
.leg-future { background: #dce6f0; border: 1px solid #2E75B6; }

/* ===== SETTINGS ===== */

#settings-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1F4E79;
  color: white;
  border: none;
  border-radius: 50px;
  padding: 12px 20px;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  z-index: 100;
}

#settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}

#settings-overlay.visible { display: block; }

#settings-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 40px;
  box-shadow: 0 -6px 30px rgba(0,0,0,0.2);
  z-index: 200;
  max-height: 85vh;
  overflow-y: auto;
}

#settings-panel h2 { font-size: 20px; color: #1F4E79; margin-bottom: 18px; }
#settings-panel h3 { font-size: 16px; color: #1F4E79; margin: 20px 0 10px; border-top: 1px solid #eee; padding-top: 16px; }

.settings-hint { font-size: 13px; color: #888; margin-bottom: 12px; }

#settings-panel label {
  display: block;
  font-size: 15px;
  color: #444;
  margin-bottom: 12px;
  line-height: 1.5;
}

#settings-panel input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-top: 4px;
  outline: none;
}

#settings-panel input:focus { border-color: #1F4E79; }

#save-settings {
  width: 100%;
  padding: 14px;
  background: #1F4E79;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 8px;
  margin-bottom: 10px;
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: #e8f0f8;
  color: #1F4E79;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  margin-bottom: 10px;
}

#reset-day {
  width: 100%;
  padding: 12px;
  background: #f8d7da;
  color: #721c24;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
}

#create-user-result {
  background: #e8f5e9;
  border-left: 4px solid #28a745;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.6;
  margin-top: 10px;
  margin-bottom: 10px;
}
