/* ========== Base / Reset ========== */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { color-scheme: light dark; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  line-height: 1.55;
  background: var(--bg);
  color: var(--fg);
}

/* ========== Theme ========== */
:root{
  --bg: #0f1115;
  --fg: #e8eaf0;
  --muted: #9aa2b1;

  --card: #171a21;
  --card-border: rgba(255,255,255,.08);

  --primary: #5561ff;
  --primary-contrast: #ffffff;

  --surface: #1e232d;

  --btn-bg: #222936;
  --btn-fg: #e8eaf0;
  --btn-border: rgba(255,255,255,.08);

  --link: #9bb1ff;

  --success: #0a7d3a;
  --error: #b00020;
  --warning: #d08700;
}

html[data-theme="light"]{
  --bg: #f7f7fb;
  --fg: #1f2430;
  --muted: #606c7a;

  --card: #ffffff;
  --card-border: rgba(0,0,0,.06);

  --primary: #3b5bdb;
  --primary-contrast: #ffffff;

  --surface: #ffffff;

  --btn-bg: #f0f2f7;
  --btn-fg: #1f2430;
  --btn-border: rgba(0,0,0,.08);

  --link: #2a5bd7;
}

/* ========== Layout helpers ========== */
.container{
  max-width: 1100px;
  margin: 16px auto;
  padding: 0 12px;
}

.card{
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0,0,0,.16);
  padding: 12px;
}

/* Header */
header.card{
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(6px);
}

/* Text */
h1,h2,h3{ margin: .2em 0 .4em }
.muted{ color: var(--muted); }

/* Links & Buttons */
a{ color: var(--link); text-decoration: none; }
a:hover{ text-decoration: underline; }

.btn{
  appearance: none;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .05s ease, filter .15s ease;
}
.btn:hover{ filter: brightness(1.05); }
.btn:active{ transform: translateY(1px); }
.btn.primary{ background: var(--primary); color: var(--primary-contrast); border-color: transparent; }
.btn.secondary{ background: transparent; }
.btn.tiny{ padding: 2px 8px; font-size: 13px; border-radius: 999px; }
.btn.danger{ background: var(--error); color: #fff; border-color: transparent; }

/* Inputs */
.input{
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: inherit;
  outline: none;
}
.input:focus{ border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 30%, transparent); }

/* Alerts */
.alert{
  padding: 10px 14px;
  border-radius: 12px;
  margin: 8px 0;
  border: 1px solid var(--card-border);
  background: var(--surface);
}
.alert.success{ border-color: color-mix(in oklab, var(--success) 30%, transparent); }
.alert.error  { border-color: color-mix(in oklab, var(--error)   30%, transparent); }

/* Badge */
.badge{
  display: inline-block;
  background: color-mix(in oklab, var(--primary) 20%, var(--card));
  color: var(--fg);
  border: 1px solid var(--card-border);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

/* ========== Album Grid & Cards ========== */
.album-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.album-card .card-media{
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  cursor: pointer;
  border-radius: 12px;
}
.album-card .card-media img{
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1); transition: transform .35s ease;
}
.album-card .card-media:hover img{ transform: scale(1.06); }

.album-card .no-cover{
  width: 100%; height: 100%;
  background: #2a2b31;
  color: #9aa2b1;
  display: flex; align-items: center; justify-content: center;
}

.photos-count{
  position: absolute; left: 10px; top: 10px;
  font-size: 12px; color: #fff; background: rgba(0,0,0,.6);
  padding: 2px 8px; border-radius: 9999px;
}

.card-body{ padding: 10px 2px 2px; display:flex; flex-direction:column; gap:8px; }
.card-title{ font-size: 16px; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-desc{ margin: 0; font-size: 13px; color: var(--muted); min-height: 38px; }
.card-actions{ display: flex; gap: 8px; align-items: center; }

/* Photo thumbnail in detail page */
.thumbnail{
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--card-border);
}

