/* =============================================
   SparkNest Academy — Shared Navbar Styles
   Improved design with login/logout support
   ============================================= */

/* ── Font Awesome (loaded via JS component) ── */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css');

/* ── Navbar Shell ── */
.sn-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 10px 24px;
  margin: 0;

  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(108, 77, 246, 0.12);

  box-shadow: 0 4px 24px rgba(108, 77, 246, 0.08);
  transition: box-shadow 0.3s, background 0.3s;
}

.sn-navbar.scrolled {
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 6px 32px rgba(108, 77, 246, 0.14);
}

/* ── Logo ── */
.sn-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.sn-logo img {
  height: 56px;
  width: auto;
  object-fit: contain;
}

/* ── Nav Links ── */
.sn-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.sn-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 9px 18px;
  border-radius: 50px;

  text-decoration: none;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: #374151;
  white-space: nowrap;

  background: transparent;
  border: 2px solid transparent;
  transition: all 0.25s ease;
}

.sn-nav-item:hover {
  background: #f3f0ff;
  color: #6c4df6;
  border-color: rgba(108, 77, 246, 0.18);
  transform: translateY(-2px);
}

.sn-nav-item.active {
  background: linear-gradient(135deg, #6c4df6, #a78bfa);
  color: #fff !important;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(108, 77, 246, 0.35);
}

.sn-nav-item i {
  font-size: 0.8rem;
}

/* ── Right Section ── */
.sn-navbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Auth Buttons ── */
.sn-auth-buttons {
  display: flex;
  gap: 8px;
}

.sn-login-btn,
.sn-signup-btn {
  padding: 9px 20px;
  border-radius: 50px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  border: 2px solid #6c4df6;
}

.sn-login-btn {
  background: transparent;
  color: #6c4df6;
}

.sn-login-btn:hover {
  background: #f3f0ff;
  transform: translateY(-2px);
}

.sn-signup-btn {
  background: linear-gradient(135deg, #6c4df6, #a78bfa);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(108, 77, 246, 0.35);
}

.sn-signup-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 77, 246, 0.45);
}

/* ── Profile Hover ── */
.sn-profile-hover {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.sn-avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c4df6, #a78bfa);
  color: white;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(108, 77, 246, 0.25);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sn-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(108, 77, 246, 0.25);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sn-avatar-circle.large,
.sn-avatar-img.large {
  width: 60px;
  height: 60px;
  font-size: 1.4rem;
}

.sn-profile-hover:hover .sn-avatar-circle,
.sn-profile-hover:hover .sn-avatar-img {
  transform: scale(1.08);
}

/* ── Profile Popup ── */
.sn-profile-popup {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  width: 280px;

  background: #fff;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(108, 77, 246, 0.15), 0 4px 16px rgba(0,0,0,0.08);
  border: 1px solid rgba(108, 77, 246, 0.1);

  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.97);
  transition: all 0.25s ease;
  z-index: 99999;
}

.sn-profile-hover:hover .sn-profile-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.sn-popup-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0ebff;
}

.sn-popup-header h3 {
  margin: 0 0 4px 0;
  font-size: 1rem;
  color: #1e1b4b;
  font-family: 'Poppins', sans-serif;
}

.sn-level-badge {
  background: linear-gradient(135deg, #6c4df6, #a78bfa);
  color: white;
  padding: 3px 12px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
}

.sn-popup-link {
  display: block;
  text-decoration: none;
  color: #374151;
  background: #f8f7ff;
  padding: 11px 16px;
  border-radius: 14px;
  margin-bottom: 7px;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: 'Poppins', sans-serif;
  transition: all 0.2s;
}

.sn-popup-link:hover {
  background: linear-gradient(135deg, #6c4df6, #a78bfa);
  color: white;
  transform: translateX(4px);
}

.sn-divider {
  border: none;
  border-top: 1px solid #f0ebff;
  margin: 10px 0;
}

.sn-logout {
  color: #ef4444 !important;
  background: #fff5f5 !important;
}

.sn-logout:hover {
  background: #ef4444 !important;
  color: white !important;
}

/* ── Hamburger ── */
.sn-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: none;
  background: #f3f0ff;
  border-radius: 12px;
  cursor: pointer;
  padding: 8px;
}

.sn-hamburger span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: #6c4df6;
  border-radius: 4px;
  transition: all 0.3s;
}

