/* ============================================================
   MS Creative School – Dynamic CSS
   Scroll bar, dark mode, popup, search, cursor, particles…
============================================================ */

/* ── SCROLL PROGRESS ── */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  width: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary-light));
  z-index: 9999;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(245,166,35,0.6);
}

/* ── PAGE TRANSITION ── */
#page-transition {
  position: fixed; inset: 0;
  background: var(--gradient);
  z-index: 99999;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.77, 0, 0.18, 1);
  pointer-events: none;
}
#page-transition.active { transform: translateX(0); }

/* ── WHATSAPP FLOAT ── */
.whatsapp-float {
  position: fixed;
  bottom: 90px;
  right: 28px;
  z-index: 998;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.wa-btn {
  width: 54px;
  height: 54px;
  background: #25d366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  box-shadow: 0 4px 20px rgba(37,211,102,0.5);
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  position: relative;
}
.wa-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid rgba(37,211,102,0.4);
  animation: waPulse 2s infinite;
}
@keyframes waPulse {
  0%   { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}
.wa-btn:hover { transform: scale(1.1) rotate(-5deg); box-shadow: 0 8px 30px rgba(37,211,102,0.7); }

.wa-tooltip {
  background: #fff;
  color: #333;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0,0,0,0.12);
  white-space: nowrap;
  position: absolute;
  right: 64px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.wa-tooltip::after {
  content: '';
  position: absolute;
  right: -6px; top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: #fff;
}
.wa-btn:hover .wa-tooltip { opacity: 1; }

/* ── ADMISSION POPUP ── */
#admission-popup {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9995;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0; visibility: hidden;
  transition: all 0.4s ease;
  backdrop-filter: blur(4px);
}
#admission-popup.open { opacity: 1; visibility: visible; }

.popup-box {
  background: #fff;
  border-radius: 20px;
  max-width: 520px;
  width: 90%;
  overflow: hidden;
  transform: scale(0.85) translateY(30px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
}
#admission-popup.open .popup-box { transform: scale(1) translateY(0); }

.popup-header {
  background: var(--gradient);
  padding: 30px;
  text-align: center;
  color: #fff;
  position: relative;
}
.popup-header .popup-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
  animation: float 3s ease-in-out infinite;
}
.popup-header h3 { font-size: 1.5rem; margin-bottom: 6px; }
.popup-header p  { font-size: 0.88rem; opacity: 0.9; }

.popup-close {
  position: absolute;
  top: 14px; right: 16px;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: 0.8;
  transition: all 0.2s;
  background: rgba(255,255,255,0.15);
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-close:hover { opacity: 1; transform: rotate(90deg); background: rgba(255,255,255,0.3); }

.popup-body { padding: 28px 30px; }

.popup-perks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.perk-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-dark);
}
.perk-item i { color: var(--primary); font-size: 1rem; }

.popup-btns { display: flex; gap: 10px; }
.popup-btns a { flex: 1; text-align: center; }

/* ── SEARCH OVERLAY ── */
#search-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9990;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  opacity: 0; visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}
#search-overlay.open { opacity: 1; visibility: visible; }

.search-box {
  background: #fff;
  border-radius: 20px;
  width: 90%;
  max-width: 640px;
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}
#search-overlay.open .search-box { transform: translateY(0); }

.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  gap: 14px;
}
.search-input-wrap i { font-size: 1.2rem; color: var(--primary); }
.search-input-wrap input {
  flex: 1; border: none; outline: none;
  font-size: 1.1rem; font-family: 'Poppins', sans-serif;
  color: var(--text-dark);
  background: transparent;
}
.search-input-wrap .s-close {
  cursor: pointer; font-size: 1rem;
  color: var(--text-muted);
  transition: color 0.2s;
}
.search-input-wrap .s-close:hover { color: var(--primary); }

#search-results { padding: 10px 12px 12px; max-height: 400px; overflow-y: auto; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-dark);
}
.search-result-item:hover { background: var(--light-green); }
.sri-icon {
  width: 38px; height: 38px;
  background: var(--light-green);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 0.9rem;
  flex-shrink: 0;
}
.sri-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 2px; }
.sri-desc  { font-size: 0.78rem; color: var(--text-muted); }
.sri-arrow { margin-left: auto; color: var(--text-muted); font-size: 0.8rem; }
.search-result-item:hover .sri-arrow { color: var(--primary); }
#search-results mark { background: rgba(245,166,35,0.3); border-radius: 2px; padding: 0 2px; }

.search-no-result {
  text-align: center; padding: 30px 20px;
  color: var(--text-muted);
}
.search-no-result i { font-size: 2rem; margin-bottom: 10px; display: block; opacity: 0.4; }

