@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Nunito:wght@400;500;600;700;800;900&display=swap');

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Nunito', sans-serif;
  background: #F0F4F5;
  color: #1C2B30;
  -webkit-font-smoothing: antialiased;
}

/* ── Design Tokens ── */
:root {
  --nestor-deep:    #1B4F5C;
  --nestor-primary: #2E8B9A;
  --nestor-warm:    #E07A3E;
  --nestor-sage:    #7BAE9F;
  --nestor-amber:   #F5C842;
  --surface:        #FAFAF7;
  --background:     #F0F4F5;
  --border:         #E4EBEE;
  --text:           #1C2B30;
  --text-muted:     #4A6670;
  --danger:         #C04040;
  --danger-bg:      #FEE8E8;
  --success-bg:     #EAF4F0;
  --amber-bg:       #FFFBF0;
}

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulseDot {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* ══════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════ */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1B4F5C 0%, #0F2E37 100%);
  padding: 32px 16px;
}

.login__card {
  background: white;
  border-radius: 24px;
  padding: 48px 44px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 60px rgba(15, 46, 55, 0.28);
  animation: fadeUp 0.5s ease both;
}

.login__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
}

.login__logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(140deg, #2E8B9A 0%, #1B4F5C 100%);
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(46, 139, 154, 0.32);
}

.login__logo-name {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  color: #1B4F5C;
  letter-spacing: -0.3px;
}

.login__logo-sub {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.login__heading {
  font-family: 'DM Serif Display', serif;
  font-size: 26px;
  color: var(--nestor-deep);
  margin-bottom: 8px;
}

.login__sub {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 32px;
  line-height: 1.6;
}

.login__error {
  background: var(--danger-bg);
  border-left: 4px solid var(--danger);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 20px;
}

.login__field {
  margin-bottom: 18px;
}

.login__field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 7px;
  letter-spacing: 0.2px;
}

.login__field input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.login__field input:focus {
  border-color: var(--nestor-primary);
  box-shadow: 0 0 0 3px rgba(46, 139, 154, 0.15);
}

.login__field input::placeholder {
  color: #B8C4C8;
}

.login__submit {
  width: 100%;
  padding: 14px 28px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #2E8B9A 0%, #1B4F5C 100%);
  color: white;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 4px 14px rgba(27, 79, 92, 0.28);
  transition: box-shadow 0.2s, transform 0.15s;
}

.login__submit:hover {
  box-shadow: 0 6px 20px rgba(27, 79, 92, 0.38);
  transform: translateY(-1px);
}

.login__submit:focus {
  outline: 3px solid var(--nestor-primary);
  outline-offset: 3px;
}

