/* main.css - HERO responsive design */

:root {
  --blue: #1a73e8;
  --blue-dark: #1557b0;
  --red: #d93025;
  --orange: #f29900;
  --green: #1e8e3e;
  --grey-light: #f8f9fa;
  --grey: #e8eaed;
  --grey-dark: #5f6368;
  --text: #202124;
  --white: #ffffff;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--grey-light);
  min-height: 100vh;
}

/* HEADER */
.hero-header {
  background: var(--white);
  border-bottom: 1px solid var(--grey);
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.hero-logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 2px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-user {
  font-size: 14px;
  color: var(--grey-dark);
}

.btn-logout {
  font-size: 14px;
  color: var(--blue);
  text-decoration: none;
}

.lang-switcher a {
  font-size: 13px;
  color: var(--grey-dark);
  text-decoration: none;
  padding: 4px 8px;
  border: 1px solid var(--grey);
  border-radius: 4px;
}

/* MAIN */
.hero-main {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* FOOTER */
.hero-footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 12px;
  color: var(--grey-dark);
}

/* CARDS */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* FORMS */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--grey-dark);
  margin-bottom: 6px;
}

.form-group input[type="number"],
.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  border: 2px solid var(--grey);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.form-group input:focus {
  border-color: var(--blue);
}

/* TOGGLE MOT DE PASSE */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  flex: 1;
  padding-right: 52px;
}

.btn-toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  padding: 0;
  line-height: 1;
  color: var(--grey-dark);
  user-select: none;
  -webkit-user-select: none;
}

/* SELECT PÉRIODE */
.select-period {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid var(--grey);
  border-radius: var(--radius);
  outline: none;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%235f6368' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.select-period:focus {
  border-color: var(--blue);
}

/* SPORT TOGGLE */
.sport-toggle {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.sport-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 2px solid var(--grey);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.sport-option:has(input:checked) {
  border-color: var(--blue);
  background: #e8f0fe;
}

.sport-option input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}

.sport-option-label {
  font-size: 15px;
}

/* ALERTS */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 500;
}

.alert-error {
  background: #fce8e6;
  color: var(--red);
  border: 1px solid #f5c6c2;
}

.alert-warning {
  background: #fef3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.alert-sport {
  background: #fef3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
  margin-top: 12px;
}

/* RESULT */
.result-card {
  background: var(--blue);
  color: var(--white);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.result-card.alert-dose {
  background: var(--red);
}

.result-label {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 8px;
}

.result-dose {
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
}

.result-unit {
  font-size: 18px;
  opacity: 0.9;
  margin-top: 4px;
}

.result-alert-text {
  margin-top: 16px;
  font-size: 15px;
  font-weight: 600;
  background: rgba(255,255,255,0.2);
  padding: 10px;
  border-radius: 8px;
}

/* HYPO RESULT */
.result-hypo {
  background: var(--orange);
  color: var(--white);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.result-hypo-text {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.6;
  margin-top: 12px;
}

/* CALL BUTTONS */
.call-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-call {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  color: var(--white);
  background: var(--green);
}

/* BUTTONS */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--blue-dark); }
.btn-full { width: 100%; }

/* LOGIN PAGE */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grey-light);
  padding: 16px;
}

.login-container {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
}

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

.login-logo h1 {
  font-size: 36px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 4px;
}

.login-logo p {
  font-size: 14px;
  color: var(--grey-dark);
  margin-top: 4px;
}

.admin-badge {
  font-size: 16px;
  background: var(--orange);
  color: var(--white);
  padding: 2px 8px;
  border-radius: 4px;
  vertical-align: middle;
}

.lang-switcher-login {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
}

.lang-switcher-login a {
  color: var(--grey-dark);
  text-decoration: none;
}

/* ERROR PAGE */
.error-page {
  text-align: center;
  padding: 24px 0;
}

.error-page h2 {
  font-size: 64px;
  font-weight: 700;
  color: var(--grey);
  margin-bottom: 8px;
}

.error-page p {
  font-size: 16px;
  color: var(--grey-dark);
  margin-bottom: 24px;
}

/* FOODS LIST */
.foods-list {
  font-size: 14px;
  color: var(--grey-dark);
  margin-top: 8px;
}

.foods-list span {
  display: inline-block;
  background: var(--grey-light);
  border: 1px solid var(--grey);
  border-radius: 6px;
  padding: 4px 10px;
  margin: 2px;
}

/* RESPONSIVE */
@media (max-width: 480px) {
  .hero-main { padding: 12px; }
  .card { padding: 16px; }
  .result-dose { font-size: 40px; }
  .call-buttons { flex-direction: column; }
}

/* ONGLETS */
.tabs-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow);
}

.tab-btn {
  flex: 1;
  padding: 12px 8px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--grey-dark);
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--blue);
  color: var(--white);
}

.tab-btn:nth-child(2).active {
  background: var(--red);
}

