/* ===== Base variables and theme ===== */
:root {
  --bg: #f7fafc;
  --card: #ffffff;
  --muted: #6b7280;
  --accent: #1e90ff;
  --green: #1f8a3e;
  --danger: #ff4d4f;
  --soft-yellow: #fff5d9;
  --soft-pink: #fff0f0;
  --outline: #e6eef6;
  --radius: 16px;
  --radius-sm: 12px;
  --transition: 0.4s ease;
  font-family: 'Inter', system-ui, sans-serif;
  color: #0f172a;
}

[data-theme='dark'] {
  --bg: #0d1117;
  --card: #161b22;
  --muted: #9ba1a6;
  --accent: #1e90ff;
  --green: #3ddc84;
  --danger: #ff7070;
  --soft-yellow: #2e2610;
  --soft-pink: #2b1b1b;
  --outline: #2a2f35;
  color: #e6edf3;
}

/* ===== Layout ===== */
html, body {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg); /* plain background, no gradient here */
  transition: background var(--transition), color var(--transition);
}

/* remove the dark gradient on body */
[data-theme='dark'] body {
  background: var(--bg);
}

.app {
  max-width: 1100px;
  margin: auto;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  position: relative;
  min-height: 100vh;
  background: linear-gradient(160deg, #f0faff, #f7fbff);
}

[data-theme='dark'] .app {
  background: linear-gradient(160deg, #0b0f13, #11161c);
}


.content-area {
  background: linear-gradient(#fbfdff, #f7fbff 60%);
  transition: background var(--transition);
  flex: 1;
  overflow-y: auto;
  padding: 70px 20px 140px;
  scroll-behavior: smooth;
}

[data-theme='dark'] .content-area {
  background: linear-gradient(#0b0f13, #11161c 70%);
}

/* ===== Header & welcome ===== */
header {
  position: sticky;          /* or fixed (see note below) */
  top: 0;
  z-index: 120;              /* above content, below consent modal (200) */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  margin: 0;
  background: var(--bg);     /* solid background so it doesn't look transparent */
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--outline);
}

#scrollArea {
  height: calc(100vh - 400px) !important;
  overflow-y: auto;     /* ← ALWAYS scrollable */
  padding: 20px 0 140px !important;
  margin: 0 !important;
  box-sizing: border-box;
}

/* Welcome FILLS screen - creates illusion of no scroll */
.welcome {
  background: linear-gradient(180deg, #e6f7ff, #f0fbff);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid rgba(30,144,255,0.1);
  box-shadow: 0 8px 24px rgba(20,40,60,0.08);
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin: 0 !important;
  max-width: 600px;
  min-height: calc(100vh - 420px) !important;  /* ← TALL enough to fill */
  height: auto !important;
  position: relative;
  box-sizing: border-box;
}




.brand {
  font-weight:800;
  font-size:28px;
  background:linear-gradient(90deg,var(--accent),var(--green));
  -webkit-background-clip:text;
  color:transparent;
}
.brand a {
  color: inherit;              /* use same gradient/transparent text */
  text-decoration: none;       /* remove underline and default link color */
}

.brand a:visited {
  color: inherit;              /* prevent purple visited color */
}

.brand a:hover,
.brand a:focus {
  text-decoration: underline;  /* optional: small underline on hover */
  cursor: pointer;
}


.subtitle {
  font-size:13px;
  color:var(--muted);
  margin-top:4px;
}

.right-controls {
  display:flex;
  gap:10px;
  align-items:center;
}

.lang {
  border:1px solid var(--outline);
  padding:10px 14px;
  border-radius:12px;
  background:var(--card);
  font-size:13px;
  box-shadow:0 4px 10px rgba(0,0,0,0.03);
  color: var(--color);  /* ← Use theme color */
  cursor: pointer;
  transition: all 0.3s ease;
}

.lang:hover {
  background: var(--outline);
  transform: translateY(-1px);
}

[data-theme='dark'] .lang {
  color: #e6edf3;  /* ← Bright white text for dark mode */
  border-color: #30363d;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}


.welcome {
  background: linear-gradient(180deg, #e6f7ff, #f0fbff);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid rgba(30,144,255,0.1);
  box-shadow: 0 8px 24px rgba(20,40,60,0.08);
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin: 0 !important;                    /* ← NO margins */
  max-width: 600px;
  height: 100% !important;                 /* ← FILL ALL scrollArea */
  position: relative;                      /* ← For JS conversion */
  box-sizing: border-box;                  /* ← Include padding in height */
}




[data-theme='dark'] .welcome {
  height: 100% !important;
  background: linear-gradient(180deg, #171c23, #11161c);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  margin: 0 auto 40px !important;
  max-width: 600px;
  min-height: calc(100vh - 420px) !important;
  position: relative;
}



.welcome .left-icon {
  width:60px;
  height:60px;
  border-radius:999px;
  background:linear-gradient(135deg,#d0f0ff,#a0dfff);
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--accent);
  font-size:28px;
  border:1px solid rgba(30,144,255,0.08);
}

[data-theme='dark'] .welcome .left-icon {
  background:linear-gradient(135deg,#202a33,#11161c);
  color:#5da8ff;
}

.welcome h1 {
  color:var(--accent);
  margin:0 0 8px 0;
  font-size:26px;
}

.welcome p {
  margin:0;
  color:#1666c8;
  font-weight:500;
  font-size:15px;
}

[data-theme='dark'] .welcome p {
  color:#80b3ff;
}

.features {
  margin-top:12px;
  padding-left:0;
}

.features li {
  list-style:none;
  margin:8px 0;
  color:#1666c8;
  font-weight:500;
  position:relative;
  padding-left:22px;
}

.features li:before {
  content:'✓';
  position:absolute;
  left:0;
  color:#2fa84f;
  font-weight:700;
}

[data-theme='dark'] .features li {
  color:#80b3ff;
}

[data-theme='dark'] .features li:before {
  color:#3ddc84;
}

.disclaimer {
  margin-top:18px;
  background:var(--soft-yellow);
  padding:14px;
  border-radius:12px;
  border:1px solid rgba(255,170,36,0.12);
  color:#b25a00;
  font-size:13px;
}

[data-theme='dark'] .disclaimer {
  color:#ffd580;
  background:#2e2610;
  border-color:#5e4a1b;
}

/* ===== Prompt area ===== */
.prompt-area {
  position:fixed;
  bottom:0;
  left:0;
  right:0;
  background:rgba(255,255,255,0.95);
  backdrop-filter:blur(10px);
  border-top:1px solid #e6eef6;
  padding:16px 20px 20px;
  box-shadow:0 -6px 24px rgba(10,40,90,0.05);
  display:flex;
  flex-direction:column;
  align-items:center;
  z-index:100;
}

.prompt-safety-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  max-width: 700px;
}


[data-theme='dark'] .prompt-area {
  background:rgba(22,27,34,0.95);
  border-top:1px solid #2a2f35;
  box-shadow:0 -6px 24px rgba(0,0,0,0.4);
}

.input {
  background:var(--card);
  border-radius:999px;
  padding:12px 16px;
  border:1px solid rgba(14,165,233,0.1);
  box-shadow:0 6px 16px rgba(13,65,120,0.04);
  display:flex;
  gap:12px;
  align-items:center;
  width:100%;
  max-width:700px;
}

[data-theme='dark'] .input {
  background:#161b22;
  border:1px solid #30363d;
  box-shadow:0 6px 16px rgba(0,0,0,0.4);
}

.input input {
  flex:1;
  border:0;
  outline:0;
  font-size:15px;
  color:#0b1220;
  background:transparent;
}

[data-theme='dark'] .input input {
  color:#e6edf3;
}

.input button {
  background:var(--accent);
  color:white;
  border:0;
  padding:10px 18px;
  border-radius:999px;
  font-weight:700;
  cursor:pointer;
}

.chips {
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
  max-width:700px;
  margin-top:10px;        /* new: space below input */
  margin-bottom:8px;      /* was 12px, slightly tighter */
}


.chip {
  background: linear-gradient(120deg,#e0f7ff,#f0fbff);
  border: 1px solid #a0dfff;
  padding: 8px 14px;
  border-radius: 18px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;              /* <─ important */
}

.chip:hover {
  transform: translateY(-2px) scale(1.05);  /* <─ hover movement */
  box-shadow: 0 6px 16px rgba(0,140,255,0.2);
}


[data-theme='dark'] .chip {
  background:linear-gradient(120deg,#132a3b,#161b22);
  border:1px solid #2a2f35;
  color:#c9d1d9;
}

/* ===== Chat result styles ===== */
.result {
  margin-top:26px;
  display:flex;
  flex-direction:column;
  gap:26px;
}

.chat-block {
  display:flex;
  flex-direction:column;
  gap:12px;
}

.user-msg {
  align-self:flex-end;
  background:var(--accent);
  color:white;
  padding:10px 16px;
  border-radius:14px 14px 2px 14px;
  max-width:70%;
  word-wrap:break-word;
  font-weight:500;
}

.bot-response {
  background:var(--card);
  border-radius:16px;
  padding:18px;
  border:1px solid #eef6f0;
}

[data-theme='dark'] .bot-response {
  border:1px solid #2a2f35;
}

.condition {
  background:#ecfff2;
  border-radius:12px;
  padding:18px;
  border:1px solid rgba(31,138,62,0.08);
}

[data-theme='dark'] .condition {
  background:#132b1f;
  border:1px solid #1f3d2e;
}

.condition h3 {
  margin:0;
  color:var(--green);
  font-size:20px;
}

.confidence {
  color:#166a3e;
  margin-top:8px;
}

[data-theme='dark'] .confidence {
  color:#3ddc84;
}

/* Remedies grid */
.remedies {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
  margin-top:14px;
}

.remedy {
  border-radius:14px;
  padding:16px 18px;
  background:linear-gradient(180deg,#f5fff7,#ffffff);
  border:1px solid rgba(31,138,62,0.12);
  color:#1f8a3e;
  font-weight:600;
  font-size:16px;
  display:flex;
  align-items:center;
}

[data-theme='dark'] .remedy {
  background:linear-gradient(180deg,#161b22,#11161c);
  border:1px solid #2a2f35;
  color:#3ddc84;
}

/* Diet */
.diet {
  display:flex;
  gap:14px;
  margin-top:14px;
}

.diet .include,
.diet .avoid {
  flex:1;
  border-radius:14px;
  padding:14px;
  border:2px solid rgba(31,138,62,0.12);
  background:#f6fff7;
}

[data-theme='dark'] .diet .include {
  background:#132b1f;
  border-color:#1f3d2e;
}

.diet .avoid {
  border:2px solid rgba(255,77,79,0.08);
  background:var(--soft-pink);
}

[data-theme='dark'] .diet .avoid {
  background:#2b1b1b;
  border:2px solid #4a2b2b;
}

.diet h4 {
  margin:0;
  color:var(--green);
}

.diet .avoid h4 {
  color:var(--danger);
}

/* Danger box */
.danger-box {
  margin-top:18px;
  padding:18px;
  border-radius:14px;
  background:var(--soft-yellow);
  border:1px solid rgba(255,180,60,0.08);
  color:#9d5a00;
  font-size:14px;
}

[data-theme='dark'] .danger-box {
  background:#2e2610;
  color:#ffb84d;
  border:1px solid #5e4a1b;
}

.danger-box h4 {
  margin:0 0 8px 0;
  color:#b25a00;
}

[data-theme='dark'] .danger-box h4 {
  color:#ffb84d;
}

/* Sidebar */
/* Hover animation for menu icon */
.menu-icon {
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease;   /* <─ needed for animation */
  margin-right: 15px;
}

.menu-icon:hover {
  transform: scale(1.1);             /* <─ hover effect */
}

/* Each line in the icon */
.menu-icon-line {
  width: 100%;
  height: 3px;
  margin: 2.5px 0;
  border-radius: 2px;
  transition: all 0.3s ease;         /* smooth glow on hover */
}

.menu-icon-top {
  background: linear-gradient(90deg, #ffb347, #ffcc33);
  box-shadow: 0 0 5px rgba(255, 179, 71, 0.8);
}

.menu-icon-bottom {
  background: linear-gradient(90deg, #ff7f50, #ff4500);
  box-shadow: 0 0 5px rgba(255, 99, 71, 0.8);
}


.sidebar {
  height:100%;
  width:0;
  position:fixed;
  z-index:130;
  top:0;
  left:0;
  background-color:var(--card);
  overflow-x:hidden;
  transition:width 0.3s ease-in-out;
  padding-top:80px;
  box-shadow:2px 0 10px rgba(0,0,0,0.3);
  display:flex;
  flex-direction:column;
}

.sidebar.open {
  width:250px;
}

.sidebar a {
  padding:15px 25px;
  text-decoration:none;
  font-size:16px;
  color:var(--color);
  display:block;
  font-weight:500;
  border-bottom:1px solid var(--outline);
}

.sidebar a:hover {
  background-color:var(--outline);
  color:var(--accent);
}


.sidebar .closebtn {
  position:absolute;
  top:20;
  right:25px;
  font-size:36px;
  margin-left:50px;
  font-weight:300;
  color:var(--muted);
}

/* Overlay */
.overlay {
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background:rgba(0,0,0,0.5);
  z-index:100;
  display:none;
}

.overlay.visible {
  display:block;
}

/* Consent modal */
.consent-modal-overlay {
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.7);
  z-index:200;
  display:flex;
  align-items:center;
  justify-content:center;
}

.consent-modal-content {
  background:var(--card);
  border-radius:var(--radius);
  box-shadow:0 10px 25px rgba(0,0,0,0.5);
  width:90%;
  max-width:600px;
  max-height:90vh;
  display:flex;
  flex-direction:column;
  padding:30px;
  border:1px solid var(--outline);
}

.consent-scroll-area {
  flex-grow:1;
  overflow-y:auto;
  padding-right:15px;
  margin-bottom:20px;
  font-size:14px;
  line-height:1.6;
  color:var(--muted);
}

.consent-header {
  font-size:24px;
  font-weight:800;
  color:var(--danger);
  margin-bottom:15px;
  border-bottom:2px solid var(--soft-pink);
  padding-bottom:10px;
}

.consent-footer {
  padding-top:15px;
  border-top:1px solid var(--outline);
}

.consent-checkbox-label {
  display:flex;
  align-items:center;
  cursor:pointer;
  margin-bottom:15px;
  font-size:14px;
}

.consent-checkbox-label input {
  margin-right:10px;
  width:18px;
  height:18px;
  accent-color:var(--danger);
}

.consent-button {
  width:100%;
  padding:12px;
  border:none;
  border-radius:var(--radius-sm);
  font-weight:700;
}

.consent-button:not([disabled]) {
  background:var(--accent);
  color:white;
}

.consent-button[disabled] {
  background:#9ca3af;
  cursor:not-allowed;
  color:#e5e7eb;
}

/* Notification toast */
.notification-box {
  position:fixed;
  top:20px;
  left:50%;
  transform:translateX(-50%);
  background:var(--soft-yellow);
  color:#b25a00;
  padding:12px 20px;
  border-radius:var(--radius-sm);
  border:1px solid rgba(255,170,36,0.2);
  font-weight:600;
  z-index:150;
  opacity:0;
  pointer-events:none;
}

[data-theme='dark'] .notification-box {
  background:#2e2610;
  color:#ffd580;
  border-color:#5e4a1b;
}

.notification-box.visible {
  opacity:1;
}

/* Profile page */
.profile-settings {
  background:var(--card);
  border-radius:var(--radius);
  padding:30px;
  margin:20px auto 0;
  max-width:600px;
  box-shadow:0 4px 15px rgba(0,0,0,0.05);
  border:1px solid var(--outline);
}

.profile-settings h2 {
  color:var(--accent);
  border-bottom:2px solid var(--outline);
  padding-bottom:10px;
  margin-bottom:20px;
  font-size:24px;
}

.profile-group {
  margin-bottom:25px;
  padding:15px;
  border:1px dashed var(--outline);
  border-radius:var(--radius-sm);
}

.profile-group label {
  display:block;
  font-weight:600;
  margin-bottom:8px;
  font-size:15px;
}

.profile-group input[type="text"],
.profile-group input[type="date"],
.profile-group select {
  width:100%;
  padding:12px;
  border:1px solid var(--outline);
  border-radius:8px;
  box-sizing:border-box;
  background:var(--bg);
}

[data-theme='dark'] .profile-group input[type="text"],
[data-theme='dark'] .profile-group input[type="date"],
[data-theme='dark'] .profile-group select {
  color: #e6edf3;
  background: #161b22;
  border-color: #30363d;
}


.profile-pic-area {
  display:flex;
  align-items:center;
  gap:20px;
  margin-bottom:20px;
}

.profile-pic-preview {
  width:100px;
  height:100px;
  background:var(--outline);
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:30px;
  color:var(--muted);
  border:3px solid var(--accent);
  overflow:hidden;
  flex-shrink:0;
}

.profile-pic-preview img {
  width:100%;
  height:100%;
  object-fit:cover;
}

.profile-group button {
  background:var(--accent);
  color:white;
  border:none;
  padding:10px 20px;
  border-radius:8px;
  cursor:pointer;
  font-weight:600;
}

/* Mobile header & layout tweaks */
@media (max-width: 768px) {
  html, body {
    height: 100%;
  }

  header {
    padding-top: 18px;
    padding-bottom: 10px;
  }

  .content-area {
    padding-top: 80px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .app {
    width: 100%;
  }
}

/* Responsive */
@media(max-width:900px){
  .welcome{flex-direction:column;}
  .remedies{grid-template-columns:1fr;}
  .diet{flex-direction:column;}
}

@media (max-width: 768px) {
  header {
    /* distance from top of screen, including notch/status bar */
    padding-top: calc(24px + env(safe-area-inset-top, 0px));
    padding-bottom: 12px;
  }

  .content-area {
    /* space between header and chat content */
    padding-top: 40px;
    padding-bottom: calc(260px + env(safe-area-inset-bottom, 0px));
  }

  .prompt-area {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 16px));
  }
}

@media (max-width: 768px) {
  .profile-settings {
    margin: 12px auto 40px;   /* smaller top, controlled bottom */
    padding: 20px;            /* less internal padding */
  }
}




@media (max-width:768px) {
  .sidebar.open{width:100%;}
}

/* ===== SCROLL FIXES (NEW) ===== */
.chat-block {
  margin-bottom: 40px;  /* ← bigger gap */
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

.chat-block:last-child {
  margin-bottom: 130px;  /* ← Just enough to clear input bar */
}

@keyframes fadeIn {
  to { opacity: 1; }
}


