/* ==========================================================================
   psdinhhoang.com - Bảng màu & Phong cách Phật giáo thanh tịnh, trang nghiêm
   ========================================================================== */

:root {
  --bg-main: #F5F0E6;
  --bg-card: #FFFFFF;
  --bg-subtle: #ECE4D4;
  --text-main: #3E2B1F;
  --text-muted: #6B5546;
  --gold-primary: #B8860B;
  --gold-accent: #C9A227;
  --gold-light: #EEDB98;
  --red-seal: #8C2522;
  --border-main: #DECFA6;
  --border-subtle: #E8DEC5;
  --shadow-soft: 0 4px 18px rgba(62, 43, 31, 0.06);
  --shadow-hover: 0 8px 25px rgba(62, 43, 31, 0.12);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-serif: 'Lora', 'Merriweather', 'Georgia', serif;
  --font-sans: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  --transition: all 0.25s ease;
}

[data-theme="dark"] {
  --bg-main: #1D1611;
  --bg-card: #271E17;
  --bg-subtle: #33271E;
  --text-main: #EFE8DD;
  --text-muted: #B8A99B;
  --gold-primary: #D4AF37;
  --gold-accent: #E5C158;
  --gold-light: #5A4720;
  --red-seal: #A8322D;
  --border-main: #4A3A2C;
  --border-subtle: #382A1E;
  --shadow-soft: 0 4px 18px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.5);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.75;
  font-size: 16px;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--red-seal);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--gold-primary);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--text-main);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Khung viền trang trí header & hoa văn */
.ornament-border {
  border: 1px solid var(--border-main);
  position: relative;
  background: var(--bg-card);
}

.ornament-border::before,
.ornament-border::after {
  content: "❖";
  position: absolute;
  color: var(--gold-accent);
  font-size: 12px;
  line-height: 1;
}

.ornament-border::before {
  top: 3px;
  left: 3px;
}

.ornament-border::after {
  bottom: 3px;
  right: 3px;
}

/* Header & Navigation */
header.site-header {
  background: var(--bg-main);
  border-bottom: 2px solid var(--border-main);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.top-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-icon {
  background: var(--bg-subtle);
  border: 1px solid var(--border-main);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.btn-icon:hover {
  border-color: var(--gold-accent);
  color: var(--gold-primary);
}

.header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-seal {
  width: 44px;
  height: 44px;
  border: 2px solid var(--red-seal);
  color: var(--red-seal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: bold;
  border-radius: 4px;
  background: rgba(140, 37, 34, 0.05);
  box-shadow: inset 0 0 4px rgba(140, 37, 34, 0.15);
}

.site-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-accent);
  box-shadow: 0 2px 10px rgba(184, 134, 11, 0.25);
  background: #FFFFFF;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  flex-shrink: 0;
  display: block;
}

.site-logo:hover {
  transform: rotate(6deg) scale(1.06);
  box-shadow: 0 4px 16px rgba(184, 134, 11, 0.4);
}

.site-logo-sm {
  width: 36px;
  height: 36px;
}

.site-logo-lg {
  width: 64px;
  height: 64px;
}

.site-title h1 {
  font-size: 22px;
  margin: 0;
  color: var(--text-main);
}

.site-title p {
  font-size: 13px;
  color: var(--gold-primary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Nav links */
nav.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

nav.site-nav a {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  padding: 6px 4px;
  position: relative;
}

nav.site-nav a.active,
nav.site-nav a:hover {
  color: var(--red-seal);
}

nav.site-nav a.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--gold-accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-main);
  color: var(--text-main);
  font-size: 20px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Layout container */
.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 40px 20px;
  width: 100%;
  flex: 1;
}

/* Hero Section */
.hero {
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  padding: 48px 36px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-soft);
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 36px;
  align-items: center;
  position: relative;
}

.hero::after {
  content: "🪷";
  position: absolute;
  bottom: 12px;
  right: 18px;
  font-size: 32px;
  opacity: 0.2;
}

.hero-portrait {
  position: relative;
  text-align: center;
}

.hero-portrait img {
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  border: 4px solid var(--border-main);
  box-shadow: var(--shadow-hover);
}

.hero-caption {
  margin-top: 10px;
  font-size: 14px;
  font-style: italic;
  color: var(--gold-primary);
}

.hero-content h2 {
  font-size: 28px;
  margin-bottom: 12px;
  color: var(--red-seal);
}

.hero-content .subtitle {
  font-size: 16px;
  color: var(--gold-accent);
  margin-bottom: 18px;
  font-weight: 500;
}

.hero-content p {
  margin-bottom: 20px;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
}

.btn-primary {
  background: var(--red-seal);
  color: #FFFFFF !important;
  border-color: var(--red-seal);
}