/* ========== Toolbar / Search ========== */
.toolbar{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.toolbar-actions{ display:flex; gap:8px; align-items:center; }
.search-input{ min-width: 240px; }

/* ========== Reveal + Ripple + Toast ========== */
.reveal{ opacity: 0; transform: translateY(10px); transition: .4s ease; }
.reveal.show{ opacity: 1; transform: none; }

@keyframes ripple{ to{ transform: scale(2); opacity: 0; } }
.ripple{ position:absolute; border-radius:9999px; pointer-events:none; transform:scale(0); background:currentColor; opacity:.2; animation:ripple .6s ease-out forwards; mix-blend-mode:multiply; }

/* Toast container is created dynamically in JS */
.toast{
  backdrop-filter: blur(6px);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}

/* ========== Clock + Calendar (Grid) ========== */
/* wrapper row placed in layout */
.widget-row{ display:grid; grid-template-columns: 1fr 2fr; gap:12px; }

/* Clock */
.clock-card{ background: var(--card); border:1px solid var(--card-border); border-radius:12px; }
.clock-time{ font-size: 32px; font-weight: 800; line-height: 1; }
.clock-date{ margin-top: 6px; color: var(--muted); }

/* Calendar Card */
.cal-card{ background: var(--card); border:1px solid var(--card-border); border-radius:12px; }
.cal-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; font-weight:700; }

/* IMPORTANT: 7-column grid calendar */
.cal-grid{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-grid .dow{
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.cal-grid .cell{
  text-align: center;
  padding: 8px 0;
  border-radius: 8px;
  user-select: none;
}
.cal-grid .muted{ opacity: .35; }
.cal-grid .today{
  outline: 2px solid var(--primary);
  font-weight: 800;
  border-radius: 8px;
}
/* จุดบอกว่ามีกิจกรรมในช่องวัน */
.evt-dot{
  display:block;
  width:6px; height:6px;
  margin:4px auto 0;
  border-radius:50%;
  background: var(--brand, #6ea8fe);
}


/* ========== Footer (optional) ========== */
.footer{ color: var(--muted); font-size: 13px; text-align:center; padding: 20px 0; }

/* ========== Utilities ========== */
.visually-hidden{
  position:absolute !important;
  width:1px;height:1px;margin:-1px;border:0;padding:0;clip:rect(0 0 0 0);overflow:hidden;white-space:nowrap;
}

.grid{ display:grid; gap:12px; }
.grid.cols-2{ grid-template-columns: repeat(2,1fr); }
.grid.cols-3{ grid-template-columns: repeat(3,1fr); }

@media (max-width: 900px){
  .album-grid{ grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); }
  .widget-row{ grid-template-columns: 1fr; }
}
/* Events list in clock card */
.events-list { margin-top:10px; display:flex; flex-direction:column; gap:6px; max-height:160px; overflow:auto; }
.event-item { font-size:13px; background:rgba(0,0,0,.06); border-radius:8px; padding:6px 8px; }
html[data-theme="dark"] .event-item { background:rgba(255,255,255,.06); }

/* Dot on days that have events */
.cal-grid .cell { position:relative; }
.cal-grid .cell .dot {
  position:absolute; left:50%; bottom:4px; transform:translateX(-50%);
  width:6px; height:6px; border-radius:50%;
  background:var(--brand, #5561ff);
}
.cal-grid .cell.selected { outline:2px solid var(--brand, #5561ff); border-radius:8px; }
/* Events list in clock panel */
.events-list { margin-top:10px; display:flex; flex-direction:column; gap:6px; }
.event-item {
  width:100%;
  text-align:left;
  background:rgba(0,0,0,.05);
  border:1px solid rgba(0,0,0,.06);
  border-radius:10px;
  padding:8px 10px;
  cursor:pointer;
}
html[data-theme="dark"] .event-item {
  background:rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
}
.event-item:hover { filter: brightness(1.03); }

/* Simple modal */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.5);
  display:flex; align-items:center; justify-content:center; z-index:99999;
}
.modal {
  background: var(--card, #fff);
  color: inherit;
  padding: 16px;
  border-radius: 12px;
  min-width: 280px;
  max-width: 90vw;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.modal-title { font-weight:700; margin-bottom:8px; }
.modal-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:12px; }
/* ===== Login (Auth) ===== */
.auth-wrap {
  position: relative;
  min-height: calc(100vh - 64px); /* ครอบคลุมเกือบเต็มจอ ใต้ header */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  background-image: var(--auth-bg, url('/img/flower1.jpg'));
  background-size: cover;
  background-position: center;
  filter: brightness(0.9);
  z-index: 0;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(520px, 92vw);
  padding: 28px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);           /* โทนสว่างในธีม dark */
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

html[data-theme="dark"] .auth-card {
  background: rgba(0,0,0,0.25);                 /* เข้มขึ้นในโหมด dark */
  border-color: rgba(255,255,255,0.12);
}

.auth-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  margin: 4px 0 18px 0;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: inherit;
  outline: none;
}
.auth-input::placeholder { opacity: .8; }

.auth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  margin-bottom: 2px;
  gap: 12px;
}

.auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  opacity: .9;
}

.auth-link {
  color: #cfe3ff;
  text-decoration: underline;
  font-size: 14px;
}

.auth-submit {
  width: 100%;
  height: 50px;
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  background: rgba(255,255,255,0.85);
  color: #1b1b1f;
}
html[data-theme="dark"] .auth-submit {
  background: #d2d7de;
  color: #111316;
}

.auth-footer {
  text-align: center;
  margin-top: 14px;
  font-size: 14px;
  opacity: .95;
}

/* ซ่อนข้อความ label ที่เป็นตัวช่วยอ่านหน้าจอ */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: -1;
}