/* ── Login/Signup Modal ── */
.sn-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 40, 0.6);
  backdrop-filter: blur(8px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sn-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.sn-modal {
  background: white;
  border-radius: 28px;
  padding: 36px;
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: 0 30px 80px rgba(108, 77, 246, 0.2);
  animation: sn-pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes sn-pop-in {
  from { transform: scale(0.85) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.sn-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: none;
  background: #f3f0ff;
  color: #6c4df6;
  border-radius: 50%;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s;
}

.sn-modal-close:hover {
  background: #6c4df6;
  color: white;
  transform: rotate(90deg);
}

.sn-modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  background: #f3f0ff;
  border-radius: 16px;
  padding: 5px;
}

.sn-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 12px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: #6c4df6;
  cursor: pointer;
  transition: all 0.25s;
}

.sn-tab.active {
  background: linear-gradient(135deg, #6c4df6, #a78bfa);
  color: white;
  box-shadow: 0 4px 12px rgba(108, 77, 246, 0.3);
}

.sn-tab-content h2 {
  font-size: 1.5rem;
  color: #1e1b4b;
  margin: 0 0 6px 0;
  font-family: 'Poppins', sans-serif;
}

.sn-modal-sub {
  color: #64748b;
  font-size: 0.87rem;
  margin: 0 0 22px 0;
  font-family: 'Poppins', sans-serif;
}

.sn-input {
  width: 100%;
  padding: 13px 18px;
  border: 2px solid #e8e3ff;
  border-radius: 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  color: #1e1b4b;
  background: #faf9ff;
  margin-bottom: 12px;
  display: block;
  transition: border 0.2s, box-shadow 0.2s;
  outline: none;
  box-sizing: border-box;
}

.sn-input:focus {
  border-color: #6c4df6;
  box-shadow: 0 0 0 4px rgba(108, 77, 246, 0.1);
  background: white;
}

.sn-submit-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #6c4df6, #a78bfa);
  color: white;
  border: none;
  border-radius: 14px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 6px;
  margin-bottom: 16px;
  box-shadow: 0 6px 20px rgba(108, 77, 246, 0.35);
  transition: all 0.25s;
}

.sn-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(108, 77, 246, 0.45);
}

.sn-switch-text {
  text-align: center;
  font-size: 0.85rem;
  color: #64748b;
  font-family: 'Poppins', sans-serif;
}

.sn-switch-text a {
  color: #6c4df6;
  font-weight: 700;
  text-decoration: none;
}

.sn-switch-text a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .sn-nav {
    display: none;
    position: fixed;
    top: 76px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid rgba(108, 77, 246, 0.1);
    box-shadow: 0 8px 30px rgba(108, 77, 246, 0.1);
    z-index: 9998;
  }

  .sn-nav.open {
    display: flex;
  }

  .sn-nav-item {
    width: 100%;
    justify-content: center;
    font-size: 0.95rem;
    padding: 12px 20px;
  }

  .sn-hamburger {
    display: flex;
  }

  .sn-auth-buttons {
    display: none;
  }
}

@media (max-width: 480px) {
  .sn-navbar {
    padding: 10px 16px;
  }
  .sn-logo img {
    height: 44px;
  }
}

/* ── Theme Toggle Button ── */
.sn-theme-toggle {
  background: rgba(108, 77, 246, 0.1);
  border: none;
  color: #6c4df6;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sn-theme-toggle:hover {
  background: #6c4df6;
  color: #fff;
  transform: rotate(15deg) scale(1.1);
}

body[data-theme="dark"] .sn-theme-toggle {
  background: rgba(255, 212, 71, 0.15);
  color: #ffd447;
}

body[data-theme="dark"] .sn-theme-toggle:hover {
  background: #ffd447;
  color: #111;
}

/* ── Smart Dark Mode Override for Subpages ── */
/* This safely enforces a beautiful dark mode on pages that don't have native dark mode CSS */
body[data-theme="dark"]:not(.dashboard) {
  background: linear-gradient(135deg, #0f172a, #1e293b) !important;
  color: #f8fafc !important;
}

body[data-theme="dark"]:not(.dashboard) h1,
body[data-theme="dark"]:not(.dashboard) h2,
body[data-theme="dark"]:not(.dashboard) h3,
body[data-theme="dark"]:not(.dashboard) h4,
body[data-theme="dark"]:not(.dashboard) h5,
body[data-theme="dark"]:not(.dashboard) h6 {
  color: #f8fafc !important;
}

body[data-theme="dark"]:not(.dashboard) p,
body[data-theme="dark"]:not(.dashboard) span:not(.sn-avatar-circle):not(.sn-avatar-img):not(.sn-level-badge):not(.nav-icon):not(.bc-sep) {
  color: #cbd5e1 !important;
}

/* Force cards to be translucent dark glass */
body[data-theme="dark"]:not(.dashboard) [class*="card"],
body[data-theme="dark"]:not(.dashboard) [class*="box"],
body[data-theme="dark"]:not(.dashboard) [class*="grid"] > div,
body[data-theme="dark"]:not(.dashboard) [class*="container"] > div {
  background: rgba(30, 41, 59, 0.7) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
}

body[data-theme="dark"]:not(.dashboard) [class*="card"] h3,
body[data-theme="dark"]:not(.dashboard) [class*="box"] h3 {
  color: #e0e7ff !important;
}

body[data-theme="dark"]:not(.dashboard) .hero,
body[data-theme="dark"]:not(.dashboard) [class*="hero"] {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9)) !important;
}

/* Navbar Dark Mode */
body[data-theme="dark"] .sn-navbar {
  background: rgba(15, 23, 42, 0.85);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .sn-logo span {
  color: #e0e7ff !important;
}

body[data-theme="dark"] .sn-nav-item {
  color: #cbd5e1;
}

body[data-theme="dark"] .sn-nav-item:hover,
body[data-theme="dark"] .sn-nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .sn-login-btn {
  color: #e2e8f0;
}
body[data-theme="dark"] .sn-login-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