/* ── DARK MODE ── */
.dark-mode {
  --text-dark: #e8f5ee;
  --text-muted: #a0b8a8;
  --white: #1a2a22;
  --off-white: #142018;
  --light-green: #1e3228;
  --border: #2a4535;
}
.dark-mode body { background: #142018; }
.dark-mode .navbar { background: #1a2a22; box-shadow: 0 2px 20px rgba(0,0,0,0.4); }
.dark-mode .news-card,
.dark-mode .program-card,
.dark-mode .why-card,
.dark-mode .contact-form-wrap,
.dark-mode .contact-card,
.dark-mode .faq-q,
.dark-mode .vm-card { background: #1a2a22; }
.dark-mode .footer { background: #0c1a10; }
.dark-mode .top-bar { background: #0a1510; }
.dark-mode .form-group input,
.dark-mode .form-group select,
.dark-mode .form-group textarea { background: #1e3228; color: #e8f5ee; border-color: #2a4535; }
.dark-mode .activity-card img { filter: brightness(0.85); }
.dark-mode .feature-item { background: #1e3228; }
.dark-mode .search-box { background: #1a2a22; }
.dark-mode .search-input-wrap input { color: #e8f5ee; }

/* Dark toggle button */
#dark-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--light-green);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--primary);
  transition: all 0.3s ease;
}
#dark-toggle:hover { background: var(--primary); color: #fff; transform: rotate(20deg); }

/* ── COOKIE CONSENT ── */
#cookie-consent {
  position: fixed;
  bottom: -120px;
  left: 0; right: 0;
  background: var(--primary-dark);
  color: #fff;
  padding: 16px 24px;
  z-index: 9980;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  transition: bottom 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
}
#cookie-consent.show { bottom: 0; }
.cookie-text { font-size: 0.88rem; opacity: 0.9; flex: 1; }
.cookie-text a { color: var(--accent); }
.cookie-btns { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btns button {
  padding: 8px 20px;
  border-radius: 50px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
#cookie-accept  { background: var(--accent); color: #fff; }
#cookie-decline { background: transparent; color: rgba(255,255,255,0.7); border: 1px solid rgba(255,255,255,0.3); }
#cookie-accept:hover  { background: var(--accent-dark); }
#cookie-decline:hover { background: rgba(255,255,255,0.1); }

/* ── CURSOR ── */
#cursor-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 99998;
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease;
}
#cursor-ring {
  width: 36px; height: 36px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 99997;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s, border-color 0.3s;
  opacity: 0.6;
}
#cursor-ring.ring-hover {
  width: 52px; height: 52px;
  border-color: var(--accent);
  opacity: 1;
}
@media (max-width: 768px) {
  #cursor-dot, #cursor-ring { display: none; }
}

/* ── RIPPLE ── */
.btn { position: relative; overflow: hidden; }
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transform: scale(0);
  animation: rippleAnim 0.6s ease-out forwards;
  pointer-events: none;
}
@keyframes rippleAnim {
  to { transform: scale(2.5); opacity: 0; }
}

/* ── COUNTDOWN ── */
.countdown-wrap {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.cd-box {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  min-width: 80px;
  backdrop-filter: blur(6px);
}
.cd-num {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  font-family: 'Playfair Display', serif;
  line-height: 1;
  display: block;
}
.cd-label {
  font-size: 0.72rem;
  opacity: 0.8;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
  display: block;
}
.cd-live {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  animation: pulse 1s infinite;
}

/* ── NOTICE BOARD ── */
.nb-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.nb-item:last-child { border-bottom: none; }
.nb-dot {
  width: 10px; height: 10px;
  background: var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}
.nb-dot-new { background: var(--primary); box-shadow: 0 0 0 3px rgba(26,107,60,0.2); }
.nb-content p { font-size: 0.88rem; margin-bottom: 4px; line-height: 1.5; }
.nb-content small { font-size: 0.75rem; color: var(--text-muted); }

/* ── NEW BADGE ── */
.new-badge {
  background: #e74c3c;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  margin-right: 4px;
  vertical-align: middle;
}

/* ── UPCOMING EVENTS CARD ── */
.event-item-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  transition: var(--transition);
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.event-item-card:hover { transform: translateX(6px); border-color: var(--primary); box-shadow: var(--shadow); }

.eic-date {
  background: var(--gradient);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-align: center;
  color: #fff;
  flex-shrink: 0;
  min-width: 56px;
}
.eic-day   { font-size: 1.6rem; font-weight: 700; font-family: 'Playfair Display', serif; line-height: 1; display: block; }
.eic-month { font-size: 0.72rem; letter-spacing: 1px; text-transform: uppercase; display: block; margin-top: 2px; }

.eic-body { display: flex; align-items: center; gap: 12px; flex: 1; }
.eic-icon {
  width: 40px; height: 40px;
  background: var(--light-green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 1rem;
  flex-shrink: 0;
}
.eic-body h4 { font-family: 'Poppins', sans-serif; font-size: 0.95rem; margin-bottom: 4px; }
.eic-body p  { font-size: 0.78rem; color: var(--text-muted); }

/* ── STAT BARS ── */
.stat-bar-wrap { margin-bottom: 16px; }
.stat-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-dark);
}
.stat-bar-track {
  height: 8px;
  background: var(--light-green);
  border-radius: 4px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 4px;
  width: 0;
  transition: width 1.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ── TYPEWRITER ── */
.typewriter-text {
  border-right: 3px solid var(--accent);
  padding-right: 4px;
  animation: blink 0.75s step-end infinite;
  white-space: nowrap;
}
@keyframes blink {
  0%, 100% { border-color: var(--accent); }
  50%       { border-color: transparent; }
}

/* ── AUTHOR AVATAR ── */
.author-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
  font-family: 'Poppins', sans-serif;
  border: 2px solid rgba(255,255,255,0.3);
}

/* ── GALLERY CAT BADGE ── */
.gallery-cat-badge {
  font-size: 0.72rem;
  background: var(--accent);
  color: #fff;
  padding: 2px 10px;
  border-radius: 50px;
  margin-top: 4px;
}

/* ── SEARCH KEYBOARD HINT ── */
.search-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 10px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}
.search-hint kbd {
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-family: monospace;
}

/* ── NOTIFICATION BELL ── */
.notif-btn {
  position: relative;
  cursor: pointer;
}
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: #e74c3c;
  border-radius: 50%;
  font-size: 0.65rem;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  animation: pulse 2s infinite;
}

/* ── NOTICE POPUP ── */
#notice-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9989;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}
#notice-modal.open { opacity: 1; visibility: visible; }
.notice-modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
#notice-modal.open .notice-modal-box { transform: scale(1); }
.nm-header {
  background: var(--gradient);
  color: #fff;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nm-header h3 { font-family: 'Poppins', sans-serif; font-size: 1rem; }
.nm-close { cursor: pointer; font-size: 1.2rem; opacity: 0.8; }
.nm-close:hover { opacity: 1; }
.nm-body { padding: 16px 24px; overflow-y: auto; flex: 1; }

/* ── SCROLL REVEAL CUSTOM ── */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .popup-perks { grid-template-columns: 1fr 1fr; gap: 8px; }
  .popup-btns { flex-direction: column; }
  .popup-btns a { text-align: center; justify-content: center; }
  .popup-box { width: 96vw !important; padding: 0 !important; border-radius: 16px !important; }
  .popup-header { padding: 20px 18px; border-radius: 16px 16px 0 0; }
  .popup-header .popup-icon { font-size: 2rem; }
  .popup-header h3 { font-size: 1.2rem; }
  .popup-body { padding: 18px; }
  #cookie-consent { flex-direction: column; text-align: center; padding: 16px; }
  .countdown-wrap { gap: 10px; }
  .cd-box { min-width: 64px; padding: 12px; }
  .cd-num { font-size: 1.8rem; }

  /* WhatsApp on mobile */
  .whatsapp-float { bottom: 20px; right: 16px; }
  .wa-btn { width: 48px; height: 48px; font-size: 1.3rem; }

  /* Search overlay */
  #search-overlay .search-box { width: 92vw; padding: 14px 16px; font-size: 1.1rem; }
  .search-results { max-height: 50vh; }

  /* Admission popup */
  #admission-popup .popup-box { width: 95vw; padding: 20px 16px; }
  .perks-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Events card */
  .event-item-card { padding: 12px 14px; gap: 10px; }
  .eic-body { flex-direction: column; align-items: flex-start; gap: 6px; }

  /* Notice modal */
  .notice-modal-box { width: 96%; }
  .nm-body { padding: 12px 16px; }

  /* Ticker */
  .ticker-move { animation-duration: 20s; }

  /* Stat bars */
  .stat-bar-wrap { margin-bottom: 12px; }
}

@media (max-width: 480px) {
  /* Cookie */
  #cookie-consent { padding: 12px; }
  .cookie-text { font-size: 0.78rem; }
  .cookie-btns button { padding: 7px 14px; font-size: 0.78rem; }

  /* Admission popup */
  .perks-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .perk-item { padding: 12px 8px; }

  /* Countdown */
  .countdown-wrap { gap: 8px; }
  .cd-box { min-width: 56px; padding: 10px 8px; }
  .cd-num { font-size: 1.5rem; }
  .cd-label { font-size: 0.58rem; letter-spacing: 1px; }

  /* WhatsApp */
  .wa-btn { width: 44px; height: 44px; font-size: 1.1rem; }

  /* Events */
  .eic-date { padding: 8px 10px; min-width: 46px; }
  .eic-day { font-size: 1.3rem; }
}

/* Disable heavy animations on mobile for performance */
@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
  #page-transition { transition: transform 0.25s ease; }
}