.auth-bg .auth-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.9); /* ปรับความมืด */
}
.auth-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(270deg, #1a2a6c, #b21f1f, #fdbb2d,#6ea8fe,#0a7d3a);
  background-size: 600% 600%;
  animation: gradientShift 15s ease infinite;
  filter: brightness(0.9);
  z-index: -1;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.auth-wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  overflow: hidden;
}

.auth-bg-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1; /* ให้อยู่ข้างหลัง */
  filter: brightness(0.7); /* ทำให้มืดลงเล็กน้อย */
}

.auth-card {
  position: relative;
  background: rgba(255, 255, 255, 0.85);
  padding: 40px 32px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 400px;
  z-index: 1; /* อยู่เหนือ video */
}
/* ===== Auth: ทำธีมกระจกใสแบบภาพตัวอย่าง ===== */

/* ฉากหลัง */
.auth-wrap {
  position: relative;
  min-height: calc(100vh - 64px); /* เหลือพื้นที่ใต้ header ถ้าไม่ได้ซ่อน */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  background-image: var(--auth-bg, url('/img/flower1.jpg'));
  background-size: cover;
  background-position: center;
  filter: brightness(.92);
  z-index: 0;
}

/* การ์ดกระจก */
.auth-card.glass {
  position: relative;
  z-index: 1;
  width: min(720px, 92vw);
  padding: 36px 32px 28px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.09);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
}

/* หัวข้อใหญ่ + เงาอ่อน */
.glass-title {
  text-align: center;
  font-size: 36px;
  font-weight: 700;
  margin: 6px 0 20px 0;
  color: #f1f3f5;
  text-shadow: 0 2px 10px rgba(0,0,0,.35);
}

