/* ============================================
   RUST University — Enhanced Features CSS
   ============================================ */

/* --- Preloader --- */
.preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.preloader.hidden { opacity: 0; visibility: hidden; }
.preloader-logo {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  animation: preloaderPulse 1.5s ease infinite;
}
.preloader-logo .logo-icon { width: 64px; height: 64px; font-size: 2rem; }
.preloader-logo span { color: var(--white); font-size: 1.5rem; font-weight: 800; letter-spacing: 2px; }
.preloader-bar { width: 120px; height: 3px; background: rgba(255,255,255,0.15); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.preloader-bar::after { content: ''; display: block; width: 40%; height: 100%; background: var(--secondary); border-radius: 3px; animation: preloaderSlide 1s ease infinite; }
@keyframes preloaderPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes preloaderSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

/* --- Scroll Progress Bar --- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; z-index: 1001;
  background: var(--gradient-accent);
  transition: width 0.1s linear;
  width: 0%;
}

/* --- Back to Top --- */
.back-to-top {
  position: fixed; bottom: 96px; right: 24px;
  width: 44px; height: 44px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden;
  transition: var(--transition);
  z-index: 998;
  cursor: pointer;
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { background: var(--secondary); transform: translateY(-3px); color: var(--white); }

/* --- Cookie Consent --- */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--dark);
  color: rgba(255,255,255,0.8);
  padding: 20px 0;
  z-index: 997;
  transform: translateY(100%);
  transition: transform 0.4s ease;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
}
.cookie-banner.visible { transform: translateY(0); }
.cookie-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.cookie-inner p { font-size: 0.85rem; margin: 0; flex: 1; }
.cookie-inner p a { color: var(--secondary-light); text-decoration: underline; }
.cookie-btns { display: flex; gap: 12px; flex-shrink: 0; }
.cookie-btns button {
  padding: 10px 24px; border-radius: 50px; font-size: 0.85rem; font-weight: 600; cursor: pointer; border: none;
}
.cookie-accept { background: var(--secondary); color: white; }
.cookie-decline { background: transparent; color: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.2) !important; }

/* --- Dark Mode --- */
.dark-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
  margin-right: 8px;
  border: none;
  color: white;
}
.dark-toggle:hover { background: rgba(255,255,255,0.2); }

