/* ============================================================
   ชมรมศิษย์เก่าสำนักฝึกธรรมนักบุญดอมินิก ซาวีโอ
   ธีม: มรดกคาทอลิก — ไวน์แดงเข้ม ทองเก่า กระดาษครีม หน้าต่างโค้งวัด
   ============================================================ */

:root {
  --wine: #5e1f28;
  --wine-deep: #3f1219;
  --wine-soft: #7c3540;
  --gold: #b98a2f;
  --gold-light: #d9b56a;
  --gold-pale: #efe2c2;
  --cream: #f6efe2;
  --paper: #fdfaf3;
  --ink: #2b221e;
  --ink-soft: #6d5f55;
  --line: #e3d7bf;
  --ok: #3e5d3a;
  --error: #8a2f2f;
  --shadow: 0 10px 30px -12px rgba(63, 18, 25, .25);
  --arch: 999px 999px 14px 14px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Anuphan", sans-serif;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(185, 138, 47, .12), transparent),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.65;
}

h1, h2, h3, .display { font-family: "Trirong", serif; font-weight: 600; color: var(--wine-deep); }

a { color: var(--wine); }

/* ---------------- ส่วนหัว ---------------- */
.site-header {
  background: linear-gradient(160deg, var(--wine-deep), var(--wine) 70%);
  border-bottom: 3px solid var(--gold);
  color: var(--gold-pale);
  position: relative;
}
.site-header::after {
  content: "";
  position: absolute; inset: auto 0 3px 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
}
.header-inner {
  max-width: 1100px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand-mark {
  width: 46px; height: 56px; flex: none;
  border: 2px solid var(--gold-light);
  border-radius: var(--arch);
  display: grid; place-items: center;
  font-family: "Trirong", serif; font-size: 22px; color: var(--gold-light);
  background: rgba(0,0,0,.18);
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-text small { display: block; color: var(--gold-light); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.brand-text strong { font-family: "Trirong", serif; font-size: 19px; font-weight: 600; color: #fff; line-height: 1.25; }

.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--gold-pale); text-decoration: none; font-size: 14.5px;
  padding: 8px 13px; border-radius: 8px; transition: background .2s, color .2s;
}
.nav a:hover { background: rgba(217, 181, 106, .16); color: #fff; }
.nav a.active { background: rgba(217, 181, 106, .22); color: #fff; }
.nav .btn-gold { margin-left: 6px; }
.nav-user {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(217, 181, 106, .18); color: var(--gold-pale);
  border: 1px solid var(--gold-light); border-radius: 999px;
  padding: 5px 13px; font-size: 13.5px; font-weight: 600; max-width: 220px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* เมนูย่อย กิจกรรม */
.nav-dd { position: relative; }
.nav-dd summary {
  list-style: none; cursor: pointer; color: var(--gold-pale);
  font-size: 14.5px; padding: 8px 13px; border-radius: 8px; transition: background .2s, color .2s;
}
.nav-dd summary::-webkit-details-marker { display: none; }
.nav-dd summary:hover, .nav-dd summary.active { background: rgba(217, 181, 106, .22); color: #fff; }
.nav-dd-menu {
  position: absolute; top: 100%; left: 0; margin-top: 6px; z-index: 30; min-width: 240px;
  background: var(--paper); border: 1px solid var(--gold-light); border-radius: 12px;
  box-shadow: var(--shadow); padding: 8px; display: flex; flex-direction: column; gap: 2px;
}
.nav-dd-menu a {
  color: var(--ink); padding: 9px 14px; border-radius: 8px; font-size: 14.5px; text-decoration: none;
}
.nav-dd-menu a:hover { background: var(--gold-pale); color: var(--wine-deep); }
@media (max-width: 760px) {
  .nav-dd-menu { position: static; box-shadow: none; border: none; background: transparent; padding: 0 0 0 14px; }
  .nav-dd-menu a { color: var(--gold-pale); }
}

/* ---------------- ปุ่ม ---------------- */
.btn {
  display: inline-block; cursor: pointer; text-decoration: none;
  font-family: "Anuphan", sans-serif; font-size: 15px; font-weight: 600;
  border-radius: 10px; border: 1.5px solid transparent;
  padding: 10px 22px; transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:active { transform: translateY(1px); }
.btn-gold { background: linear-gradient(170deg, var(--gold-light), var(--gold)); color: var(--wine-deep) !important; box-shadow: 0 4px 14px -6px rgba(185,138,47,.7); }
.btn-gold:hover { box-shadow: 0 6px 18px -6px rgba(185,138,47,.9); }
.btn-wine { background: var(--wine); color: var(--gold-pale); }
.btn-wine:hover { background: var(--wine-deep); }
.btn-outline { border-color: var(--wine); color: var(--wine); background: transparent; }
.btn-outline:hover { background: var(--wine); color: var(--gold-pale); }
.btn-sm { padding: 5px 14px; font-size: 13.5px; border-radius: 8px; }
.btn-danger { background: transparent; border-color: var(--error); color: var(--error); }
.btn-danger:hover { background: var(--error); color: #fff; }

/* ---------------- โครงหน้า ---------------- */
.page { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 36px 24px 64px; }

.page-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.page-title h1 { font-size: 34px; }
.page-sub { color: var(--ink-soft); margin-bottom: 28px; }

.ornament { display: flex; align-items: center; gap: 12px; color: var(--gold); margin: 10px 0 26px; }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-light)); }
.ornament::after { background: linear-gradient(90deg, var(--gold-light), transparent); }
.ornament span { font-size: 15px; letter-spacing: .3em; }

/* ---------------- การ์ด ---------------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.card + .card { margin-top: 24px; }

/* ---------------- หน้าแรก ---------------- */
.hero { text-align: center; padding: 48px 16px 30px; }
.hero .crest {
  width: 88px; height: 110px; margin: 0 auto 22px;
  border: 2.5px solid var(--gold); border-radius: var(--arch);
  display: grid; place-items: center;
  font-family: "Trirong", serif; font-size: 44px; color: var(--wine);
  background: linear-gradient(180deg, var(--paper), var(--gold-pale));
  box-shadow: var(--shadow);
}
.hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.25; }
.hero .hero-sub { font-size: 18px; color: var(--ink-soft); max-width: 620px; margin: 14px auto 30px; }

/* hero แบบมีภาพแม่พระ */
.hero-split { display: flex; align-items: center; gap: 44px; text-align: left; padding: 40px 16px 30px; }
.hero-split .hero-text { flex: 1; }
.hero-split .crest { margin: 0 0 18px; }
.hero-split .hero-sub { margin: 14px 0 30px; }
.hero-mary {
  width: 290px; flex: none;
  border-radius: var(--arch); overflow: hidden;
  border: 3px solid var(--gold);
  box-shadow: 0 22px 44px -16px rgba(63, 18, 25, .45);
  background: var(--gold-pale);
}
.hero-mary img { width: 100%; display: block; }
@media (max-width: 800px) {
  .hero-split { flex-direction: column; text-align: center; gap: 28px; }
  .hero-split .crest { margin: 0 auto 18px; }
  .hero-split .hero-sub { margin: 14px auto 30px; }
  .hero-mary { width: 230px; }
}

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 18px; margin: 34px 0; }
.stat-card {
  background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--gold);
  border-radius: 14px; padding: 22px 16px 18px; text-align: center; box-shadow: var(--shadow);
}
.stat-card .num { font-family: "Trirong", serif; font-size: 42px; font-weight: 700; color: var(--wine); line-height: 1.1; }
.stat-card .lbl { font-size: 14px; color: var(--ink-soft); margin-top: 4px; }

/* ---------------- ทำเนียบรุ่น (การ์ดหน้าต่างโค้ง) ---------------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 22px; }
.person-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 26px 18px 20px; text-align: center; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .25s, border-color .2s;
  position: relative; overflow: hidden;
}
.person-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--wine), var(--gold), var(--wine));
  opacity: 0; transition: opacity .25s;
}
.person-card:hover { transform: translateY(-5px); box-shadow: 0 18px 38px -14px rgba(63,18,25,.4); border-color: var(--gold-light); }
.person-card:hover::before { opacity: 1; }

.arch-photo {
  width: 116px; height: 144px; margin: 0 auto 14px;
  border-radius: var(--arch); overflow: hidden;
  border: 2.5px solid var(--gold-light);
  background: linear-gradient(180deg, var(--gold-pale), var(--cream));
  display: grid; place-items: center;
  font-family: "Trirong", serif; font-size: 42px; color: var(--wine-soft);
}
.arch-photo img { width: 100%; height: 100%; object-fit: cover; }
.arch-photo.lg { width: 180px; height: 224px; font-size: 64px; }

.person-card .name { font-family: "Trirong", serif; font-size: 19px; font-weight: 600; color: var(--wine-deep); }
.person-card .meta { font-size: 13.5px; color: var(--ink-soft); margin-top: 3px; }
.badge {
  display: inline-block; margin-top: 10px; padding: 3px 12px;
  background: var(--gold-pale); color: var(--wine); border: 1px solid var(--gold-light);
  border-radius: 999px; font-size: 12.5px; font-weight: 600;
}

/* ---------------- ฟอร์ม ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

label { display: block; font-size: 14px; font-weight: 600; color: var(--wine-deep); margin-bottom: 5px; }
label .opt { font-weight: 400; color: var(--ink-soft); }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 10px 13px; font: inherit; font-size: 15px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 10px;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(185,138,47,.18);
}
textarea { resize: vertical; min-height: 84px; }
input[type=file] { font-size: 14px; }
.form-actions { margin-top: 26px; display: flex; gap: 12px; align-items: center; }

.auth-card { max-width: 460px; margin: 30px auto; }
.auth-card .form-grid { grid-template-columns: 1fr; }

/* ---------------- เข้าสู่ระบบผ่านบัญชีภายนอก ---------------- */
.social-divider { display: flex; align-items: center; gap: 14px; margin: 22px 0 14px; color: var(--ink-soft); font-size: 13.5px; }
.social-divider::before, .social-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.social-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .social-row { grid-template-columns: 1fr; } }
.btn-social {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); text-decoration: none;
  font-size: 14px; font-weight: 600;
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
.btn-social:hover { border-color: var(--gold); box-shadow: 0 4px 14px -8px rgba(63,18,25,.35); }
.btn-social:active { transform: translateY(1px); }
.btn-social .ic {
  width: 26px; height: 26px; flex: none; border-radius: 6px;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
}
.btn-social.google .ic { background: #db4437; }
.btn-social.facebook .ic { background: #1877f2; }
.btn-social.microsoft .ic { background: #0067b8; }
.btn-social.yahoo .ic { background: #6001d2; font-size: 11px; }

/* ---------------- ตาราง ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { font-family: "Trirong", serif; text-align: left; color: var(--gold-pale); background: var(--wine); padding: 10px 12px; white-space: nowrap; }
th:first-child { border-radius: 10px 0 0 0; } th:last-child { border-radius: 0 10px 0 0; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: rgba(185,138,47,.06); }

/* ---------------- แจ้งเตือน ---------------- */
.flash {
  max-width: 1100px; margin: 18px auto -10px; padding: 12px 20px;
  border-radius: 12px; font-weight: 600; font-size: 15px;
  border: 1.5px solid; animation: fadeUp .5s ease both;
}
.flash.ok { background: #eef3ea; color: var(--ok); border-color: #c4d4bd; }
.flash.error { background: #f9ecec; color: var(--error); border-color: #e3c2c2; }
@media (max-width: 1148px) { .flash { margin-left: 24px; margin-right: 24px; } }

/* ---------------- แดชบอร์ด ---------------- */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 860px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-card h3 { font-size: 19px; margin-bottom: 4px; }
.chart-card .hint { font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }
.chart-box { position: relative; height: 280px; }
.chart-card.full { grid-column: 1 / -1; }
.chart-box.tall { height: 380px; }

/* ---------------- ส่วนท้าย ---------------- */
.site-footer {
  background: var(--wine-deep); color: var(--gold-pale);
  border-top: 3px solid var(--gold);
  text-align: center; padding: 26px 20px; font-size: 14px;
}
.site-footer .motto { font-family: "Trirong", serif; font-size: 17px; color: var(--gold-light); margin-bottom: 4px; }

/* ---------------- แอนิเมชันเปิดหน้า ---------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.reveal { animation: fadeUp .6s ease both; }
.reveal:nth-child(2) { animation-delay: .08s; }
.reveal:nth-child(3) { animation-delay: .16s; }
.reveal:nth-child(4) { animation-delay: .24s; }
.reveal:nth-child(5) { animation-delay: .32s; }
.reveal:nth-child(6) { animation-delay: .4s; }

/* ---------------- รายละเอียดบุคคล ---------------- */
.detail-layout { display: grid; grid-template-columns: 230px 1fr; gap: 32px; align-items: start; }
@media (max-width: 700px) { .detail-layout { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.detail-list { display: grid; gap: 0; }
.detail-list .row { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.detail-list .row dt { font-weight: 600; color: var(--wine-deep); font-size: 14.5px; }
.detail-list .row dd { color: var(--ink); }
@media (max-width: 700px) { .detail-list .row { grid-template-columns: 1fr; gap: 2px; text-align: left; } }

.searchbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.searchbar input[type=text] { flex: 1; min-width: 220px; }
.searchbar select { width: auto; }

/* ---------------- กิจกรรม ขายของ/ประมูล ---------------- */
.listing-thumb {
  position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden;
  background: linear-gradient(180deg, var(--gold-pale), var(--cream));
  display: grid; place-items: center; font-size: 48px; margin-bottom: 12px; border: 1px solid var(--line);
}
.listing-thumb img { width: 100%; height: 100%; object-fit: cover; }
.listing-tag {
  position: absolute; top: 8px; left: 8px; padding: 3px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: #fff;
}
.listing-tag.sale { background: var(--ok); }
.listing-tag.auction { background: var(--wine); }
.listing-tag.closed { background: var(--ink-soft); }
.listing-photo {
  width: 100%; max-width: 260px; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, var(--gold-pale), var(--cream));
  display: grid; place-items: center; font-size: 64px; border: 2px solid var(--gold-light);
}
.listing-photo img { width: 100%; height: 100%; object-fit: cover; }
.win-box { margin-top: 18px; padding: 16px 20px; background: var(--paper); border: 1px solid var(--gold-light); border-left: 5px solid var(--gold); border-radius: 12px; }
.win-box h3 { font-size: 19px; color: var(--wine-deep); }
.bank { margin-top: 8px; padding: 12px 16px; background: var(--cream); border: 1px dashed var(--gold); border-radius: 10px; font-size: 14.5px; line-height: 1.7; }

.guide-tip { margin-top: 14px; padding: 12px 16px; background: var(--gold-pale); border: 1px solid var(--gold-light); border-radius: 10px; font-size: 14.5px; color: var(--wine-deep); }

.empty { text-align: center; color: var(--ink-soft); padding: 60px 20px; font-size: 16px; }
.empty .big { font-family: "Trirong", serif; font-size: 40px; color: var(--gold); display: block; margin-bottom: 10px; }

.section-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 34px 0 16px; }
.section-h h2 { font-size: 24px; }