/* ช่องกรอกใหญ่ ขอบมน และดู “ลอย” เหมือนตัวอย่าง */
.glass-input {
  height: 58px;
  padding: 0 18px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.12);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.glass-input::placeholder { color: #eef2f6; opacity: .85; }
.glass-input:focus {
  border-color: rgba(255,255,255,0.85);
  box-shadow: 0 0 0 3px rgba(255,255,255,.22);
  outline: none;
}

/* ปุ่มเทาอ่อน มนใหญ่ */
.glass-btn {
  height: 54px;
  border-radius: 14px;
  background: rgba(217,222,226,0.92);
  color: #111;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.glass-btn:hover { filter: brightness(1.02); }

/* ลิงก์สีฟ้าอ่านง่าย */
.auth-link { color: #bfe2ff; text-decoration: underline; }

/* ตัวหนังสือ Remember me */
.auth-remember { color: #fff; font-weight: 600; }

/* ทำให้สีตัวอักษรในฟอร์มอ่านง่ายขึ้นบนพื้นหลัง */
.auth-form, .auth-footer { color: #f8f9fa; }

/* ปรับเลย์เอาต์ถ้าซ่อน header (เราใช้ hideNavbar ใน layout) ให้เต็มจอจริง ๆ */
html body.no-header .auth-wrap { min-height: 100vh; }
.auth-wrap{
  position:relative;
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:40px 16px;
  overflow:hidden;
}

.auth-bg-video{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:cover;
  filter:brightness(.8);
  z-index:-1; /* ให้อยู่ด้านหลังการ์ด */
}

.auth-card{
  position:relative;
  width:min(520px,92vw);
  padding:28px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(0,0,0,.30);       /* ทึบเล็กน้อยเหมือนตัวอย่าง */
  backdrop-filter: blur(8px);
  box-shadow:0 10px 30px rgba(0,0,0,.35);
  color:#fff;
}
.auth-bg-video {
  position: fixed;   /* เปลี่ยนจาก absolute → fixed */
  top: 0;
  left: 0;
  width: 100vw;      /* กว้างเต็มหน้าจอ */
  height: 100vh;     /* สูงเต็มหน้าจอ */
  object-fit: cover; /* ครอบภาพไม่ให้มีขอบดำ */
  z-index: -1;       /* อยู่ด้านหลัง */
  filter: brightness(0.7); /* มืดลงเล็กน้อย */
}
.auth-wrap {
  position: relative;
  min-height: 100vh; /* ครอบทั้งหน้าจอ */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-bg-video {
  position: fixed;   /* ให้ยึดทั้งหน้าจอ */
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover; /* ครอบเต็มจอ */
  z-index: -1;
  filter: brightness(0.7);
}

.auth-card {
  position: relative;
  z-index: 1;
  background: rgba(0, 0, 0, 0.45); /* โปร่งใสเหมือนแก้ว */
  padding: 40px 32px;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 400px;
  color: #fff;
  backdrop-filter: blur(8px);
}

.auth-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 18px;
}

.auth-input {
  width: 100%;
  height: 48px;
  margin-bottom: 12px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.auth-input::placeholder {
  color: rgba(255,255,255,0.7);
}

.auth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0;
  font-size: 14px;
}

.auth-link {
  color: #cfe3ff;
  text-decoration: underline;
}

.auth-submit {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 10px;
  background: #ffffffcc;
  color: #111;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

.auth-footer {
  text-align: center;
  margin-top: 14px;
  font-size: 14px;
}
/* ==== Verify Org Page ==== */
.verify-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #145214;  /* พื้นหลังเขียว */
  background: linear-gradient(180deg, #0f3d0f, #1d691d);
}

.verify-card {
  width: min(420px, 95%);
  padding: 32px;
  border-radius: 16px;
  text-align: center;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.verify-logo img {
  width: 100px;
  margin-bottom: 18px;
}

.verify-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #111;
}

.verify-subtitle {
  font-size: 14px;
  color: #444;
  margin-bottom: 18px;
}

.verify-input {
  width: 100%;
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  text-align: center;
}

.verify-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #2e8b2e;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.verify-btn:hover {
  background: #256d25;
}

.verify-footer {
  margin-top: 14px;
  font-size: 13px;
  color: #333;
}
