/* ==========================================================================
   St. Thomas Church Chempu - 52 Themes Switcher & Dark Mode Styles
   ========================================================================== */

/* Floating Theme Launcher Button (Bottom Left) */
.theme-launcher-wrap {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 9998;
}

.theme-launcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--primary-deep, #0f1c3f);
  color: #ffffff;
  border: 2px solid var(--gold-primary, #d4a34b);
  border-radius: var(--radius-full, 9999px);
  padding: 0.65rem 1.25rem;
  font-family: var(--font-sans, sans-serif);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.theme-launcher-btn:hover {
  transform: translateY(-3px) scale(1.03);
  background: var(--primary, #182e66);
  border-color: var(--gold-glow, #eec578);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 15px var(--gold-subtle);
}

.theme-launcher-btn i {
  color: var(--gold-primary, #d4a34b);
  font-size: 1.1rem;
}

.theme-active-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
  display: inline-block;
}

/* Theme Drawer Backdrop */
.theme-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 30, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.theme-drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* Theme Drawer Panel (Slide from Left) */
.theme-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 540px;
  max-width: 92vw;
  height: 100vh;
  background: #ffffff;
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.35);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.theme-drawer.open {
  transform: translateX(0);
}

/* Drawer Header */
.theme-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem 1.8rem;
  background: linear-gradient(135deg, var(--primary-deep, #0f1c3f), var(--primary, #182e66));
  color: #ffffff;
  border-bottom: 2px solid var(--gold-primary, #d4a34b);
}

.theme-header-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.theme-header-title h3 {
  font-family: var(--font-heading, serif);
  font-size: 1.35rem;
  color: #ffffff;
  margin: 0;
}

.theme-header-title .theme-icon {
  color: var(--gold-primary, #d4a34b);
  font-size: 1.25rem;
}

.theme-count-badge {
  background: rgba(212, 163, 75, 0.25);
  color: var(--gold-glow, #eec578);
  border: 1px solid var(--gold-primary, #d4a34b);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full, 9999px);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theme-header-desc {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
  margin: 0;
}

.theme-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.theme-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

/* Toolbar: Search, Categories, Quick Actions */
.theme-drawer-toolbar {
  padding: 1.1rem 1.6rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.theme-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.theme-search-box i {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  font-size: 0.95rem;
}

.theme-search-box input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-search-box input:focus {
  border-color: var(--primary, #182e66);
  box-shadow: 0 0 0 3px rgba(24, 46, 102, 0.12);
}

.theme-category-pills {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.theme-cat-pill {
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full, 9999px);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.theme-cat-pill:hover {
  border-color: var(--primary, #182e66);
  color: var(--primary, #182e66);
}

.theme-cat-pill.active {
  background: var(--primary-deep, #0f1c3f);
  color: #ffffff;
  border-color: var(--primary-deep, #0f1c3f);
}

.theme-quick-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

.theme-action-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 0.32rem 0.75rem;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.theme-action-btn:hover {
  background: #f1f5f9;
  color: var(--primary-deep, #0f1c3f);
  border-color: #94a3b8;
}

/* Cards Container */
.theme-cards-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.4rem 1.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.1rem;
  align-content: flex-start;
  background: #f8fafc;
}

/* Individual Theme Card */
.theme-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.theme-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-light, #28448f);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.theme-card.active {
  border-color: var(--gold-primary, #d4a34b);
  background: #fffdf9;
  box-shadow: 0 0 0 2px var(--gold-primary, #d4a34b), 0 6px 18px rgba(212, 163, 75, 0.18);
}

.theme-card.is-dark-theme {
  background: #1e293b;
  border-color: #334155;
}

.theme-card.is-dark-theme .theme-card-title {
  color: #f8fafc;
}

.theme-card.is-dark-theme .theme-card-malayalam {
  color: #94a3b8;
}

.theme-swatch-strip {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  border: 1.5px solid #ffffff;
  flex-shrink: 0;
}

.swatch-bg-dot {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  margin-left: auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.theme-card-body {
  flex: 1;
}

.theme-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
  margin-bottom: 2px;
}

.theme-card-malayalam {
  font-size: 0.76rem;
  color: #64748b;
  font-family: var(--font-malayalam, sans-serif);
}

.theme-card-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.theme-cat-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
}

.theme-cat-tag.cathedral { background: #fef3c7; color: #92400e; }
.theme-cat-tag.heritage { background: #fee2e2; color: #991b1b; }
.theme-cat-tag.kerala { background: #dcfce7; color: #166534; }
.theme-cat-tag.modern { background: #e0f2fe; color: #075985; }
.theme-cat-tag.dark { background: #1e1b4b; color: #c7d2fe; }

.theme-dark-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: #0f172a;
  color: #fbbf24;
}

.theme-active-indicator {
  display: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: #16a34a;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}

.theme-card.active .theme-active-indicator {
  display: inline-flex;
}

.theme-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
}

/* Drawer Footer */
.theme-drawer-footer {
  padding: 1rem 1.6rem;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #64748b;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.theme-admin-link {
  color: var(--primary-deep, #0f1c3f);
  font-weight: 700;
  text-decoration: underline;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==========================================================================
   Dark Theme Site Overrides (Applied when a dark palette is chosen)
   ========================================================================== */
.dark-theme {
  --bg-main: #090d13;
  --bg-card: #131820;
  --bg-card-subtle: #181f2a;
  --text-main: #f0f3f6;
  --text-muted: #94a3b8;
  --border-light: rgba(255, 255, 255, 0.12);
}

.dark-theme body {
  background-color: var(--bg-main) !important;
  color: var(--text-main) !important;
}

.dark-theme .main-header {
  background: rgba(15, 22, 33, 0.94) !important;
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

.dark-theme .church-brand .brand-text h1 {
  color: #ffffff !important;
}

.dark-theme .nav-links a {
  color: #cbd5e1 !important;
}

.dark-theme .nav-links a:hover,
.dark-theme .nav-links a.active {
  color: var(--gold-primary) !important;
}

.dark-theme .section-title,
.dark-theme .history-text h3,
.dark-theme .kandathil-compact-title,
.dark-theme .sd-title,
.dark-theme .institutions-title,
.dark-theme .institution-meta h4 {
  color: #ffffff !important;
}

.dark-theme .section-lead,
.dark-theme .institutions-subtitle {
  color: #94a3b8 !important;
}

.dark-theme .bg-alt {
  background-color: var(--bg-card-subtle) !important;
}

.dark-theme .mass-card,
.dark-theme .assoc-card,
.dark-theme .kandathil-compact-card,
.dark-theme .sd-convent-card,
.dark-theme .filial-church-card,
.dark-theme .institution-card {
  background: var(--bg-card) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.dark-theme .mass-card h3,
.dark-theme .assoc-card,
.dark-theme .history-milestones .milestone-info h5 {
  color: #f1f5f9 !important;
}

.dark-theme .kandathil-compact-pill {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.dark-theme .main-footer {
  background: #06090e !important;
}

/* Responsive adjustments for Theme Drawer */
@media (max-width: 600px) {
  .theme-drawer {
    width: 100vw;
    max-width: 100vw;
  }
  .theme-cards-container {
    grid-template-columns: 1fr;
  }
  .theme-launcher-wrap {
    bottom: 18px;
    left: 18px;
    z-index: 9990;
  }
  .theme-launcher-btn {
    padding: 0.48rem 0.85rem;
    font-size: 0.78rem;
    gap: 0.45rem;
    opacity: 0.92;
  }
  .theme-drawer-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