.btn-primary:hover {
  background: #A62F2B;
  box-shadow: 0 4px 12px rgba(140, 37, 34, 0.25);
}

.btn-gold {
  background: var(--gold-primary);
  color: #FFFFFF !important;
  border-color: var(--gold-primary);
}

.btn-gold:hover {
  background: var(--gold-accent);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-main);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--gold-accent);
  color: var(--gold-primary);
  background: var(--bg-subtle);
}

/* Cards & Grid */
.section-title {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
}

.section-title h2 {
  font-size: 26px;
  display: inline-block;
  padding-bottom: 8px;
  position: relative;
}

.section-title h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 25%;
  width: 50%;
  height: 2px;
  background: var(--gold-accent);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--gold-accent);
}

.card-date {
  font-size: 13px;
  color: var(--gold-primary);
  margin-bottom: 8px;
}

.card-title {
  font-size: 20px;
  margin-bottom: 12px;
  color: var(--text-main);
}

.card-excerpt {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 16px;
  flex: 1;
}

/* Gallery Grid & Lightbox */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.gallery-item {
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.gallery-item:hover {
  transform: translateY(-4px);
  border-color: var(--gold-accent);
  box-shadow: var(--shadow-hover);
}

.gallery-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-subtle);
  transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-thumb {
  transform: scale(1.02);
}

.gallery-caption {
  padding: 12px 14px;
  font-size: 14px;
  font-style: italic;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

/* Lightbox Modal */
.lightbox-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(18, 13, 9, 0.92);
  backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-content {
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: var(--radius-md);
  border: 3px solid var(--gold-accent);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.lightbox-text {
  margin-top: 14px;
  color: #F5F0E6;
  font-family: var(--font-serif);
  font-size: 16px;
  text-align: center;
  max-width: 700px;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-main);
  background: var(--bg-card);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 15px;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--gold-accent);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.2);
}

textarea.form-control {
  min-height: 130px;
  resize: vertical;
}

/* Biography / Article Content styling */
.article-body {
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  padding: 36px 40px;
  box-shadow: var(--shadow-soft);
  font-size: 17px;
  line-height: 1.85;
}

.article-body h2, .article-body h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--red-seal);
}

.article-body p {
  margin-bottom: 16px;
  text-align: justify;
}

/* Footer */
footer.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-main);
  padding: 36px 20px 24px;
  margin-top: auto;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

.footer-inner {
  max-width: 1160px;
  margin: 0 auto;
}

.footer-lotus {
  font-size: 24px;
  color: var(--gold-accent);
  margin-bottom: 8px;
}

.footer-links {
  margin: 14px 0;
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-admin-link {
  opacity: 0.5;
  font-size: 12px;
}

.footer-admin-link:hover {
  opacity: 1;
}

/* Toast Message */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text-main);
  color: var(--bg-main);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: 10000;
  box-shadow: var(--shadow-hover);
  border-left: 4px solid var(--gold-accent);
  transition: opacity 0.3s ease;
}

/* Responsive */
@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 30px 20px;
    text-align: center;
  }
  .hero-actions {
    justify-content: center;
  }
  .nav-toggle {
    display: block;
  }
  nav.site-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    border-bottom: 2px solid var(--border-main);
    padding: 16px 20px;
    gap: 12px;
    box-shadow: var(--shadow-hover);
  }
  nav.site-nav.open {
    display: flex;
  }
  .article-body {
    padding: 24px 20px;
  }
}

/* Quill WYSIWYG Editor Styling (Trải nghiệm như MS Word) */
.ql-toolbar.ql-snow {
  background: var(--bg-subtle) !important;
  border-color: var(--border-main) !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
  font-family: var(--font-sans) !important;
  padding: 8px 12px !important;
}

.ql-container.ql-snow {
  background: var(--bg-card) !important;
  border-color: var(--border-main) !important;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
  font-family: var(--font-sans) !important;
  font-size: 16px !important;
  min-height: 220px !important;
  color: var(--text-main) !important;
}

.ql-editor {
  line-height: 1.85 !important;
  min-height: 200px !important;
  padding: 16px 20px !important;
}

.ql-editor p {
  margin-bottom: 12px !important;
}

.ql-editor h2, .ql-editor h3 {
  color: var(--red-seal) !important;
  font-family: var(--font-serif) !important;
  margin-top: 16px !important;
  margin-bottom: 8px !important;
}

[data-theme="dark"] .ql-snow .ql-stroke {
  stroke: var(--text-main) !important;
}

[data-theme="dark"] .ql-snow .ql-fill {
  fill: var(--text-main) !important;
}

[data-theme="dark"] .ql-snow .ql-picker {
  color: var(--text-main) !important;
}

[data-theme="dark"] .ql-snow .ql-picker-options {
  background-color: var(--bg-card) !important;
  border-color: var(--border-main) !important;
}

