/* ==========================================================================
   SEGi Dental Society — Homepage (`css/main.css`)
   Cinematic Hero, Dynamic Pillars, Slideshow System & Council Showcase
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Cinematic Landing Hero & Dynamic Typography
   -------------------------------------------------------------------------- */
.hero-cinematic-wrapper {
  position: relative;
  min-height: 580px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  margin-top: -1px;
  padding: 5rem 1.5rem;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: brightness(0.65) saturate(1.1);
  transform: scale(1.04);
  transition: transform 10s ease;
  z-index: 1;
}

.hero-cinematic-wrapper:hover .hero-backdrop {
  transform: scale(1.08);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(9, 10, 13, 0.4) 0%, rgba(9, 10, 13, 0.95) 100%),
              linear-gradient(to bottom, rgba(9, 10, 13, 0.3) 0%, #090a0d 100%);
  z-index: 2;
}

body.light-theme .hero-overlay {
  background: radial-gradient(circle at center, rgba(244, 246, 249, 0.4) 0%, rgba(244, 246, 249, 0.95) 100%),
              linear-gradient(to bottom, rgba(244, 246, 249, 0.2) 0%, #f4f6f9 100%);
}

.hero-content {
  position: relative;
  z-index: 3;
  max-width: 860px;
  margin: 0 auto;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  background: rgba(225, 29, 72, 0.12);
  border: 1px solid rgba(225, 29, 72, 0.4);
  color: var(--maroon-bright);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(8px);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--maroon-bright);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--maroon-bright);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%   { transform: scale(0.95); opacity: 0.7; }
  50%  { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.hero-title {
  font-size: clamp(2.4rem, 5.5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  color: #ffffff;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}

body.light-theme .hero-title {
  color: #0f172a;
  text-shadow: none;
}

.gradient-crimson {
  background: linear-gradient(135deg, #ff4d6d 0%, var(--maroon-bright) 50%, #fb7185 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: #e2e8f0;
  font-size: 1.15rem;
  max-width: 680px;
  margin: 0 auto 2.2rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

body.light-theme .hero-subtitle {
  color: #475569;
  text-shadow: none;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* --------------------------------------------------------------------------
   2. Stats Ribbon Counter Bar
   -------------------------------------------------------------------------- */
.stats-ribbon {
  max-width: 860px;
  margin: -2rem auto 4rem;
  padding: 1.5rem 2rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-around;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 4;
}

.stat-number {
  display: block;
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.02em;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border-subtle);
}

/* --------------------------------------------------------------------------
   3. Dynamic Pillar Cards & Slideshow System
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  gap: 1.5rem;
}

.cards-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.pillar-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 420px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease;
}

.pillar-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-crimson);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 0 20px var(--maroon-glow);
}

.card-media {
  width: calc(100% + 3.6rem);
  margin: -1.8rem -1.8rem 1.25rem -1.8rem;
  height: 200px;
  overflow: hidden;
  background: #141721;
  position: relative;
}

.card-img-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease-in-out, transform 4s ease-out;
  transform: scale(1);
}

.card-img-slide.active-slide {
  opacity: 1;
  transform: scale(1.05);
}

.card-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.pillar-card h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  line-height: 1.3;
}

.pillar-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 1.2rem;
  flex-grow: 1;
}

.card-link {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--maroon-bright);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: auto;
  transition: gap 0.2s ease;
}

.card-link:hover {
  gap: 0.6rem;
}

/* --------------------------------------------------------------------------
   4. Pillar Admin Controls & Add Placeholder Slot
   -------------------------------------------------------------------------- */
.pillar-admin-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.pillar-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(9, 10, 13, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--gold-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}

.pillar-btn:hover {
  background: var(--maroon-bright);
  color: #ffffff;
  transform: scale(1.1);
}

.pillar-btn-delete:hover {
  background: #ef4444;
}

.add-pillar-placeholder {
  min-height: 420px;
  border: 2px dashed var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-lg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.25s ease;
}

body.is-admin .add-pillar-placeholder {
  display: flex;
}

.add-pillar-placeholder:hover {
  border-color: var(--maroon-bright);
  background: rgba(158, 16, 39, 0.08);
  color: var(--text-main);
  transform: translateY(-4px);
}

.add-pillar-placeholder .plus-icon {
  font-size: 2.2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px dashed var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.add-pillar-placeholder:hover .plus-icon {
  border-color: var(--maroon-bright);
  background: var(--maroon-bright);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   5. Executive Council Preview Cards & Highlights
   -------------------------------------------------------------------------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.council-card {
  position: relative;
  text-align: center;
  padding: 2.2rem 1.5rem 1.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.council-card:hover {
  transform: translateY(-6px);
  border-color: var(--maroon-vibrant);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 0 20px var(--maroon-glow);
}

.council-card.is-highlighted {
  --hue: 38;
  border-color: hsla(var(--hue), 85%, 55%, 0.45) !important;
  background: linear-gradient(180deg, hsla(var(--hue), 80%, 25%, 0.22) 0%, var(--bg-card) 65%) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 0 24px hsla(var(--hue), 85%, 50%, 0.28) !important;
}

.council-card.is-highlighted .avatar-frame {
  background: linear-gradient(135deg, hsl(var(--hue), 85%, 45%), hsl(calc(var(--hue) + 35), 90%, 60%)) !important;
}

.council-card.is-highlighted .badge-role {
  color: hsl(var(--hue), 90%, 65%) !important;
}

.avatar-frame {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  margin: 0 auto 1.2rem;
  padding: 4px;
  background: linear-gradient(135deg, var(--maroon-vibrant), var(--gold-accent));
  overflow: hidden;
  position: relative;
}

.avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.badge-role {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-accent);
  margin-bottom: 0.4rem;
}

.council-card h3 {
  font-size: 1.2rem;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.council-card .tenure {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.avatar-upload-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.25s ease;
  font-size: 0.75rem;
  color: #ffffff;
  z-index: 3;
}

body.is-admin .avatar-frame:hover .avatar-upload-overlay {
  opacity: 1;
}

.camera-icon {
  font-size: 1.2rem;
  margin-bottom: 2px;
}

/* --------------------------------------------------------------------------
   6. Pillar Configuration Admin Modal & Form Fields
   -------------------------------------------------------------------------- */
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 1rem;
  box-sizing: border-box;
}

.admin-modal.is-active {
  display: flex !important;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: #12151f;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-lg, 16px);
  padding: 1.8rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  box-sizing: border-box;
  color: var(--text-main, #f8fafc);
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

body.light-theme .modal-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  color: #0f172a;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

body.light-theme .modal-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.btn-modal-close:hover {
  color: var(--maroon-bright, #e11d48);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold-accent, #d49a37);
}

.form-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-md, 10px);
  padding: 0.75rem 1rem;
  color: var(--text-main, #f8fafc);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

body.light-theme .form-input {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.form-input:focus {
  border-color: var(--maroon-bright, #e11d48);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

body.light-theme .modal-footer {
  border-top-color: rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   7. Circular Loaders, Updating Overlays & Staggered Animations
   -------------------------------------------------------------------------- */
.section-circular-loader {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 1rem;
}

.spinner-ring {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--maroon-bright, #e11d48);
  border-right-color: var(--gold-accent, #d49a37);
  border-radius: 50%;
  animation: spinRing 0.85s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

body.light-theme .spinner-ring {
  border-color: rgba(0, 0, 0, 0.08);
  border-top-color: var(--maroon-base, #800000);
  border-right-color: var(--gold-accent, #d49a37);
}

@keyframes spinRing {
  to { transform: rotate(360deg); }
}

.spinner-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  letter-spacing: 0.02em;
}

@keyframes pillarPopIn {
  0%   { opacity: 0; transform: translateY(18px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.pillar-card.progressive-reveal {
  animation: pillarPopIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.card-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(9, 10, 13, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border-radius: var(--radius-lg, 16px);
  animation: fadeIn 0.2s ease;
}

body.light-theme .card-loading-overlay {
  background: rgba(255, 255, 255, 0.92);
}

.card-loading-overlay .spinner-ring {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

.card-loading-overlay span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold-accent, #d49a37);
}

.add-pillar-placeholder.is-loading {
  pointer-events: none !important;
  opacity: 0.75;
  border-color: var(--gold-accent, #d49a37) !important;
  background: rgba(212, 154, 55, 0.05) !important;
  cursor: not-allowed !important;
}

.add-pillar-placeholder.is-loading .plus-icon {
  animation: spinRing 0.85s linear infinite;
  border-style: solid;
  border-color: transparent;
  border-top-color: var(--gold-accent, #d49a37);
  border-right-color: var(--maroon-bright, #e11d48);
}

@keyframes cardPopIn {
  0%   { opacity: 0; transform: translateY(16px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.council-card.progressive-reveal {
  animation: cardPopIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#homeTeamGrid .section-circular-loader {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
}

/* --------------------------------------------------------------------------
   8. Responsive Viewport Adaptations
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
  .hero-cinematic-wrapper { min-height: 480px; padding: 4rem 1rem; }
  .stats-ribbon { flex-direction: column; gap: 1.2rem; margin-top: 1rem; }
  .stat-divider { display: none; }
  .hero-actions { flex-direction: column; }
}

/* --------------------------------------------------------------------------
   9. In-Place Hero & Stats Content Editing
   -------------------------------------------------------------------------- */
#homeHeroSection.is-editing,
#statsRibbon.is-editing {
  outline: 2px dashed var(--gold-accent, #d49a37);
  outline-offset: 4px;
  position: relative;
}

#homeHeroSection.is-editing [data-home-field],
#statsRibbon.is-editing [data-home-field] {
  outline: 1px dashed rgba(212, 154, 55, 0.5);
  outline-offset: 3px;
  border-radius: 4px;
  background: rgba(212, 154, 55, 0.08);
  transition: all 0.2s ease;
}

#homeHeroSection.is-editing [data-home-field]:focus,
#statsRibbon.is-editing [data-home-field]:focus {
  outline: 2px solid var(--gold-accent, #d49a37);
  background: rgba(212, 154, 55, 0.16);
}
