/* ===========================
   Royal High School Nyom — SPA Styles
   =========================== */

/* ------- Base ------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ------- Navigation ------- */
.nav-link {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  border-radius: 0.5rem;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
}
.nav-link:hover {
  color: #2b4798;
  background-color: #eef1f8;
}
.nav-link.active {
  color: #2b4798;
  background-color: #eef1f8;
  font-weight: 600;
}

/* Dropdown menus */
.nav-dropdown .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  width: 16rem;
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
  border: 1px solid #f3f4f6;
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
  transition: all 0.2s;
  z-index: 50;
}
.nav-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  transition: background-color 0.15s;
  text-decoration: none;
  color: inherit;
}
.dropdown-item:hover {
  background-color: #eef1f8;
}

/* ------- Sidebar ------- */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  color: #374151;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
}
.sidebar-link:hover {
  background-color: #eef1f8;
  color: #2b4798;
}
.sidebar-link.active {
  background-color: #eef1f8;
  color: #2b4798;
}

/* ------- Modal animation ------- */
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.animate-modal-in { animation: modal-in 0.2s ease-out; }

/* ------- Counter animation ------- */
@keyframes countUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------- Page transitions ------- */
#page-content {
  transition: opacity 0.3s ease, transform 0.3s ease;
}
#page-content.page-fade-out {
  opacity: 0;
  transform: translateY(8px);
}
#page-content.page-fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* ------- Line clamp ------- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------- Gallery item hover ------- */
.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}
.gallery-item:hover::after { opacity: 1; }

/* ------- Scrollbar ------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #2b4798; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #1b2d62; }

/* ------- Selection ------- */
::selection { background: #2b4798; color: #fff; }

/* ------- Focus visible ------- */
:focus-visible {
  outline: 2px solid #2b4798;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------- Hover lift ------- */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s cubic-bezier(0.4,0,0.2,1);
}
.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* ------- Card premium ------- */
.card-premium {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.05);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}
.card-premium:hover {
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  transform: translateY(-4px);
}

/* ------- Scroll progress bar ------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #2b4798, #5e75be);
  z-index: 9999;
  transition: width 0.1s ease-out;
}

/* ------- Section helpers ------- */
.section { padding: 4rem 1rem; }
@media (min-width: 768px) { .section { padding: 5rem 2rem; } }
@media (min-width: 1024px) { .section { padding: 6rem 4rem; } }

