/* === Reset & basis === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --danger: #dc2626;
  --success: #16a34a;
  --text: #111827;
  --text-muted: #6b7280;
  --bg: #f9fafb;
  --surface: #ffffff;
  --border: #e5e7eb;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.15);
  --navbar-h: 60px;
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* === Navbar === */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--navbar-h);
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem;
  box-shadow: var(--shadow);
}
.navbar.hidden { display: none; }
.nav-brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; }
.nav-logo { font-size: 1.5rem; }
.nav-links { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.nav-link { padding: .4rem .7rem; border-radius: var(--radius); color: rgba(255,255,255,.85); font-size: .9rem; transition: background .15s; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.2); color: white; }
.btn-logout { background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4); color: white; padding: .4rem .8rem; border-radius: var(--radius); font-size: .85rem; }
.btn-logout:hover { background: rgba(255,255,255,.3); }
.nav-toggle { display: none; background: none; border: none; color: white; font-size: 1.5rem; padding: .3rem; }

#main-content { padding-top: var(--navbar-h); min-height: 100vh; }
.navbar.hidden ~ #main-content { padding-top: 0; }

/* === Buttons === */
.btn-primary {
  background: var(--primary); color: white; border: none;
  padding: .6rem 1.2rem; border-radius: var(--radius);
  font-size: .9rem; font-weight: 500; transition: background .15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: white; color: var(--primary); border: 1px solid var(--primary);
  padding: .6rem 1.2rem; border-radius: var(--radius); font-size: .9rem; font-weight: 500;
}
.btn-back { background: none; border: none; color: var(--primary); font-size: .95rem; padding: .5rem 0; margin-bottom: 1rem; }
.btn-back:hover { text-decoration: underline; }
.btn-full { width: 100%; }
.btn-danger { background: var(--danger); color: white; border: none; padding: .4rem .8rem; border-radius: var(--radius); font-size: .85rem; }

/* === Formulieren === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: .35rem; font-size: .9rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: .65rem .85rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 1rem; font-family: inherit;
  transition: border-color .15s;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.error-msg { color: var(--danger); font-size: .9rem; padding: .5rem; background: #fee2e2; border-radius: var(--radius); margin-bottom: .75rem; }
.error-msg.hidden { display: none; }

/* === Login pagina === */
.page-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%); padding: 1rem; }
.login-card { background: white; border-radius: 12px; padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.login-logo { font-size: 4rem; text-align: center; margin-bottom: .5rem; }
.login-card h1 { text-align: center; font-size: 1.5rem; margin-bottom: .25rem; }
.login-card > p { text-align: center; color: var(--text-muted); margin-bottom: 1.75rem; }

/* === Home pagina === */
.page-home { padding: 2rem 1rem; max-width: 1100px; margin: 0 auto; }
.hero { text-align: center; padding: 2rem 0 2.5rem; }
.hero h1 { font-size: 2rem; margin-bottom: .5rem; }
.hero-stats { color: var(--text-muted); font-size: 1.1rem; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.card { background: var(--surface); border-radius: var(--radius); padding: 1.5rem 1rem; text-align: center; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; border: 1px solid var(--border); }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.card h3 { font-size: 1rem; margin-bottom: .25rem; }
.card p { font-size: .85rem; color: var(--text-muted); }

/* === Pagina header === */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; padding: 1.5rem 1rem .5rem; }
.page-header h2 { font-size: 1.5rem; }

/* === Leden grid === */
.page-leden { max-width: 1100px; margin: 0 auto; }
.members-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; padding: 0 1rem 2rem; }
.member-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); transition: transform .15s; }
.member-card:hover { transform: translateY(-2px); }
.member-card a { display: block; }
.member-avatar { width: 100%; height: 140px; object-fit: cover; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 4rem; color: var(--primary); }
.member-info { padding: .85rem; }
.member-info h3 { font-size: .95rem; font-weight: 600; }
.member-info p { font-size: .8rem; color: var(--text-muted); }