.tab-btn:nth-child(3).active {
  background: var(--orange);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* URGENCES - GÉNÉRAL */
.card-urgence {
  border-top: 4px solid var(--grey);
}

.card-hypo {
  border-top-color: var(--red);
}

.card-hyper {
  border-top-color: var(--orange);
}

.urgence-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.urgence-subtitle {
  font-size: 13px;
  font-weight: 400;
  color: var(--grey-dark);
}

.urgence-intro {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* CHECKLIST HYPO */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checklist-step {
  display: flex;
  gap: 12px;
  padding: 16px;
  border: 2px solid var(--grey);
  border-radius: var(--radius);
  background: var(--white);
  transition: all 0.2s;
}

.checklist-step.hidden {
  display: none;
}

.checklist-step.step-done {
  background: #f0f8f0;
  border-color: var(--green);
  opacity: 0.7;
}

.checklist-step-grave {
  border-color: var(--red);
  background: #fce8e6;
}

.step-number {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: var(--blue);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.step-number-grave {
  background: var(--red);
  font-size: 20px;
}

.step-content {
  flex: 1;
}

.step-text {
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 12px;
  color: var(--text);
}

.step-text-grave {
  font-size: 18px;
  font-weight: 600;
  color: var(--red);
}

.timer-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-step-done {
  width: 100%;
  padding: 12px;
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn-step-done:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-step-warn {
  width: 100%;
  padding: 12px;
  background: var(--orange);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn-step-warn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-reset {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: var(--grey);
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  cursor: pointer;
}

.btn-reset.hidden {
  display: none;
}

/* ALIMENTS URGENCES */
.foods-urgence {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.food-tag {
  background: #e8f0fe;
  color: var(--blue);
  border: 1px solid #c5d8f8;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 15px;
  font-weight: 500;
}

.food-tag-slow {
  background: #fef3cd;
  color: #856404;
  border-color: #ffeaa7;
}

/* BOUTONS URGENCES 144/112 */
.call-buttons-urgence {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-call-urgence {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  color: var(--white);
  background: var(--red);
}

.btn-call-diabeto {
  background: #7c4dff;
}

/* PALIERS HYPER */
.hyper-palier {
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border-left: 5px solid var(--grey);
}

.palier-ok {
  background: #f0f8f0;
  border-left-color: var(--green);
}

.palier-warn {
  background: #fef3cd;
  border-left-color: var(--orange);
}

.palier-danger {
  background: #fce8e6;
  border-left-color: var(--red);
}

.palier-grave {
  background: #3c1010;
  border-left-color: #ff0000;
  color: var(--white);
}

.palier-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.palier-value {
  font-size: 16px;
  font-weight: 700;
}

.palier-ou {
  font-size: 13px;
  color: var(--grey-dark);
}

.palier-grave .palier-ou {
  color: rgba(255,255,255,0.6);
}

.palier-action {
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 4px;
}

.palier-action-grave {
  font-size: 20px;
  font-weight: 700;
  color: #ff6b6b;
}

/* STABILISATION HYPO */
.stabilise-msg {
  margin-top: 12px;
  padding: 12px;
  background: #f0f8f0;
  border-radius: var(--radius);
  border: 2px solid var(--green);
}

.stabilise-msg.hidden {
  display: none;
}

.alert-stabilise {
  font-size: 18px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 8px;
}

.sport-prevention-msg {
  margin-top: 12px;
  padding: 12px;
  background: #fef3cd;
  border-radius: var(--radius);
  border: 1px solid #ffeaa7;
}

/* HYPER SCENARIOS */
.hyper-scenarios {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.btn-scenario {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--grey);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  background: var(--white);
  color: var(--text);
  transition: all 0.2s;
}

.btn-scenario-ok {
  border-left: 5px solid var(--green);
}

.btn-scenario-ok.active {
  background: #f0f8f0;
  border-color: var(--green);
}

.btn-scenario-warn {
  border-left: 5px solid var(--orange);
}

.btn-scenario-warn.active {
  background: #fef3cd;
  border-color: var(--orange);
}

.btn-scenario-danger {
  border-left: 5px solid var(--red);
}

.btn-scenario-danger.active {
  background: #fce8e6;
  border-color: var(--red);
}

.btn-scenario-grave {
  border-left: 5px solid #3c1010;
  color: var(--red);
}

.btn-scenario-grave.active {
  background: #3c1010;
  color: var(--white);
  border-color: #3c1010;
}

.hyper-detail {
  margin-top: 8px;
}

.hyper-detail.hidden {
  display: none;
}

/* BACKOFFICE ADMIN */
.admin-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--grey);
}

.admin-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.admin-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--grey-dark);
  margin-bottom: 12px;
}

.admin-form-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-form .form-group input {
  font-size: 15px;
  padding: 10px 14px;
}

/* TABLE AIDANTS */
.admin-table-wrapper {
  overflow-x: auto;
  margin-top: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--grey-light);
  color: var(--grey-dark);
  font-weight: 600;
  border-bottom: 2px solid var(--grey);
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--grey);
  vertical-align: middle;
}

.admin-table tr.row-inactive {
  opacity: 0.5;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active {
  background: #e6f4ea;
  color: var(--green);
}

.badge-inactive {
  background: var(--grey-light);
  color: var(--grey-dark);
}

.action-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

.input-inline {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--grey);
  border-radius: 6px;
  width: 120px;
}

.btn-action {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--white);
}

.btn-blue { background: var(--blue); }
.btn-red { background: var(--red); }

.text-muted {
  font-size: 13px;
  color: var(--grey-dark);
}

code {
  background: var(--grey-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
}

/* CREDENTIALS BOX */
.credentials-box {
  background: var(--grey-light);
  border: 2px solid var(--grey);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 8px;
}

.credential-row {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--grey);
}

.credential-row:last-child {
  border-bottom: none;
}

.credential-label {
  font-size: 13px;
  color: var(--grey-dark);
  font-weight: 600;
  min-width: 100px;
}

.credential-value {
  font-size: 15px;
  font-weight: 500;
  font-family: monospace;
}

.credential-password {
  color: var(--blue);
  font-size: 18px;
  font-weight: 700;
}

/* FIELD HINT */
.field-hint {
  font-size: 12px;
  color: var(--grey-dark);
  margin-top: 6px;
}

/* AUDIT FILTERS */
.audit-filters {
  margin-bottom: 8px;
}

.audit-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.audit-filter-row .form-group {
  margin-bottom: 0;
  min-width: 140px;
}

.audit-filter-row .form-group label {
  font-size: 12px;
}

.badge-alert {
  background: #fce8e6;
  color: var(--red);
}