/* ========================================================
   ระบบสนับสนุนงาน โรงเรียนบ้านดุงวิทยา (BDW ONE Portal)
   พัฒนาโดย ทีม BDW OONE
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700;800;900&family=Prompt:wght@300;400;500;600;700&family=Sarabun:wght@400;500;600&display=swap');

:root {
  --primary: #7c3aed;
  --primary-light: #9333ea;
  --primary-dark: #581c87;
  --accent-pink: #ec4899;
  --accent-blue: #2563eb;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --bg-dark: #0a0815;
  --bg-surface: rgba(18, 14, 34, 0.75);
  --bg-card: rgba(26, 21, 48, 0.65);
  --bg-card-hover: rgba(38, 30, 70, 0.85);
  --border-glass: rgba(168, 85, 247, 0.22);
  --border-glass-hover: rgba(236, 72, 153, 0.45);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --shadow-glow: 0 0 35px rgba(147, 51, 234, 0.25);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px var(--border-glass);
  --shadow-card-hover: 0 20px 40px -10px rgba(124, 58, 237, 0.35), 0 0 2px 1px var(--border-glass-hover);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Background animated glow orbs */
.bg-ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  will-change: transform;
}
.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
  top: -100px;
  left: -100px;
  animation: floatOrb 20s ease-in-out infinite alternate;
}
.orb-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
  bottom: 5%;
  right: -150px;
  animation: floatOrb 25s ease-in-out infinite alternate-reverse;
}
.orb-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #2563eb 0%, transparent 70%);
  top: 40%;
  left: 30%;
  opacity: 0.22;
  animation: floatOrb 22s ease-in-out infinite alternate;
}
.ambient-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 85%);
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.1); }
  100% { transform: translate(-30px, 50px) scale(0.95); }
}

/* ========================================================
   Header Navigation Bar
   ======================================================== */
.portal-navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(10, 8, 21, 0.78);
  border-bottom: 1px solid rgba(168, 85, 247, 0.18);
  transition: all 0.3s ease;
}

.nav-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}

.brand-logo-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(147, 51, 234, 0.35), transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo-wrap img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(168, 85, 247, 0.5));
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-section:hover .brand-logo-wrap img {
  transform: rotate(15deg) scale(1.12);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: #fff;
  padding: 1px 6px;
  border-radius: 6px;
  letter-spacing: 0.05em;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Nav Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-time-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.nav-time-pill .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  text-decoration: none;
}

.btn-nav:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.btn-nav-replay {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.12);
  color: #e9d5ff;
}
.btn-nav-replay:hover {
  background: rgba(168, 85, 247, 0.25);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.35);
}

.btn-nav-admin {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.btn-nav-admin:hover {
  background: linear-gradient(135deg, #8b5cf6, #a855f7);
  box-shadow: 0 6px 20px rgba(147, 51, 234, 0.5);
}

/* ========================================================
   Hero Section & TITLE Motion
   ======================================================== */
.hero-section {
  max-width: 1320px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 2rem;
  text-align: center;
  position: relative;
}

.hero-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #f0abfc;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
  animation: badgeGlow 3s ease-in-out infinite alternate;
}

@keyframes badgeGlow {
  0% { box-shadow: 0 0 10px rgba(168, 85, 247, 0.15); }
  100% { box-shadow: 0 0 25px rgba(236, 72, 153, 0.35); }
}

/* TITLE Motion Animation */
.hero-title-motion {
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  position: relative;
  display: inline-block;
}

.title-gradient-motion {
  background: linear-gradient(
    90deg,
    #ffffff 0%,
    #f0abfc 20%,
    #c084fc 40%,
    #60a5fa 60%,
    #f0abfc 80%,
    #ffffff 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shineGradient 6s linear infinite;
  display: inline-block;
  filter: drop-shadow(0 2px 20px rgba(168, 85, 247, 0.35));
}

@keyframes shineGradient {
  to { background-position: 200% center; }
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: #cbd5e1;
  max-width: 780px;
  margin: 0 auto 2rem;
  font-weight: 400;
}

.hero-subtitle strong {
  color: #ffffff;
  font-weight: 600;
}

/* Stats / Highlights Bar */
.hero-stats-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 0.88rem;
  color: #e2e8f0;
  backdrop-filter: blur(8px);
}
.stat-pill span.num {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  color: #f0abfc;
}

/* Search & Filter Bar */
.filter-search-wrap {
  max-width: 620px;
  margin: 0 auto 2rem;
  position: relative;
}

.search-input-box {
  width: 100%;
  padding: 14px 20px 14px 50px;
  background: rgba(26, 21, 48, 0.7);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 999px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.search-input-box:focus {
  border-color: rgba(236, 72, 153, 0.6);
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.35);
  background: rgba(30, 24, 58, 0.9);
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 1.1rem;
}

/* ========================================================
   Department Menu Cards Grid
   ======================================================== */
.section-menu-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.75rem;
}