body.dark-mode { --white: #0F1520; --gray-50: #151C2A; --gray-100: #1C2435; --gray-200: #2A3348; --gray-300: #4A5470; --gray-400: #8892A8; --gray-500: #B0B8CC; --gray-600: #D4DAE8; --dark: #0A0E16; }
body.dark-mode { background: #0F1520; color: #B0B8CC; }
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3, body.dark-mode h4 { color: #E8ECF4; }
body.dark-mode .card { background: #151C2A; border-color: #1C2435; }
body.dark-mode .card:hover { box-shadow: 0 8px 40px rgba(0,0,0,0.3); }
body.dark-mode .program-card { background: #151C2A; border-color: #1C2435; }
body.dark-mode .testimonial-card { background: #151C2A; border-color: #1C2435; }
body.dark-mode .news-card { background: #151C2A; border-color: #1C2435; }
body.dark-mode .download-item { background: #151C2A; border-color: #1C2435; }
body.dark-mode .form-control { background: #151C2A; border-color: #2A3348; color: #D4DAE8; }
body.dark-mode .section-alt { background: #0A0E16; }
body.dark-mode .btn-outline { border-color: #2A3348; color: #B0B8CC; }
body.dark-mode .btn-outline:hover { border-color: var(--secondary); color: var(--secondary); }
body.dark-mode .footer { background: #060910; }
body.dark-mode .back-to-top { background: #1C2435; }
body.dark-mode .header.scrolled { background: rgba(15,21,32,0.97); }

/* --- Partner Logos Carousel --- */
.partners-track {
  display: flex;
  animation: scroll-partners 25s linear infinite;
  gap: 60px;
  padding: 20px 0;
}
.partners-track:hover { animation-play-state: paused; }
.partner-logo {
  flex-shrink: 0;
  height: 40px;
  opacity: 0.4;
  filter: grayscale(100%);
  transition: var(--transition);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-300);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.partner-logo:hover { opacity: 1; filter: grayscale(0%); }
.partners-wrap { overflow: hidden; mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent); }
@keyframes scroll-partners { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* --- Newsletter --- */
.newsletter-form {
  display: flex; gap: 8px; margin-top: 16px; max-width: 400px;
}
.newsletter-form input {
  flex: 1; padding: 12px 16px; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05); border-radius: 50px;
  color: white; font-size: 0.85rem;
}
.newsletter-form input::placeholder { color: rgba(255,255,255,0.4); }
.newsletter-form button {
  padding: 12px 24px; background: var(--secondary); color: white;
  border-radius: 50px; font-weight: 600; font-size: 0.85rem;
  border: none; cursor: pointer; transition: var(--transition);
}
.newsletter-form button:hover { background: var(--secondary-light); }

/* --- FAQ Accordion --- */
.faq-item {
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
  transition: var(--transition);
}
.faq-item:hover { border-color: var(--secondary); }
.faq-question {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary);
  background: var(--white);
  transition: var(--transition);
}
body.dark-mode .faq-question { background: #151C2A; color: #D4DAE8; }
.faq-question:hover { background: var(--gray-50); }
body.dark-mode .faq-question:hover { background: #1C2435; }
.faq-icon {
  font-size: 1.2rem; transition: transform 0.3s ease; flex-shrink: 0;
}
.faq-item.active .faq-icon { transform: rotate(45deg); }
.faq-answer {
  max-height: 0; overflow: hidden;
  padding: 0 24px;
  font-size: 0.9rem;
  color: var(--gray-400);
  line-height: 1.8;
  transition: max-height 0.4s ease, padding 0.4s ease;
  background: var(--white);
}
body.dark-mode .faq-answer { background: #151C2A; }
.faq-item.active .faq-answer { max-height: 300px; padding: 0 24px 20px; }

/* --- Mega Menu --- */
.nav-item { position: relative; }
.mega-menu {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(8px);
  min-width: 580px;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 24px;
  opacity: 0; visibility: hidden;
  transition: all 0.25s ease;
  z-index: 100;
  border: 1px solid var(--gray-100);
}
body.dark-mode .mega-menu { background: #151C2A; border-color: #1C2435; }
.nav-item:hover .mega-menu { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.mega-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mega-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  transition: var(--transition); text-decoration: none;
}
.mega-link:hover { background: var(--gray-50); }
body.dark-mode .mega-link:hover { background: #1C2435; }
.mega-link-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(0,168,120,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.mega-link h4 { font-size: 0.85rem; margin-bottom: 2px; }
.mega-link p { font-size: 0.75rem; color: var(--gray-300); margin: 0; }

/* --- Search Overlay --- */
.search-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(10,15,26,0.95);
  backdrop-filter: blur(20px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 20vh;
  opacity: 0; visibility: hidden;
  transition: all 0.3s ease;
}
.search-overlay.active { opacity: 1; visibility: visible; }
.search-box { width: 100%; max-width: 600px; padding: 0 24px; }
.search-box input {
  width: 100%; padding: 20px 24px;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  color: white; font-size: 1.3rem; font-weight: 300;
}
.search-box input::placeholder { color: rgba(255,255,255,0.4); }
.search-box input:focus { outline: none; border-color: var(--secondary); }
.search-close {
  position: absolute; top: 24px; right: 24px;
  color: rgba(255,255,255,0.6); font-size: 2rem; cursor: pointer;
  background: none; border: none; transition: var(--transition);
}
.search-close:hover { color: white; }
.search-results {
  margin-top: 16px; max-height: 50vh; overflow-y: auto;
}
.search-result-item {
  display: block; padding: 14px 20px;
  color: rgba(255,255,255,0.8); border-radius: var(--radius-sm);
  transition: var(--transition); text-decoration: none;
  font-size: 0.95rem;
}
.search-result-item:hover { background: rgba(255,255,255,0.08); color: white; }
.search-result-item span { font-size: 0.75rem; color: var(--secondary); display: block; margin-top: 2px; }

/* Search icon in header */
.search-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.9rem; color: white;
  border: none; transition: var(--transition); margin-right: 4px;
}
.search-toggle:hover { background: rgba(255,255,255,0.2); }

/* --- Page Transition --- */
.page-transition {
  position: fixed; inset: 0; z-index: 9998;
  background: var(--primary);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.4s cubic-bezier(0.86, 0, 0.07, 1);
}
.page-transition.active { transform: scaleY(1); transform-origin: top; }

/* --- Parallax --- */
.parallax-bg {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* --- Responsive additions --- */
@media (max-width: 768px) {
  .mega-menu { display: none !important; }
  .cookie-inner { flex-direction: column; text-align: center; }
  .cookie-btns { width: 100%; justify-content: center; }
  .newsletter-form { max-width: 100%; }
  .search-box input { font-size: 1rem; }
  .partners-track { gap: 40px; }
}

/* Custom styles for new program page sections */
.other-prog-link:hover {
  background: var(--white) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  transform: translateX(4px);
}

.other-prog-card {
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
}
.other-prog-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 30px rgba(0, 168, 120, 0.1);
  border-color: var(--primary);
}
