/* ============================================================
   style.css — Family Association Website
   ============================================================ */

:root {
  --navy:   #1A3A5C;
  --blue:   #2471A3;
  --lblue:  #D6EAF8;
  --green:  #1E8449;
  --orange: #CA6F1E;
  --gray:   #555;
  --lgray:  #F4F6F8;
  --white:  #fff;
  --shadow: 0 4px 20px rgba(0,0,0,0.10);
  --radius: 10px;
  --transition: all 0.25s ease;
}

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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  color: var(--gray);
  background: var(--lgray);
  line-height: 1.7;
}

/* ── NAVBAR ─────────────────────────────────────────────── */
nav {
  background: var(--navy);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

nav .logo {
  color: white;
  font-size: 1.4rem;
  font-weight: 700;
  text-decoration: none;
  padding: 18px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

nav .logo span { color: #AED6F1; }

nav ul {
  list-style: none;
  display: flex;
  gap: 4px;
}

nav ul li a {
  color: #BDC3C7;
  text-decoration: none;
  padding: 22px 16px;
  display: block;
  font-size: 0.92rem;
  font-weight: 500;
  transition: var(--transition);
  border-bottom: 3px solid transparent;
}

nav ul li a:hover,
nav ul li a.active {
  color: white;
  border-bottom-color: #AED6F1;
  background: rgba(255,255,255,0.06);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 10px;
}

/* ── HERO ────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, #2C5F8A 60%, var(--blue) 100%);
  color: white;
  text-align: center;
  padding: 90px 20px 80px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero h1 { font-size: clamp(1.8rem, 5vw, 3rem); margin-bottom: 16px; position: relative; }
.hero p  { font-size: 1.1rem; opacity: 0.85; max-width: 600px; margin: 0 auto 28px; position: relative; }

.hero-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; position: relative; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-primary   { background: var(--blue); color: white; }
.btn-primary:hover { background: #1A5F8A; transform: translateY(-1px); }
.btn-outline   { background: transparent; color: white; border: 2px solid rgba(255,255,255,0.6); }
.btn-outline:hover { background: rgba(255,255,255,0.12); border-color: white; }
.btn-green     { background: var(--green); color: white; }
.btn-green:hover   { background: #166538; }
.btn-danger    { background: #C0392B; color: white; }
.btn-danger:hover  { background: #922B21; }
.btn-sm        { padding: 7px 16px; font-size: 0.82rem; }

/* ── CONTAINER / LAYOUT ──────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.section   { padding: 60px 0; }
.section-title {
  font-size: 1.8rem;
  color: var(--navy);
  margin-bottom: 8px;
  font-weight: 700;
}
.section-sub {
  color: #888;
  margin-bottom: 36px;
  font-size: 1rem;
}

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
}
.card:hover { transform: translateY(-4px); box-shadow: 0 8px 30px rgba(0,0,0,0.14); }
.card-body  { padding: 24px; }
.card-title { font-size: 1.1rem; color: var(--navy); font-weight: 700; margin-bottom: 8px; }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 28px; }

/* ── STATS BAR ───────────────────────────────────────────── */
.stats-bar {
  background: var(--navy);
  padding: 30px 0;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  text-align: center;
}
.stat-item { padding: 16px; border-right: 1px solid rgba(255,255,255,0.1); }
.stat-item:last-child { border-right: none; }
.stat-number { font-size: 2.2rem; font-weight: 800; color: #AED6F1; }
.stat-label  { color: rgba(255,255,255,0.7); font-size: 0.85rem; margin-top: 4px; }

/* ── TREE CONTAINER ──────────────────────────────────────── */
#tree-container {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  height: 700px;
}

#tree-toolbar {
  background: var(--lgray);
  border-bottom: 1px solid #ddd;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#tree-toolbar input,
#tree-toolbar select {
  padding: 8px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}

#tree-toolbar input:focus,
#tree-toolbar select:focus { border-color: var(--blue); }

#tree-canvas { width: 100%; height: calc(700px - 58px); cursor: grab; }
#tree-canvas:active { cursor: grabbing; }

/* ── MEMBER NODE (SVG styles via CSS class) ────────────────── */
.node-male   { fill: #D6EAF8; stroke: #2471A3; }
.node-female { fill: #FDEDEC; stroke: #C0392B; }
.node-other  { fill: #EAFAF1; stroke: #1E8449; }
.node-text   { font-family: 'Segoe UI', sans-serif; font-size: 11px; fill: #1A3A5C; font-weight: 600; }
.node-years  { font-family: 'Segoe UI', sans-serif; font-size: 9px; fill: #777; }
.edge        { stroke: #BDC3C7; stroke-width: 1.5; fill: none; }
.edge-spouse { stroke: #E74C3C; stroke-width: 1.5; stroke-dasharray: 5,3; fill: none; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: white;
  border-radius: 12px;
  max-width: 560px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } }
.modal-header {
  background: var(--navy);
  color: white;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px 12px 0 0;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close { background: none; border: none; color: white; font-size: 1.4rem; cursor: pointer; }
.modal-body { padding: 24px; }

.member-photo {
  width: 90px; height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--lblue);
  float: left;
  margin: 0 20px 10px 0;
}
.member-photo-placeholder {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: var(--lblue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--blue);
  float: left;
  margin: 0 20px 10px 0;
}
.member-detail { margin-bottom: 10px; font-size: 0.9rem; }
.member-detail strong { color: var(--navy); }
.clearfix::after { content: ''; display: table; clear: both; }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; color: var(--navy); margin-bottom: 6px; font-size: 0.9rem; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.92rem;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,113,163,0.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── ALERTS ──────────────────────────────────────────────── */
.alert { padding: 12px 18px; border-radius: 6px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-success { background: #EAFAF1; color: #1E8449; border-left: 4px solid #1E8449; }
.alert-error   { background: #FDEDEC; color: #C0392B; border-left: 4px solid #C0392B; }
.alert-info    { background: var(--lblue); color: var(--navy); border-left: 4px solid var(--blue); }

/* ── TABLES ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: white; }
th {
  background: var(--navy);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
}
td { padding: 11px 16px; border-bottom: 1px solid #F0F0F0; font-size: 0.88rem; }
tr:hover td { background: var(--lgray); }
tr:last-child td { border-bottom: none; }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-blue   { background: var(--lblue); color: var(--blue); }
.badge-green  { background: #EAFAF1; color: var(--green); }
.badge-orange { background: #FDEBD0; color: var(--orange); }
.badge-gray   { background: #F0F0F0; color: #666; }

/* ── FOOTER ──────────────────────────────────────────────── */
footer {
  background: var(--navy);
  color: rgba(255,255,255,0.75);
  padding: 50px 0 20px;
  margin-top: 60px;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 40px; margin-bottom: 40px; }
.footer-col h4 { color: white; margin-bottom: 16px; font-size: 1rem; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { color: rgba(255,255,255,0.65); text-decoration: none; font-size: 0.9rem; transition: var(--transition); }
.footer-col ul li a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; text-align: center; font-size: 0.82rem; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  nav ul { display: none; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0; background: var(--navy); padding: 10px 0; }
  nav ul.open { display: flex; }
  nav ul li a { padding: 14px 28px; }
  .hamburger { display: block; }
  .form-row { grid-template-columns: 1fr; }
  #tree-container { height: 500px; }
  #tree-canvas { height: calc(500px - 58px); }
}
