/* =========
   Base
   ========= */

:root {
  --color-blue: #99B7C6;
  --color-lavender: #978EC4;
  --color-cream: #F9F5EA;
  --color-light-pink: #FFD8D1;
  --color-pink: #F9AFB1;
  --color-sage: #9AB59D;
  --color-charcoal: #3A3F3B;
  --color-peach: #F4B092;
  --color-raspberry: #CE325B;

  --radius-card: 16px;
  --radius-pill: 999px;

  --shadow-soft: 0 8px 20px rgba(0,0,0,0.06);
  --shadow-strong: 0 18px 45px rgba(0,0,0,0.18);
  --transition-fast: 0.2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Montserrat", sans-serif;
  background-color: var(--color-cream);
  color: var(--color-charcoal);
}

/* Global links */

a {
  color: var(--color-raspberry);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-peach);
}

/* Headings */

h1, h2, h3 {
  font-family: "DM Serif Display", Georgia, "Times New Roman", serif;
  color: var(--color-charcoal);
  margin-top: 0;
}

/* =========
   Layout
   ========= */

.layout {
  min-height: 100vh;
  display: flex;
  background: radial-gradient(circle at top left, var(--color-light-pink), var(--color-cream));
}

/* Sidebar */

.sidebar {
  width: 300px;
  padding: 24px 20px;
  background-color: var(--color-charcoal);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.sidebar .brand-logo {
  max-width: 240px;
  height: auto;
}

.sidebar h2 {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  margin: 0;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
  gap: 6px;
}

.sidebar nav a {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.95rem;
  color: #f9f5ea;
  background-color: transparent;
}

.sidebar nav a:hover {
  background-color: rgba(249, 175, 177, 0.2);
}

.sidebar nav a.active {
  background-color: var(--color-sage);
  color: var(--color-charcoal);
  font-weight: 600;
}

.sidebar hr {
  border: none;
  border-top: 1px solid rgba(249, 245, 234, 0.2);
  margin: 12px 0;
}

/* Main content */

.main,
.main-content {
  flex: 1;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Top header in dashboard */

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-header h1 {
  font-size: 26px;
}

.user-info {
  font-size: 0.95rem;
  color: var(--color-charcoal);
}

.user-bar {
  position: fixed;
  top: 12px;
  right: 20px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.user-chip {
  background: #ffffff;
  border: 1px solid rgba(58, 63, 59, 0.15);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  box-shadow: var(--shadow-soft);
  color: var(--color-charcoal);
}

.secondary-btn {
  background-color: var(--color-sage);
  color: var(--color-charcoal);
}

.secondary-btn:hover {
  background-color: var(--color-peach);
  color: var(--color-charcoal);
}

/* =========
   Cards & Sections
   ========= */

.page-card {
  max-width: 960px;
  margin: 40px auto;
  background-color: var(--color-cream);
  border-radius: var(--radius-card);
  padding: 32px 28px;
  box-shadow: var(--shadow-soft);
}

.page-card.narrow {
  max-width: 520px;
}

.hero {
  text-align: center;
}

.hero h1 {
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.hero p {
  font-size: 1rem;
  line-height: 1.5;
}

.pill-links {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.pill-links a {
  padding: 8px 18px;
  background-color: var(--color-pink);
  color: var(--color-charcoal);
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-soft);
}

.pill-links a:hover {
  background-color: var(--color-peach);
}

/* Landing page refresh */

/* Generic cards / panels */

.card {
  background-color: #ffffff;
  border-radius: var(--radius-card);
  padding: 18px 20px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.section {
  margin-top: 20px;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.tableau-card {
  min-height: 700px; /* taller white container */
}

.tableau-card.tall {
  min-height: 750px; /* extra height for the lower viz */
}

.tableau-card .tableau-embed {
  flex: 1 1 auto;
}

.summary-card {
  background-color: #ffffff;
  border-radius: var(--radius-card);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(58, 63, 59, 0.08);
}

.summary-label {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(58,63,59,0.8);
}

.summary-value {
  margin: 6px 0 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-charcoal);
}

/* KPI cards */

.kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.kpi-card {
  flex: 1 1 220px;
  background-color: #ffffff;
  border-radius: var(--radius-card);
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.kpi-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-raspberry);
}

.kpi-value h1 {
  font-size: 2.6rem;
  margin: 0;
  line-height: 1.1;
}

/* Grid layout helpers */

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Tableau embeds */
.tableau-embed {
  width: 100% !important;
  position: relative;
  aspect-ratio: 20 / 10; /* shorter default embed */
  min-height: 260px;
}

.tableau-embed.tall {
  aspect-ratio: auto;
  height: clamp(360px, 70vh, 680px); /* taller default height */
}

.tableau-embed object {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .main,
  .main-content {
    padding: 20px 16px;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}

/* =========
   Forms & Buttons
   ========= */

.form-card {
  background-color: #ffffff;
  padding: 18px 20px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  width: 100%;
}

.form-shell {
  max-width: 800px;
  width: 100%;
  margin: 0 auto 20px;
}

.form-shell table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.form-shell th {
  text-align: left;
  padding-right: 12px;
  width: 200px;
  vertical-align: middle;
}

.form-shell td {
  width: 100%;
}

.form-shell td input[type="text"],
.form-shell td input[type="email"],
.form-shell td input[type="password"],
.form-shell td input[type="date"],
.form-shell td input[type="number"],
.form-shell td input[type="datetime-local"],
.form-shell td select,
.form-shell td textarea {
  width: 100%;
  max-width: none;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.form-actions.centered {
  justify-content: center;
}

.signup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.signup-title {
  text-align: center;
  margin-top: 0;
  margin-bottom: 14px;
}

.login-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-header h3 {
  margin: 0;
}

.back-link {
  text-decoration: none;
  color: var(--color-charcoal);
  font-weight: 600;
  font-size: 0.95rem;
}

.centered-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.or-divider {
  font-size: 0.9rem;
  color: #666;
}

.login-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
}

.back-link-outside {
  text-decoration: none;
  color: var(--color-charcoal);
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 8px;
}

@media (max-width: 720px) {
  .login-layout {
    flex-direction: column;
    align-items: center;
  }
}

label {
  font-size: 0.9rem;
  display: block;
  margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(58, 63, 59, 0.25);
  font-size: 0.95rem;
  margin-bottom: 10px;
  font-family: inherit;
}

/* Keep date/time inputs compact so labels and fields stay close on wide screens */
form input[type="date"],
form input[type="datetime-local"] {
  max-width: 500px;
}

.form-shell input[type="date"],
.form-shell input[type="datetime-local"] {
  max-width: 100%;
}

.date-range {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.date-field {
  display: flex;
  flex-direction: column;
  min-width: 220px;
  max-width: 500px;
}

.filter-form .date-field {
  flex: 0 1 500px;
  width: 100%;
}

.filter-form .date-range {
  justify-content: center;
  flex-wrap: nowrap;
}

.date-field label {
  margin-bottom: 4px;
  font-weight: 500;
  display: inline-block;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

button,
.btn {
  display: inline-block;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: none;
  background-color: var(--color-raspberry);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  text-decoration: none;
}

button:hover,
.btn:hover {
  background-color: var(--color-peach);
  box-shadow: var(--shadow-strong);
  transform: translateY(-1px);
}

.logout-btn {
  margin-left: 12px;
}

.form-actions.centered {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
  gap: 10px;
}

/* =========
   Tables
   ========= */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background-color: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.form-table {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.form-table.compact {
  max-width: 680px;
  margin: 0 auto;
}

thead {
  background-color: var(--color-sage);
  color: var(--color-charcoal);
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  text-align: left;
}

tbody tr:nth-child(even) {
  background-color: rgba(249, 245, 234, 0.5);
}

tbody tr:hover {
  background-color: rgba(255, 216, 209, 0.4);
}

.participants-table {
  margin-top: 8px;
}

.participants-table.push-down {
  margin-top: 64px;
}

.quick-view {
  margin-top: 6px;
}

.quick-view summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-raspberry);
}

.quick-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(249, 245, 234, 0.6);
  border: 1px solid rgba(58, 63, 59, 0.08);
  border-radius: 10px;
  margin-top: 6px;
}

.quick-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-label {
  font-size: 0.85rem;
  color: rgba(58, 63, 59, 0.7);
}

.quick-value {
  font-weight: 600;
  color: var(--color-charcoal);
  word-break: break-word;
}

.quick-actions {
  margin-top: 8px;
}

.center-table th,
.center-table td {
  text-align: center;
}

.donations-table th,
.donations-table td {
  text-align: center;
}

.donation-total {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: center;
  row-gap: 10px;
  background: #ffffff;
  border: 1px solid rgba(206, 50, 91, 0.14);
  border-radius: 14px;
  padding: 22px 26px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 460px;
  min-width: 260px;
  margin: 12px auto 18px;
}

.donation-total__label {
  font-weight: 700;
  color: #8a3b52;
  font-size: 1.1rem;
}

.donation-total__value {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--color-raspberry);
}

.donation-note {
  background: linear-gradient(135deg, #fff7ef 0%, #ffeaea 100%);
  border: 1px solid rgba(206, 50, 91, 0.16);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 14px 0 18px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.04);
}

.donation-note__title {
  font-weight: 700;
  margin-bottom: 6px;
  color: #8a3b52;
}

.milestones-filter .compact-field {
  max-width: 460px;
  min-width: 260px;
  width: 100%;
}

.milestones-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 18px;
  max-width: 960px;
  margin: 0 auto 18px;
}

.milestones-filter .filter-actions {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
}

.centered-title {
  text-align: center;
}

.add-milestone-actions,
.page-actions {
  text-align: left;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin: 12px 0 16px;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 14px 18px;
  max-width: 960px;
  margin: 0 auto 18px;
}

.filter-form .filter-actions {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
}

.filter-form .compact-field {
  max-width: 460px;
  min-width: 260px;
  width: 100%;
}

.filter-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-items: center;
  text-align: center;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.surveys-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.surveys-table th,
.surveys-table td {
  white-space: normal;
  word-break: break-word;
}

@media (max-width: 900px) {
  .surveys-table th,
  .surveys-table td {
    padding: 6px 8px;
    font-size: 0.9rem;
  }
}

/* Pagination */

.pagination {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.pagination-centered {
  justify-content: center;
}

/* =========
   Alerts / Messages
   ========= */

.alert {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.alert-error {
  background-color: rgba(206, 50, 91, 0.08);
  color: var(--color-raspberry);
  border: 1px solid rgba(206, 50, 91, 0.35);
}

.alert-info {
  background-color: rgba(153, 183, 198, 0.12);
  color: var(--color-charcoal);
  border: 1px solid rgba(153, 183, 198, 0.4);
}

.alert-success {
  background-color: rgba(154, 181, 157, 0.15);
  color: #22543d;
  border: 1px solid rgba(154, 181, 157, 0.6);
}

/* Simple utilities */

.text-muted {
  color: rgba(58,63,59,0.7);
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