/* ══════════════════════════════════════════
   AIDANT DASHBOARD LAYOUT
══════════════════════════════════════════ */
.aidant-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #1B4F5C 0%, #143E49 100%);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar__logo {
  padding: 22px 20px 0;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.sidebar__logo-icon {
  width: 34px;
  height: 34px;
  background: rgba(46, 139, 154, 0.4);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar__logo-name {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: white;
  line-height: 1;
  letter-spacing: -0.3px;
}

.sidebar__logo-sub {
  font-size: 10.5px;
  color: rgba(255,255,255,0.38);
  font-weight: 600;
  letter-spacing: 0.4px;
}

.sidebar__label {
  padding: 0 20px;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 800;
  color: rgba(255,255,255,0.32);
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.sidebar__nav {
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__nav-item {
  border-radius: 12px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.sidebar__nav-item:hover {
  background: rgba(255,255,255,0.07);
}

.sidebar__nav-item--active {
  background: rgba(255,255,255,0.1);
}

.sidebar__nav-item span {
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
}

.sidebar__nav-item--active span {
  font-weight: 700;
  color: white;
}

.sidebar__sync {
  margin: 12px 10px;
  background: rgba(123,174,159,0.15);
  border-radius: 14px;
  padding: 13px 15px;
  border: 1px solid rgba(123,174,159,0.25);
}

.sidebar__sync-dot {
  width: 8px;
  height: 8px;
  background: var(--nestor-sage);
  border-radius: 50%;
  animation: pulseDot 2s infinite;
}

.sidebar__sync-title {
  font-size: 11.5px;
  font-weight: 800;
  color: white;
}

.sidebar__sync-sub {
  font-size: 10.5px;
  color: rgba(255,255,255,0.45);
  font-weight: 500;
  margin-top: 4px;
}

.sidebar__user {
  margin: 0 10px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar__user-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #2E8B9A, #1B4F5C);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Serif Display', serif;
  font-size: 12px;
  color: white;
  flex-shrink: 0;
}

.sidebar__user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-role {
  font-size: 10.5px;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
}

.sidebar__spacer { flex: 1; }

/* ── Main content area ── */
.aidant-main {
  flex: 1;
  overflow-y: auto;
  background: #EEF3F5;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Top bar ── */
.topbar {
  background: white;
  padding: 0 26px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__greeting {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}

.topbar__date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

/* ── Dashboard content ── */
.dashboard-content {
  padding: 22px 26px;
  flex: 1;
  animation: fadeUp 0.4s ease both;
}

/* ── Profile summary card ── */
.profile-card {
  background: white;
  border-radius: 20px;
  padding: 18px 22px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.profile-card__avatar {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #E07A3E, #C05E20);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Serif Display', serif;
  font-size: 17px;
  color: white;
  flex-shrink: 0;
}

.profile-card__name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

.profile-card__meta {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.profile-card__mood {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F5FBF3;
  border: 1.5px solid #C4DED7;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #2A7060;
  margin-left: auto;
}

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: white;
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--border);
}

.stat-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.stat-card__icon--meds  { background: #EAF4F0; }
.stat-card__icon--appt  { background: #FFF5EC; }
.stat-card__icon--loc   { background: #E4F2F5; }
.stat-card__icon--alert { background: #F5FBF3; }

.stat-card__badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.badge--meds  { color: #7BAE9F; background: #EAF4F0; }
.badge--appt  { color: #C05E20; background: #FFF5EC; }
.badge--loc   { color: #2E8B9A; background: #E4F2F5; }
.badge--alert { color: #2A7060; background: #F5FBF3; }
.badge--warn  { color: #C04040; background: #FEE8E8; }

.stat-card__value {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  margin-bottom: 3px;
}

.stat-card__value--sm {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
}

.stat-card__label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ── Two-column layout ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
}

/* ── Panel card ── */
.panel {
  background: white;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--border);
}

.panel__title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
}

.panel__title--sm {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 14px;
}

/* ── Activity feed items ── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 13px;
  margin-bottom: 4px;
}

.activity-item--ok     { background: #F5FBF7; }
.activity-item--warn   { background: #FFFBF4; border: 1px solid #FDECC6; }
.activity-item--alert  { background: #FFF5F5; border: 1px solid #FDDCDC; }

.activity-item__icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.activity-item__icon--ok     { background: #EAF4F0; }
.activity-item__icon--warn   { background: #FFF5E0; }
.activity-item__icon--blue   { background: #E4F2F5; }
.activity-item__icon--purple { background: #F3EFF8; }
.activity-item__icon--alert  { background: #FEE8E8; }

.activity-item__title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.activity-item__sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.activity-item__time {
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.time--ok    { color: #7BAE9F; }
.time--warn  { color: #C05E20; }
.time--blue  { color: #2E8B9A; }
.time--muted { color: var(--text-muted); }
.time--alert { color: var(--danger); }

/* ── Medication list ── */
.med-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--background);
}

.med-item:last-child { border-bottom: none; }

.med-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.med-dot--ok     { background: var(--nestor-sage); }
.med-dot--warn   { background: var(--nestor-amber); animation: pulseDot 1.8s infinite; }
.med-dot--future { background: #D0D8DA; }

.med-name { font-size: 12.5px; font-weight: 700; color: var(--text); }
.med-time { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* ── Appointment cards ── */
.appt-card {
  border-radius: 13px;
  padding: 13px 15px;
  margin-bottom: 9px;
}

.appt-card:last-child { margin-bottom: 0; }
.appt-card--warm { background: #FFF5EC; border: 1.5px solid #FDDCC8; }
.appt-card--blue { background: #F0F8FA; border: 1.5px solid #D4E8ED; }

.appt-card__header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 5px;
}

.appt-card__title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
  flex: 1;
}

.appt-card__badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.appt-badge--tomorrow { color: #C05E20; background: #FDDCC8; }
.appt-badge--future   { color: #2E8B9A; background: #D4E8ED; }

.appt-card__detail {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Warning banner (HDS unavailable) ── */
.hds-warning {
  background: #FFFBF0;
  border-left: 4px solid var(--nestor-amber);
  border-radius: 12px;
  padding: 13px 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: #B8933A;
}

/* ── Loading / Error states ── */
.dashboard-loading,
.dashboard-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 12px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
}

.dashboard-loading::before {
  content: '';
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--nestor-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.dashboard-error h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 24px;
  color: var(--nestor-deep);
  margin-bottom: 8px;
}

/* ── Taches (tasks) ── */
.tache-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 6px;
  background: var(--background);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.tache-item--en-retard {
  background: var(--danger-bg);
  color: var(--danger);
}

.tache-item time {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.tache-item--en-retard time {
  color: var(--danger);
}

/* ── Utility ── */
.text-muted { color: var(--text-muted); font-size: 13px; font-weight: 500; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.flex-1 { flex: 1; }