.dept-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  cursor: pointer;
}

.dept-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.dept-card:hover {
  transform: translateY(-6px);
  background: var(--bg-card-hover);
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-card-hover);
}

/* Top Glow Line for Card */
.card-glow-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0.85;
}

/* Color theme variants */
.theme-purple .card-glow-line { background: linear-gradient(90deg, #9333ea, #c026d3); }
.theme-rose .card-glow-line { background: linear-gradient(90deg, #f43f5e, #fb7185); }
.theme-emerald .card-glow-line { background: linear-gradient(90deg, #10b981, #06b6d4); }
.theme-blue .card-glow-line { background: linear-gradient(90deg, #2563eb, #38bdf8); }
.theme-amber .card-glow-line { background: linear-gradient(90deg, #f59e0b, #eab308); }

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.35s ease;
}

.dept-card:hover .card-icon-wrap {
  transform: scale(1.1) rotate(4deg);
}

.theme-purple .card-icon-wrap { background: rgba(147, 51, 234, 0.15); border-color: rgba(147, 51, 234, 0.35); }
.theme-rose .card-icon-wrap { background: rgba(244, 63, 94, 0.15); border-color: rgba(244, 63, 94, 0.35); }
.theme-emerald .card-icon-wrap { background: rgba(16, 185, 129, 0.15); border-color: rgba(16, 185, 129, 0.35); }
.theme-blue .card-icon-wrap { background: rgba(37, 99, 235, 0.15); border-color: rgba(37, 99, 235, 0.35); }

.card-status-pill {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.status-active .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
}

.status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.status-pending .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fbbf24;
}

.card-category {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.65rem;
  line-height: 1.35;
  transition: color 0.2s ease;
}

.dept-card:hover .card-title {
  color: #f0abfc;
}

.card-description {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.btn-open-inapp {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-open-inapp:hover {
  background: linear-gradient(135deg, #8b5cf6, #a855f7);
  box-shadow: 0 6px 20px rgba(147, 51, 234, 0.5);
  transform: translateY(-1px);
}

.btn-open-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  font-size: 1rem;
  transition: all 0.25s ease;
}

.btn-open-ext:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  transform: translateY(-1px);
}

/* ========================================================
   IN-PAGE EMBEDDED SYSTEM VIEWER
   (เปิดภายในหน้าเว็บ ไม่เปิดหน้าใหญ่)
   ======================================================== */
.inapp-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #090813;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.985);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
}

.inapp-viewer-overlay.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* Viewer Top Bar */
.viewer-topbar {
  height: 60px;
  background: rgba(14, 11, 28, 0.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(168, 85, 247, 0.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  gap: 1rem;
  flex-shrink: 0;
  z-index: 10;
}

.viewer-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.btn-viewer-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-viewer-back:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: rgba(168, 85, 247, 0.5);
}

.viewer-sys-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.viewer-sys-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.viewer-sys-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-sys-url-badge {
  font-size: 0.72rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 6px;
  display: none;
}
@media (min-width: 768px) {
  .viewer-sys-url-badge { display: inline-block; }
}

/* Center Quick Switcher */
.viewer-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewer-switch-select {
  background: rgba(26, 21, 48, 0.85);
  color: #e2e8f0;
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  max-width: 260px;
}
.viewer-switch-select option {
  background: #120e24;
  color: #fff;
}

/* Viewer Controls Right */
.viewer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-viewer-ctrl {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}
.btn-viewer-ctrl:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.btn-viewer-close {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fda4af;
}
.btn-viewer-close:hover {
  background: rgba(244, 63, 94, 0.35);
  color: #ffffff;
}

/* Frame Body & Iframe */
.viewer-body {
  position: relative;
  flex: 1;
  width: 100%;
  height: calc(100vh - 60px);
  background: #000;
  overflow: hidden;
}

.viewer-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Loading Skeleton */
.viewer-loading-cover {
  position: absolute;
  inset: 0;
  background: #0a0815;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 5;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.viewer-loading-cover.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.viewer-spinner {
  width: 52px;
  height: 52px;
  border: 3px solid rgba(168, 85, 247, 0.2);
  border-top-color: #ec4899;
  border-right-color: #a855f7;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

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

.viewer-loading-text {
  font-size: 0.95rem;
  color: #cbd5e1;
  font-weight: 500;
}

/* Empty / Pending View in Frame */
.viewer-pending-box {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  background: radial-gradient(circle at center, #1e173a, #0a0815 80%);
  z-index: 4;
}

.pending-graphic {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulseGraphic 2.5s infinite;
}
@keyframes pulseGraphic {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.pending-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.pending-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 500px;
  margin-bottom: 1.75rem;
  line-height: 1.6;
}

.pending-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.4);
}

/* ========================================================
   Admin Backoffice Modal & Panel
   (รหัส ad12340)
   ======================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: #140f2b;
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 35px rgba(168, 85, 247, 0.25);
  overflow: hidden;
  transform: translateY(15px) scale(0.97);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-container {
  transform: translateY(0) scale(1);
}

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

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title-icon {
  font-size: 1.5rem;
}

.modal-title-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}

.btn-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.btn-modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  flex: 1;
}

/* Password View */
.admin-login-box {
  text-align: center;
  padding: 2rem 1rem;
}

.admin-login-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 20px rgba(168, 85, 247, 0.4));
}

.admin-login-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.admin-login-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

.admin-password-wrap {
  max-width: 340px;
  margin: 0 auto 1.5rem;
  position: relative;
}

.admin-password-input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(168, 85, 247, 0.4);
  border-radius: 12px;
  color: #fff;
  font-size: 1.2rem;
  text-align: center;
  letter-spacing: 0.25em;
  outline: none;
  transition: all 0.25s ease;
}

.admin-password-input:focus {
  border-color: #ec4899;
  box-shadow: 0 0 25px rgba(236, 72, 153, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.btn-admin-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 340px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.4);
}
.btn-admin-submit:hover {
  background: linear-gradient(135deg, #8b5cf6, #a855f7);
  box-shadow: 0 6px 24px rgba(147, 51, 234, 0.6);
  transform: translateY(-1px);
}

.admin-error-msg {
  color: #fb7185;
  font-size: 0.88rem;
  margin-top: 10px;
  display: none;
}

/* Admin Dashboard View */
.admin-dashboard-wrap {
  display: none;
}
.admin-dashboard-wrap.active {
  display: block;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.btn-admin-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-admin-add:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.admin-tool-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-admin-sec {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  border-radius: 10px;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-admin-sec:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Admin Menu Item List */
.admin-item-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-item-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.2s ease;
}
.admin-item-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

.item-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.item-order-controls {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-order-arrow {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 0.8rem;
  line-height: 1;
}
.btn-order-arrow:hover { color: #fff; }

.item-icon-badge {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.item-info {
  min-width: 0;
  flex: 1;
}

.item-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.item-main-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-url-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: monospace;
}
.item-url-text.empty {
  color: #fbbf24;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-item-action {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-item-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-item-delete {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
}
.btn-item-delete:hover {
  background: rgba(248, 113, 113, 0.2);
}

/* Edit / Add Item Form Modal (Secondary) */
.form-group {
  margin-bottom: 1.1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #cbd5e1;
  margin-bottom: 0.35rem;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: #ec4899;
  background: rgba(255, 255, 255, 0.09);
}
.form-select option {
  background: #140f2b;
  color: #fff;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Toast Notifications */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100000;
  padding: 12px 20px;
  border-radius: 12px;
  background: rgba(20, 15, 43, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(30px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* ========================================================
   Footer Section
   ======================================================== */
.portal-footer {
  border-top: 1px solid rgba(168, 85, 247, 0.15);
  background: rgba(10, 8, 21, 0.85);
  padding: 3rem 1.5rem 2rem;
  position: relative;
}

.footer-container {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
}

.footer-logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logo-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 2px 10px rgba(168, 85, 247, 0.4));
}

.footer-school-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.footer-affiliation {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-dev-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.18), rgba(236, 72, 153, 0.18));
  border: 1px solid rgba(168, 85, 247, 0.3);
  font-size: 0.88rem;
  color: #f5d0fe;
  font-weight: 500;
}
.footer-dev-pill strong {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.05em;
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .nav-container { padding: 0.75rem 1rem; }
  .brand-name { font-size: 1rem; }
  .brand-sub { display: none; }
  .nav-time-pill { display: none; }
  .hero-section { padding: 2.5rem 1rem 1.5rem; }
  .cards-grid { grid-template-columns: 1fr; }
  .viewer-switch-select { max-width: 160px; font-size: 0.8rem; }
}