/* ------- Timeline ------- */
.timeline-item {
  position: relative;
  padding-left: 2rem;
  padding-bottom: 2rem;
  border-left: 2px solid #2b4798;
}
.timeline-dot {
  position: absolute;
  left: -9px;
  top: 0;
  width: 18px;
  height: 18px;
  background: #2b4798;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* ------- Dark mode ------- */
.dark body { background-color: #0f172a; color: #f1f5f9; }

.dark #main-nav {
  background-color: #1e293b !important;
  border-color: #334155;
}
.dark #main-nav .nav-link { color: #cbd5e1; }
.dark #main-nav .nav-link:hover,
.dark #main-nav .nav-link.active { color: #60a5fa; background-color: #334155; }

.dark .nav-dropdown .dropdown-menu { background: #1e293b; border-color: #334155; }
.dark .dropdown-item { color: #cbd5e1; }
.dark .dropdown-item:hover { background: #334155; color: #60a5fa; }

.dark #sidebar { background-color: #1e293b; }
.dark .sidebar-link { color: #cbd5e1; }
.dark .sidebar-link:hover,
.dark .sidebar-link.active { background: #334155; color: #60a5fa; }

.dark footer { background-color: #0b1120 !important; }

.dark #page-content { background-color: #0f172a; }
.dark #page-content section { color: #e2e8f0; }
.dark #page-content .bg-white { background-color: #1e293b !important; }
.dark #page-content .bg-gray-50,
.dark #page-content .bg-gray-100 { background-color: #162036 !important; }
.dark #page-content .text-dark,
.dark #page-content .text-gray-900 { color: #f1f5f9 !important; }
.dark #page-content .text-gray-600,
.dark #page-content .text-gray-500,
.dark #page-content .text-gray-700 { color: #94a3b8 !important; }
.dark #page-content .border-gray-100,
.dark #page-content .border-gray-200 { border-color: #334155 !important; }
.dark #page-content .shadow-lg,
.dark #page-content .shadow-xl { box-shadow: 0 10px 25px rgba(0,0,0,0.3) !important; }

.dark .card-premium { background: #1e293b; border-color: #334155; }
.dark .hover-lift:hover { box-shadow: 0 20px 40px rgba(0,0,0,0.4); }

/* Modal dark mode */
.dark #modal-container .bg-white { background-color: #1e293b !important; }
.dark #modal-container .text-dark { color: #f1f5f9 !important; }
.dark #modal-container .text-gray-600 { color: #94a3b8 !important; }
.dark #modal-container .border-gray-100 { border-color: #334155 !important; }

.dark input,
.dark select,
.dark textarea {
  background-color: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

/* ------- Hero image rendering ------- */
.hero-img {
  object-position: center 30%;
  filter: brightness(0.85);
}

/* ------- Glass card ------- */
.glass-card {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 1rem;
}

/* ------- Stats counter chip ------- */
.stat-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 2rem;
  background: rgba(255,255,255,0.1);
  border-radius: 1rem;
  border: 1px solid rgba(255,255,255,0.15);
  transition: background 0.3s;
}
.stat-chip:hover { background: rgba(255,255,255,0.18); }

/* ------- Section title divider ------- */
.section-title::after {
  content: '';
  display: block;
  width: 3rem;
  height: 3px;
  background: #2b4798;
  border-radius: 2px;
  margin: 0.75rem auto 0;
}
.section-title.left::after { margin-left: 0; }

/* ------- Image zoom on card ------- */
.img-zoom img {
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.img-zoom:hover img { transform: scale(1.08); }

/* ------- Gradient text ------- */
.text-gradient {
  background: linear-gradient(135deg, #5e75be, #2b4798);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ------- Badge pill ------- */
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  backdrop-filter: blur(8px);
}
.badge-live .dot {
  width: 7px; height: 7px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

/* ------- News category badge ------- */
.cat-admissions { background: #fef3c7; color: #92400e; }
.cat-events { background: #dbeafe; color: #1e40af; }
.cat-academics { background: #d1fae5; color: #065f46; }
.cat-activities { background: #ede9fe; color: #5b21b6; }
.cat-campus { background: #fce7f3; color: #9d174d; }

/* ------- Testimonial star ------- */
.star-filled { color: #fbbf24; }

/* ------- Fade in up utility ------- */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-up { animation: fade-in-up 0.6s ease-out forwards; }

/* ------- WOW.js Animations (Animate.css) ------- */
.wow {
  visibility: hidden;
}
.wow.animated {
  visibility: visible;
}

/* Custom WOW animation timings */
@keyframes slideInFromLeft {
  from { transform: translateX(-100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideInFromRight {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes scaleInUp {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes flipInX {
  0% { transform: perspective(400px) rotateX(90deg); opacity: 0; }
  100% { transform: perspective(400px) rotateX(0deg); opacity: 1; }
}
@keyframes countUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.slideInLeft { animation: slideInLeft 0.6s ease-out; }
.slideInRight { animation: slideInRight 0.6s ease-out; }
.scaleInUp { animation: scaleInUp 0.6s ease-out; }
.flipInX { animation: flipInX 0.8s ease-out; }
.countUp { animation: countUp 0.5s ease-out; }

/* Hero carousel animations */
.hero-slide {
  animation: fadeInScale 1s ease-out;
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(1.02); }
  to { opacity: 1; transform: scale(1); }
}

/* Card hover lift animation */
@keyframes liftUp {
  from { transform: translateY(0px); box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
  to { transform: translateY(-8px); box-shadow: 0 12px 24px rgba(0,0,0,0.15); }
}
.card-hover { transition: transform 0.3s ease, box-shadow 0.3s ease; }
.card-hover:hover { animation: liftUp 0.3s forwards; }

/* ------- Print ------- */
@media print {
  nav, #sidebar, #sidebar-overlay, #back-to-top, #toast-container, #modal-container, footer { display: none !important; }
  #page-content { padding-top: 0 !important; }
}
