/* ============================================
   Protect Your Grandparents — Main Stylesheet
   Senior-friendly: large text, high contrast,
   simple layout, big tap targets
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 20px; /* Larger base for seniors */
  scroll-behavior: smooth;
}

body {
  font-family: Georgia, 'Times New Roman', serif;
  background-color: #f5f7fa;
  color: #1a1a2e;
  line-height: 1.7;
  min-height: 100vh;
}

/* --- Typography --- */
h1 { font-size: 2.4rem; line-height: 1.2; }
h2 { font-size: 1.8rem; line-height: 1.3; }
h3 { font-size: 1.4rem; }
p  { font-size: 1.1rem; margin-bottom: 1rem; }

a {
  color: #1a5fa8;
  text-decoration: underline;
}
a:hover { color: #0d3d6e; }

/* --- Layout Utilities --- */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }

/* --- Header / Nav --- */
.site-header {
  background-color: #1a3a5c;
  color: #ffffff;
  padding: 1.2rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: #ffffff;
}

.logo-icon {
  font-size: 2rem;
}

.logo-text {
  font-size: 1.3rem;
  font-weight: bold;
  color: #ffffff;
  line-height: 1.1;
}

.logo-text small {
  display: block;
  font-size: 0.7rem;
  font-weight: normal;
  color: #a8c8f0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.site-nav a {
  color: #a8c8f0;
  text-decoration: none;
  font-size: 1rem;
  margin-left: 1.5rem;
  transition: color 0.2s;
}
.site-nav a:hover { color: #ffffff; }

/* --- Hero Section (Homepage) --- */
.hero {
  background: linear-gradient(135deg, #1a3a5c 0%, #1a5fa8 100%);
  color: #ffffff;
  padding: 4rem 0 3rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.6rem;
  margin-bottom: 1rem;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.hero .tagline {
  font-size: 1.3rem;
  color: #a8d8f0;
  margin-bottom: 2rem;
  font-style: italic;
}

.hero .subtitle {
  font-size: 1.15rem;
  max-width: 600px;
  margin: 0 auto 2.5rem;
  color: #d8ecff;
  line-height: 1.8;
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 1rem 2.5rem;
  font-size: 1.2rem;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s, transform 0.1s;
  font-weight: bold;
  letter-spacing: 0.02em;
  min-width: 220px;
  text-align: center;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background-color: #e8a020;
  color: #1a1a1a;
}
.btn-primary:hover { background-color: #d08c10; color: #1a1a1a; }

.btn-secondary {
  background-color: #ffffff;
  color: #1a3a5c;
  border: 2px solid #1a3a5c;
}
.btn-secondary:hover { background-color: #e8f0fa; }

.btn-danger {
  background-color: #c0392b;
  color: #ffffff;
}
.btn-danger:hover { background-color: #a93226; color: #ffffff; }

.btn-large {
  font-size: 1.35rem;
  padding: 1.2rem 3rem;
}

/* --- How It Works Section --- */
.section {
  padding: 3rem 0;
}

.section-alt {
  background-color: #eaf1fb;
}

.section h2 {
  color: #1a3a5c;
  margin-bottom: 1.5rem;
  text-align: center;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.step-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  border-top: 4px solid #1a5fa8;
}

.step-icon {
  font-size: 2.8rem;
  margin-bottom: 1rem;
}

.step-card h3 {
  color: #1a3a5c;
  margin-bottom: 0.75rem;
}

.step-card p {
  font-size: 1rem;
  color: #444;
}

/* --- What We Check Section --- */
.check-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.check-list li {
  background: #ffffff;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  font-size: 1.05rem;
}

.check-list li::before {
  content: "✓";
  color: #1a7a3c;
  font-size: 1.3rem;
  font-weight: bold;
  flex-shrink: 0;
}

/* --- Disclaimer Banner --- */
.disclaimer {
  background-color: #fff8e1;
  border-left: 5px solid #e8a020;
  padding: 1.25rem 1.5rem;
  border-radius: 0 8px 8px 0;
  margin: 2rem 0;
  font-size: 0.95rem;
  color: #5a4000;
  line-height: 1.6;
}

.disclaimer strong {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 1rem;
}

/* --- Footer --- */
.site-footer {
  background-color: #1a3a5c;
  color: #a8c8f0;
  text-align: center;
  padding: 2rem 0;
  font-size: 0.9rem;
  margin-top: 3rem;
}

.site-footer a {
  color: #a8c8f0;
}

/* ============================================
   CHAT PAGE STYLES
   ============================================ */

/* --- Name Gate Screen --- */
.name-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a3a5c 0%, #1a5fa8 100%);
  padding: 2rem;
}

.name-gate-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 3rem 2.5rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.name-gate-card .logo-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 1rem;
}

.name-gate-card h1 {
  font-size: 1.9rem;
  color: #1a3a5c;
  margin-bottom: 0.5rem;
}

.name-gate-card p {
  color: #555;
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.name-gate-card label {
  display: block;
  text-align: left;
  font-size: 1.1rem;
  color: #1a3a5c;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.name-gate-card input[type="text"] {
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 1.2rem;
  border: 2px solid #ccd8e8;
  border-radius: 8px;
  font-family: inherit;
  color: #1a1a2e;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s;
}

.name-gate-card input[type="text"]:focus {
  outline: none;
  border-color: #1a5fa8;
  box-shadow: 0 0 0 3px rgba(26, 95, 168, 0.15);
}

.name-gate-card .btn {
  width: 100%;
}

.error-msg {
  color: #c0392b;
  font-size: 0.95rem;
  margin-top: -1rem;
  margin-bottom: 1rem;
  display: none;
}

/* --- Chat Interface --- */
.chat-page {
  display: none; /* Hidden until name entered */
  flex-direction: column;
  min-height: 100vh;
}

.chat-page.active {
  display: flex;
}

.chat-header {
  background-color: #1a3a5c;
  color: #ffffff;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-header-icon { font-size: 1.8rem; }

.chat-header h1 {
  font-size: 1.3rem;
  margin: 0;
}

.chat-header .welcome-name {
  font-size: 0.95rem;
  color: #a8c8f0;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

/* --- Messages --- */
.message {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: fadeIn 0.3s ease;
}

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

.message.user {
  align-self: flex-end;
}

.message.bot {
  align-self: flex-start;
}

.message-bubble {
  padding: 1rem 1.25rem;
  border-radius: 16px;
  font-size: 1.05rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.message.user .message-bubble {
  background-color: #1a5fa8;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.message.bot .message-bubble {
  background-color: #ffffff;
  color: #1a1a2e;
  border: 1px solid #dde5f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.message-label {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.25rem;
  padding: 0 0.25rem;
}

.message.user .message-label { text-align: right; }

/* --- Risk Level Badges --- */
.risk-badge {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.risk-low    { background-color: #d4edda; color: #1a5c2e; border: 1px solid #a3d5b0; }
.risk-medium { background-color: #fff3cd; color: #7a5200; border: 1px solid #ffd97a; }
.risk-high   { background-color: #f8d7da; color: #7a1a1a; border: 1px solid #f5b8bc; }

/* --- High Risk Warning Box --- */
.warning-box {
  background-color: #fdecea;
  border: 2px solid #c0392b;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-top: 0.75rem;
  font-size: 1rem;
  color: #7a1a1a;
  font-weight: bold;
}

.warning-box::before {
  content: "⚠️ ";
}

/* --- Typing Indicator --- */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.8rem 1.2rem;
  background: #ffffff;
  border: 1px solid #dde5f0;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.typing-dot {
  width: 10px;
  height: 10px;
  background-color: #1a5fa8;
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* --- Chat Input Bar --- */
.chat-input-bar {
  background-color: #ffffff;
  border-top: 2px solid #dde5f0;
  padding: 1rem 1.5rem;
  position: sticky;
  bottom: 0;
}

.chat-input-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.chat-input-bar textarea {
  flex: 1;
  padding: 0.85rem 1rem;
  font-size: 1.1rem;
  font-family: inherit;
  border: 2px solid #ccd8e8;
  border-radius: 10px;
  resize: none;
  min-height: 56px;
  max-height: 160px;
  line-height: 1.5;
  color: #1a1a2e;
  transition: border-color 0.2s;
}

.chat-input-bar textarea:focus {
  outline: none;
  border-color: #1a5fa8;
  box-shadow: 0 0 0 3px rgba(26, 95, 168, 0.12);
}

.chat-input-bar textarea::placeholder {
  color: #aaa;
}

.send-btn {
  background-color: #1a5fa8;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0.85rem 1.4rem;
  font-size: 1.3rem;
  cursor: pointer;
  transition: background-color 0.2s;
  flex-shrink: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-btn:hover { background-color: #1a3a5c; }
.send-btn:disabled { background-color: #99b5d6; cursor: not-allowed; }

.input-hint {
  font-size: 0.85rem;
  color: #888;
  text-align: center;
  margin-top: 0.5rem;
}

/* --- Disclaimer on chat page --- */
.chat-disclaimer {
  font-size: 0.82rem;
  color: #888;
  text-align: center;
  padding: 0.5rem 1rem;
  border-top: 1px solid #eee;
  background: #fafafa;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  html { font-size: 18px; }
  h1 { font-size: 1.9rem; }
  .hero h1 { font-size: 2rem; }
  .name-gate-card { padding: 2rem 1.5rem; }
  .btn-large { font-size: 1.15rem; padding: 1rem 2rem; }
}