/* === Albums grid === */
.page-albums { max-width: 1100px; margin: 0 auto; }
.albums-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; padding: 0 1rem 2rem; }
.album-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); cursor: pointer; transition: transform .15s; }
.album-card:hover { transform: translateY(-2px); }
.album-cover { width: 100%; height: 160px; object-fit: cover; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.album-info { padding: .85rem; }
.album-info h3 { font-size: 1rem; font-weight: 600; margin-bottom: .25rem; }
.album-info p { font-size: .8rem; color: var(--text-muted); }
.album-badge { display: inline-block; font-size: .7rem; padding: .15rem .5rem; border-radius: 99px; background: var(--primary-light); color: var(--primary); margin-top: .35rem; }

/* === Foto grid === */
.page-album { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.album-header { margin-bottom: 1rem; }
.album-header h2 { font-size: 1.4rem; }
.album-actions { margin-bottom: 1rem; }
.upload-label { cursor: pointer; }
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; }
.photo-thumb { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 4px; background: var(--border); cursor: pointer; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.photo-thumb:hover img { transform: scale(1.05); }

/* === Lightbox === */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.93); z-index: 200; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.lightbox.hidden { display: none; }
.lightbox img { max-width: 90vw; max-height: 80vh; object-fit: contain; border-radius: 4px; }
.lightbox-caption { color: rgba(255,255,255,.8); margin-top: .75rem; font-size: .9rem; }
.lightbox-close { position: absolute; top: 1rem; right: 1rem; background: rgba(255,255,255,.15); border: none; color: white; font-size: 1.5rem; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.lightbox-prev, .lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.15); border: none; color: white; font-size: 2rem; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* === Berichten === */
.page-berichten { max-width: 800px; margin: 0 auto; padding: 0 1rem 2rem; }
.message-form { padding: 0 0 1.5rem; }
.message-form textarea { width: 100%; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); font-family: inherit; font-size: .95rem; resize: vertical; }
.message-form button { margin-top: .5rem; }
.messages-list { display: flex; flex-direction: column; gap: .75rem; }
.message-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; }
.message-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .4rem; }
.message-author { font-weight: 600; font-size: .9rem; }
.message-date { font-size: .8rem; color: var(--text-muted); }
.message-content { font-size: .95rem; white-space: pre-wrap; }

/* === Wijn === */
.wine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; padding: 0 1rem 2rem; }
.wine-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.wine-card h3 { font-size: 1rem; margin-bottom: .3rem; }
.wine-rating { display: flex; align-items: center; gap: .4rem; margin: .4rem 0; }
.wine-stars { color: #f59e0b; }
.wine-color-badge { display: inline-block; font-size: .75rem; padding: .15rem .5rem; border-radius: 99px; margin-bottom: .35rem; }
.wine-color-red { background: #fee2e2; color: #991b1b; }
.wine-color-white { background: #fef9c3; color: #854d0e; }
.wine-color-rose { background: #fce7f3; color: #9d174d; }

/* === Uitspraken === */
.talks-list { display: flex; flex-direction: column; gap: .75rem; padding: 0 1rem 2rem; max-width: 800px; margin: 0 auto; }
.talk-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; border-left: 4px solid var(--primary); }
.talk-card blockquote { font-style: italic; margin-bottom: .5rem; }
.talk-meta { font-size: .8rem; color: var(--text-muted); }

/* === Stamboom === */
.page-stamboom { max-width: 1200px; margin: 0 auto; padding: 0 1rem 2rem; }
.tree-container { overflow-x: auto; }
.tree-node { display: inline-flex; flex-direction: column; align-items: center; margin: 0 .5rem; }
.tree-person { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .75rem; font-size: .85rem; text-align: center; cursor: pointer; min-width: 90px; }
.tree-person:hover { border-color: var(--primary); }
.tree-line { width: 1px; height: 20px; background: var(--border); }
.tree-children { display: flex; }

/* === Toast === */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 300; display: flex; flex-direction: column; gap: .5rem; }
.toast { padding: .75rem 1.1rem; border-radius: var(--radius); color: white; font-size: .9rem; box-shadow: var(--shadow-lg); animation: slideIn .2s ease; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* === Diversen === */
.loading { text-align: center; padding: 3rem; color: var(--text-muted); font-size: 1rem; }
.loading::after { content: ''; display: inline-block; width: 1.2rem; height: 1.2rem; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; margin-left: .5rem; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 3rem; color: var(--text-muted); }
.empty-state p { font-size: 1.1rem; }

/* === Responsief === */
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: var(--navbar-h); left: 0; right: 0; background: var(--primary); padding: 1rem; gap: .25rem; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .members-grid, .albums-grid { grid-template-columns: repeat(2, 1fr); }
  .photos-grid { grid-template-columns: repeat(3, 1fr); }
  .hero h1 { font-size: 1.5rem; }
  .lightbox-prev { left: .35rem; }
  .lightbox-next { right: .35rem; }
}
@media (max-width: 420px) {
  .cards-grid, .members-grid, .albums-grid { grid-template-columns: 1fr; }
}
