/* ── YODI IA — Styles globaux Mini App Telegram ── */

:root {
  /* ── Charte YODI IA ── */
  --primary:     #1a3a6b;   /* Bleu foncé logo */
  --cyan:        #00b4d8;   /* Cyan réseau logo */
  --cyan-lt:     #e0f7fc;   /* Cyan clair */
  --primary-lt:  #eef2f8;   /* Bleu très clair */

  /* Alias compatibilité */
  --tg-blue:     var(--primary);
  --tg-blue-lt:  var(--primary-lt);

  --bg:          #f0f4f8;
  --card:        #ffffff;
  --text:        #0d1b2a;
  --text-muted:  #6b7280;
  --border:      #dde3ed;
  --danger:      #ef4444;
  --success:     #22c55e;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 6px 24px rgba(26,58,107,0.13);
  --shadow-float:0 10px 36px rgba(26,58,107,0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

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

/* ── Header ── */
.app-header {
  background: var(--card);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header h1 { font-size: 17px; font-weight: 700; }
.btn-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--tg-blue-lt);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--tg-blue);
  transition: background .15s;
}
.btn-icon:active { background: #cce0f5; }

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ── Boutons ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  font-size: 15px; font-weight: 600;
  transition: opacity .15s, transform .1s;
  width: 100%;
}
.btn:active { opacity: .85; transform: scale(.98); }
.btn-primary   { background: var(--tg-blue); color: #fff; }
.btn-secondary { background: var(--tg-blue-lt); color: var(--tg-blue); }
.btn-danger    { background: #fee2e2; color: var(--danger); }
.btn-success   { background: #dcfce7; color: #16a34a; }

/* ── Avatar ── */
.avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--tg-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff; font-weight: 700;
  border: 3px solid var(--tg-blue-lt);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Badge compte ── */
.account-badge {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff;
  flex-shrink: 0;
}
.badge-gmail { background: #ea4335; }
.badge-pro   { background: var(--tg-blue); }

/* ── Liste de mails ── */
.mail-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
  text-decoration: none; color: inherit;
}
.mail-item:last-child { border-bottom: none; }
.mail-item:active { background: var(--bg); }
.mail-item.unread .mail-sender { font-weight: 700; }
.mail-sender { font-size: 14px; font-weight: 500; }
.mail-subject { font-size: 13px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.mail-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; margin-left: auto; }
.unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tg-blue); flex-shrink: 0; margin-top: 5px;
}

/* ── Résumé Flash IA ── */
.ai-summary {
  background: linear-gradient(135deg, #e8f3fc 0%, #f0e9ff 100%);
  border-radius: var(--radius);
  padding: 16px;
  border-left: 4px solid var(--tg-blue);
}
.ai-summary-title {
  font-size: 13px; font-weight: 700;
  color: var(--tg-blue); margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.ai-summary ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.ai-summary li { font-size: 14px; padding-left: 18px; position: relative; line-height: 1.4; }
.ai-summary li::before { content: "•"; position: absolute; left: 4px; color: var(--tg-blue); }

/* ── Accordéon ── */
.accordion-toggle {
  width: 100%; background: none; border: none;
  padding: 12px 0; cursor: pointer;
  font-size: 14px; color: var(--tg-blue); font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.accordion-body { display: none; font-size: 14px; line-height: 1.6; color: var(--text-muted);
  white-space: pre-wrap; }
.accordion-body.open { display: block; }

/* ── Formulaire ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.form-input {
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); font-size: 15px;
  background: var(--card); color: var(--text);
  transition: border-color .15s; outline: none;
}
.form-input:focus { border-color: var(--tg-blue); }
.form-toggle { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.toggle-switch { position: relative; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 24px; cursor: pointer; transition: background .2s;
}
.toggle-slider::before {
  content: ""; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; left: 3px; top: 3px;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--tg-blue); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Bottom sheet ── */
.bottom-sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 100; display: none; align-items: flex-end;
}
.bottom-sheet-overlay.open { display: flex; }
.bottom-sheet {
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 24px 20px 40px; width: 100%;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 0 auto 20px;
}

/* ── Lucide Icons ── */
.lucide {
  width: 20px; height: 20px;
  stroke-width: 1.75;
  flex-shrink: 0;
}
.hub-tile-icon .lucide { width: 24px; height: 24px; }
.type-btn-icon .lucide { width: 38px; height: 38px; stroke-width: 1.5; }
.btn .lucide { width: 18px; height: 18px; }
.ai-summary-title .lucide { width: 16px; height: 16px; }
#accordion-chevron { transition: transform .25s ease; }

/* ── Spinner ── */
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--tg-blue-lt);
  border-top-color: var(--tg-blue);
  animation: spin .7s linear infinite; margin: 40px auto;
}
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Utilitaires ── */
.page { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.section-label { font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px; padding: 0 4px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-center { text-align: center; }
.hidden { display: none !important; }
