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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: #f7f7f5;
  color: #14141f;
  padding-bottom: 78px;
}

.auth-gate {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 32px; text-align: center;
}
.gate-logo { width: 130px; margin-bottom: 26px; }
.auth-gate h1 { font-size: 21px; margin-bottom: 10px; }
.auth-gate p { font-size: 14px; color: #8a8a8a; max-width: 300px; margin-bottom: 26px; }
.gate-btn {
  width: 100%; max-width: 300px; padding: 14px; border-radius: 100px;
  font-weight: 800; font-size: 14.5px; text-decoration: none; margin-bottom: 12px; display: block;
}
.gate-btn.primary { background: #f97316; color: #fff; }
.gate-btn.secondary { background: #fff; color: #14141f; border: 1.5px solid #eee; }

.page-header {
  background: #ffffff;
  padding: 18px 20px 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-header h1 { font-size: 20px; font-weight: 800; }

.bell-btn {
  position: relative;
  border: none;
  background: #f4f4f7;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #14141f;
  cursor: pointer;
}
.bell-badge {
  position: absolute; top: -2px; right: -2px;
  background: #f97316; color: #fff;
  font-size: 10px; font-weight: 800;
  min-width: 17px; height: 17px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid #fff;
}

.tabs {
  display: flex; gap: 6px; background: #ffffff;
  padding: 0 16px 12px 16px; overflow-x: auto; border-bottom: 1px solid #eee;
}
.tab {
  border: none; background: #f4f4f7; color: #8a8a8a;
  font-size: 12.5px; font-weight: 700; padding: 9px 15px;
  border-radius: 100px; white-space: nowrap; cursor: pointer; flex-shrink: 0;
}
.tab.active { background: #f97316; color: #fff; }

.tab-panel { display: none; padding: 16px; }
.tab-panel.active { display: block; }

.community-card { background: #ffffff; border-radius: 16px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.04); }
.community-photo {
  width: 100%; height: 140px; border-radius: 12px; object-fit: cover;
  background: linear-gradient(135deg, #f97316, #d4af37); margin-bottom: 14px; display: block;
}
.community-name { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.community-desc { font-size: 13.5px; color: #8a8a8a; margin-bottom: 10px; line-height: 1.4; }
.community-count { font-size: 12px; color: #b0b0b0; margin-bottom: 16px; }

.panel-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.panel-actions input { flex: 1; padding: 11px 14px; border: 1.5px solid #eee; border-radius: 10px; font-size: 13.5px; outline: none; }

.action-btn {
  border: none; border-radius: 10px; padding: 11px 16px;
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.action-btn.primary { background: #f97316; color: #fff; }
.action-btn.secondary { background: #fff; color: #14141f; border: 1.5px solid #eee; }
.action-btn.danger { background: #fef2f2; color: #dc2626; width: 100%; margin-top: 16px; }
.action-btn.small { padding: 7px 12px; font-size: 12px; }
.action-btn.full { width: 100%; }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.list { display: flex; flex-direction: column; gap: 10px; }

.list-item {
  background: #ffffff; border-radius: 14px; padding: 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03); text-decoration: none; color: inherit;
}

.clickable-avatar-zone { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }

.list-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #d4af37); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; flex-shrink: 0; overflow: hidden;
}
.list-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.list-info { flex: 1; min-width: 0; }
.list-name { font-size: 14.5px; font-weight: 700; }
.list-sub { font-size: 12px; color: #9a9a9a; margin-top: 2px; }

.list-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  padding: 3px 8px; border-radius: 100px; background: #fff7ed; color: #c2410c; flex-shrink: 0;
}

.list-empty { text-align: center; color: #b0b0b0; font-size: 13.5px; padding: 30px 0; }
.sub-title { font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: #8a8a8a; margin: 20px 0 10px 0; }

.settings-card { background: #ffffff; border-radius: 16px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.04); }
.settings-photo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.settings-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #d4af37); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; overflow: hidden; flex-shrink: 0;
}
.settings-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.field label:first-child { font-size: 12.5px; font-weight: 700; color: #5a5a63; }
.field input[type="text"] { padding: 11px 14px; border: 1.5px solid #eee; border-radius: 10px; font-size: 14px; outline: none; }
.field:has(.switch) { flex-direction: row; align-items: center; justify-content: space-between; }

.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #e5e5e5; border-radius: 100px; transition: 0.2s; }
.slider::before { content: ""; position: absolute; height: 19px; width: 19px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.2s; }
.switch input:checked + .slider { background: #f97316; }
.switch input:checked + .slider::before { transform: translateX(19px); }

.profile-link { font-size: 12.5px; color: #f97316; font-weight: 700; word-break: break-all; }

.type-toggle { display: flex; background: #f4f4f7; border-radius: 100px; padding: 4px; }
.type-toggle button {
  flex: 1; border: none; background: transparent; padding: 9px;
  font-size: 12.5px; font-weight: 700; color: #8a8a8a; border-radius: 100px; cursor: pointer;
}
.type-toggle button.active { background: #fff; color: #f97316; box-shadow: 0 1px 4px rgba(0,0,0,0.1); }

.form-msg {
  font-size: 12.5px; font-weight: 600; padding: 10px 12px; border-radius: 8px;
  margin-bottom: 4px; display: none;
}
.form-msg.error { display: block; background: #fef2f2; color: #b91c1c; }
.form-msg.success { display: block; background: #f0fdf4; color: #15803d; }

/* ===== Modals ===== */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(20,20,31,0.5);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: #fff;
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

@media (min-width: 500px) {
  .modal-overlay { align-items: center; }
  .modal-box { border-radius: 20px; }
}

@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid #f0f0f0; flex-shrink: 0;
}
.modal-header h2 { font-size: 16px; font-weight: 800; }
.modal-close { border: none; background: transparent; font-size: 22px; color: #9a9a9a; cursor: pointer; line-height: 1; }

.modal-body { padding: 18px; overflow-y: auto; }
.modal-footer { padding: 14px 18px; border-top: 1px solid #f0f0f0; flex-shrink: 0; }

/* Profil dans modal */
.profile-view { text-align: center; }
.profile-view-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #d4af37); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800; margin: 0 auto 14px auto; overflow: hidden;
}
.profile-view-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-view-name { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.profile-view-username { font-size: 13px; color: #8a8a8a; margin-bottom: 16px; }
.profile-view-actions { display: flex; gap: 8px; margin-bottom: 22px; }
.profile-view-actions .action-btn { flex: 1; }

.profile-groups-title { text-align: left; font-size: 12px; font-weight: 800; text-transform: uppercase; color: #8a8a8a; margin-bottom: 10px; }

/* Groupe dans modal */
.group-view-photo {
  width: 100%; height: 130px; border-radius: 14px; object-fit: cover;
  background: linear-gradient(135deg, #f97316, #d4af37); margin-bottom: 14px; display: block;
}
.group-view-name { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.group-view-meta { font-size: 12.5px; color: #8a8a8a; margin-bottom: 16px; }
.group-view-desc { font-size: 13.5px; color: #5a5a63; line-height: 1.5; margin-bottom: 18px; }

/* Notifications */
.notif-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f4f4f2; cursor: pointer; }
.notif-item:last-child { border-bottom: none; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: #f97316; flex-shrink: 0; margin-top: 5px; }
.notif-item.read .notif-dot { background: transparent; }
.notif-title { font-size: 13.5px; font-weight: 700; }
.notif-body { font-size: 12.5px; color: #8a8a8a; margin-top: 2px; }
.notif-time { font-size: 10.5px; color: #b0b0b0; margin-top: 4px; }

/* Toasts */
.toast-container {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 32px); max-width: 380px;
}
.toast {
  padding: 13px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: toastIn 0.2s ease;
}
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast.success { background: #15803d; }
.toast.error { background: #dc2626; }
.toast.info { background: #14141f; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: #ffffff; border-top: 1px solid #f0f0f0; padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: #9a9a9a; font-size: 10.5px; font-weight: 600; }
.nav-item.active { color: #f97316; }

.chat-unread-badge {
  background: #22c55e; color: #fff; font-size: 11px; font-weight: 800;
  min-width: 21px; height: 21px; border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px; flex-shrink: 0;
}
