/* ============================================
   SUIVIGLUCIDE — Login V2
   ============================================ */

:root {
  --primary: #FF8C00;
  --primary-dark: #e07b00;
  --primary-light: #ffb144;
  --accent: #4CAF50;
  --danger: #e74c3c;
  --warning: #f39c12;
  --bg: #f7f5f0;
  --card-bg: #ffffff;
  --text: #2c2c2c;
  --text-soft: #6b6b6b;
  --border: #e8e3d8;
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.04);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(255,140,0,0.18);
  --radius: 14px;
  --radius-sm: 8px;
  --gradient: linear-gradient(135deg, #FF8C00 0%, #ffb144 100%);
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

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

/* Skip-link accessibilité — masqué visuellement, visible au focus clavier */
.skip-link,
a[href="#main-content"]:first-child,
body > a:first-child {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}
.skip-link:focus,
a[href="#main-content"]:focus,
body > a:first-child:focus {
  position: fixed !important;
  left: 16px !important;
  top: 16px !important;
  width: auto !important;
  height: auto !important;
  padding: 10px 16px !important;
  background: var(--primary) !important;
  color: white !important;
  border-radius: var(--radius-sm) !important;
  z-index: 9999 !important;
  font-weight: 600 !important;
}

/* ============ HEADER ============ */
.page-header {
  background: var(--gradient);
  color: white;
  padding: 16px 0;
  box-shadow: var(--shadow-md);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { width: 48px; height: 48px; border-radius: 12px; background: rgba(255,255,255,0.2); padding: 4px; }
.brand h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.3px; }
.brand-sub { font-size: 0.85rem; opacity: 0.92; margin-top: 2px; }

.header-nav { display: flex; gap: 8px; }
.header-nav a {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: white;
  font-size: 1.3rem;
  transition: background 0.2s;
}
.header-nav a:hover { background: rgba(255,255,255,0.35); text-decoration: none; }

/* ============ MAIN ============ */
.login-page {
  flex: 1;
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ============ LOGIN CARD ============ */
.login-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  text-align: center;
  margin-bottom: 16px;
}
.login-icon {
  width: 72px;
  height: 72px;
  background: var(--gradient);
  border-radius: 50%;
  font-size: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
}
.login-card h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.login-subtitle {
  color: var(--text-soft);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* ============ ALERTS ============ */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
}
.alert-success {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  color: #2e7d32;
}
.alert-error {
  background: #fdecea;
  border: 1px solid #f5b5af;
  color: #c0392b;
}

/* ============ FORM ============ */
.login-form { text-align: left; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafaf6;
  color: var(--text);
  transition: all 0.15s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(255,140,0,0.12);
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 22px;
  gap: 10px;
  flex-wrap: wrap;
}
.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
}
.remember-me input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}
.forgot-link {
  font-size: 0.85rem;
  color: var(--primary-dark);
  font-weight: 500;
}

.btn-submit {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255,140,0,0.3);
  transition: all 0.15s;
}
.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255,140,0,0.4);
}
.btn-submit:active { transform: translateY(0); }

/* ============ DIVIDER ============ */
.divider {
  display: flex;
  align-items: center;
  margin: 24px 0 18px;
  color: var(--text-soft);
  font-size: 0.8rem;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider span { padding: 0 14px; }

/* ============ ALT ACTIONS ============ */
.alt-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-secondary, .btn-ghost {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-secondary {
  background: white;
  color: var(--primary-dark);
  border: 1.5px solid var(--primary);
}
.btn-secondary:hover { background: #fff3e0; text-decoration: none; }
.btn-ghost {
  background: #f4efe3;
  color: var(--text);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: #ebe3cf; text-decoration: none; }

/* ============ ALERT INFO ============ */
.alert-info {
  background: #e3f2fd;
  border: 1px solid #90caf9;
  color: #0d47a1;
}

/* ============ SELECT ============ */
.form-group select {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafaf6;
  color: var(--text);
  transition: all 0.15s;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b6b6b' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  background-color: white;
  box-shadow: 0 0 0 3px rgba(255,140,0,0.12);
}

/* ============ INFO BOXES ============ */
.info-box-success, .info-box-warning {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  text-align: left;
}
.info-box-success {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  color: #1b5e20;
}
.info-box-success strong { color: #2e7d32; }
.info-box-warning {
  background: #fff8ed;
  border: 1px solid #f0d8a0;
  color: var(--text);
}
.info-box-warning strong { color: #8a5a00; }
.info-box-warning input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: white;
}
.info-box-warning input:focus { outline: none; box-shadow: 0 0 0 3px rgba(255,140,0,0.15); }

/* ============ CONSENT BOX ============ */
.consent-box {
  background: #faf8f2;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 14px;
  text-align: left;
}
.consent-box > strong {
  display: block;
  color: var(--primary-dark);
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
}
.checkbox-row input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}
.consent-note {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-top: 8px;
  padding-left: 26px;
  line-height: 1.4;
}

/* ============ CGU MODAL ============ */
.cgu-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.cgu-modal-content {
  background: white;
  border-radius: var(--radius);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
}
.cgu-modal-header {
  background: var(--gradient);
  color: white;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cgu-modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.cgu-modal-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.cgu-modal-close:hover { background: rgba(255,255,255,0.35); }
.cgu-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}
.cgu-modal-body h3 {
  color: var(--primary-dark);
  margin: 18px 0 8px;
  font-size: 1rem;
  border-bottom: 1px solid #ffe5b3;
  padding-bottom: 4px;
}
.cgu-modal-body ul { margin: 8px 0; padding-left: 22px; }
.cgu-modal-body li { margin-bottom: 4px; }
.cgu-modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: #faf8f2;
  display: flex;
  justify-content: flex-end;
}

/* ============ INFO TIPS ============ */
.info-tips {
  background: #fff8ed;
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--text);
  text-align: left;
}
.info-tips strong { display: block; margin-bottom: 6px; color: #8a5a00; }
.info-tips ul { list-style: none; padding: 0; margin: 0; }
.info-tips li { padding: 3px 0; color: var(--text-soft); }
.info-tips li::before { content: "•"; color: var(--primary); margin-right: 8px; font-weight: bold; }
.info-tips code {
  background: rgba(255,140,0,0.12);
  color: var(--primary-dark);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ============ ABOUT CARD ============ */
.about-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.about-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.about-card p {
  font-size: 0.88rem;
  color: var(--text-soft);
  margin-bottom: 16px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #fff8ed;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text);
}
.feature-icon { font-size: 1.1rem; }

.install-row {
  display: flex;
  gap: 8px;
}
.store-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: var(--text);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s;
}
.store-btn:hover { opacity: 0.85; text-decoration: none; color: white; }

/* ============ DONATE CARD ============ */
.donate-card {
  background: linear-gradient(135deg, #fff8ed, #fff3d8);
  border: 1px solid #f0d8a0;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.donate-text { flex: 1; min-width: 180px; }
.donate-text strong { display: block; color: #8a5a00; font-size: 0.88rem; margin-bottom: 2px; }
.donate-text span { font-size: 0.78rem; color: var(--text-soft); }
.donate-links { display: flex; gap: 6px; }
.donate-btn {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  color: white;
  transition: transform 0.15s;
}
.donate-btn.kofi { background: #ff5722; }
.donate-btn.paypal { background: #0070ba; }
.donate-btn:hover { transform: scale(1.05); text-decoration: none; color: white; }

/* ============ FOOTER ============ */
.page-footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 20px 16px;
  text-align: center;
  margin-top: auto;
}
.footer-links {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--text-soft);
  font-size: 0.82rem;
}
.footer-copy {
  font-size: 0.75rem;
  color: var(--text-soft);
}

body.is-pwa .page-header { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 480px) {
  .login-card { padding: 24px 18px; }
  .login-card h2 { font-size: 1.35rem; }
  .login-icon { width: 60px; height: 60px; font-size: 1.8rem; }
  .features-grid { grid-template-columns: 1fr; }
  .brand h1 { font-size: 1.15rem; }
}
