/* === Global Font Reset to Apple-like "Inter" === */
html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  font-weight: 400;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent horizontal scrolling */
html, body {
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

* {
  box-sizing: border-box;
}

/* Fix carousel overflow on mobile */
.carousel-wrapper {
  overflow: hidden;
  width: 100%;
}

.carousel-container {
  overflow: hidden;
  width: 100%;
}

.carousel-track {
  overflow: visible;
}

:root {
  --bg-main: #f5f5f7;
  --bg-card: #ffffff;
  --bg-header: #fbfbfd;
  --border: #d2d2d7;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --accent: #FF424D;
  --accent-hover: #e63946;
  --blue: #007AFF;  /* Apple's signature blue */
  --blue-hover: #0062CC;
  --blue-light: rgba(0, 122, 255, 0.1);
  --shadow: rgba(0, 0, 0, 0.08);
  --shadow-elevated: rgba(0, 0, 0, 0.12);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  justify-content: flex-start;
  background: none;
  border: none;
  box-shadow: none;
}

.site-logo-img {
  height: clamp(48px, 8vw, 80px);
  width: auto;
  object-fit: contain;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.site-logo-img:hover {
  transform: scale(1.03);
  opacity: 0.9;
}

.site-subtitle {
  color: var(--text-secondary);
  font-size: clamp(0.9em, 2vw, 1em);
  margin: 0;
}

/* Header alignment tweak for taller logo */
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
}


.logo-icon {
  font-size: 1.6em;
}

.site-title h1 {
  font-weight: 700;
  font-size: clamp(1.2em, 4vw, 1.6em);
  color: var(--text-primary);
}

.site-subtitle {
  color: var(--text-secondary);
  font-size: clamp(0.85em, 2vw, 1em);
}

/* === Profile Button Icon === */
.profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #007bff; /* your existing button blue */
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  transition: background 0.25s ease, transform 0.2s ease;
}

.profile-btn:hover {
  background: #006ae1;
  transform: translateY(-1px);
}

/* ✅ Refined image styling */
.profile-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%; /* soft shape */
  object-fit: contain;
  background: transparent; /* keep transparency */
  mix-blend-mode: normal; /* ensures no color mixing artifacts */
  filter: drop-shadow(0 0 0 transparent); /* prevents white halos */
  display: block;
}



/* ===== Button Styles (Universal) ===== */
.btn {
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 8px 18px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.92em;
  font-weight: 500;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.btn:hover {
  background: var(--blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--blue-light);
}

.btn-blue {
  background: var(--blue);
  color: white;
  border: none;
}

.btn-blue:hover {
  background: var(--blue-hover);
  box-shadow: 0 4px 12px var(--blue-light);
}

.btn-primary {
  background: var(--blue);
  color: white;
  border: none;
}

.btn-primary:hover {
  background: var(--blue-hover);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--blue);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--blue-light);
  border-color: var(--blue);
}

.btn-icon {
  font-size: 1em;
}

/* Hamburger Menu Toggle */
.menu-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex; /* Always show the menu toggle */
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  transition: var(--transition);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
}

.header-actions::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 12px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid white; /* Change to solid white */
  z-index: 1001;
}

.header-actions.show {
  display: flex; /* Show when toggle is clicked */
}

@media (max-width: 850px) {
  .menu-toggle {
    display: flex !important; /* Show on mobile */
  }
  
  .header-actions {
    display: none !important; /* Hide buttons by default on mobile */
  }
  
  .header-actions.show {
    display: flex !important; /* Show when toggled */
  }
}

.hamburger-line {
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

.menu-toggle:hover .hamburger-line {
  background: var(--blue);
}

.menu-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.header-actions {
  display: none;
  gap: 12px;
  align-items: stretch;
  flex-direction: column;
  position: absolute;
  top: 60px; /* Position below the toggle */
  right: 0; /* Align with the toggle button */
  background: white;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 12px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  z-index: 1000;
  animation: menuSlideIn 0.25s ease;
}

/* Triangle pointer at top - pointing to menu button */
.header-actions::before {
  content: '';
  position: absolute;
  top: -10px;
  right: 10px; /* Align with the toggle button */
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid white;
}

.header-actions.show {
  display: flex !important;
}

/* Button styling inside dropdown */
.header-actions .btn {
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  font-size: 0.95em;
  border-radius: 10px;
}

/* Animation for dropdown */
@keyframes menuSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* ===== Carousel System ===== */
.carousel-wrapper {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 60px 20px;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  perspective: 1500px;
}

body {
  overflow-x: hidden !important;
}

.carousel-wrapper,
.carousel-container {
  overflow: hidden !important;
  max-width: 100vw;
}

.carousel-track {
  overflow: hidden !important;
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
}


.carousel-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  width: 100%;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  will-change: transform, opacity;
}

.novel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 30px var(--shadow-elevated);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  will-change: transform, opacity;
}

/* Highlighted (Active) Card */
.novel-card.active {
  width: 380px;
  height: 580px;
  opacity: 1;
  transform: scale(1) translateZ(0);
  z-index: 10;
}

/* Non-highlighted (Inactive) Cards */
.novel-card.inactive {
  width: 280px;
  height: 480px;
  opacity: 0.35;
  transform: scale(0.85) translateZ(-100px);
  filter: blur(1px);
  pointer-events: none;
  z-index: 1;
}

.novel-card.inactive:hover {
  opacity: 0.5;
}

.novel-banner {
  width: 100%;
  height: 78%;
  position: relative;
  overflow: hidden;
}

.novel-cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.novel-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.92), rgba(0,0,0,0.5), transparent);
  padding: 24px 20px;
  color: white;
}

.novel-title {
  font-size: 1.5em;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}

.novel-card.inactive .novel-title {
  font-size: 1.2em;
}

.novel-meta {
  display: flex;
  gap: 14px;
  font-size: 0.85em;
  opacity: 0.95;
}

.novel-card.inactive .novel-meta {
  font-size: 0.75em;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.novel-action-section {
  height: 22%;
  padding: 18px 20px;
  text-align: center;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

.novel-card.inactive .novel-action-section {
  padding: 12px 16px;
}

.novel-action-btn {
  width: 100%;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.novel-card.inactive .novel-action-btn {
  padding: 10px 14px;
  font-size: 0.8em;
}

.novel-action-btn:hover {
  background: var(--blue-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--blue-light);
}

/* ===== Carousel Arrows ===== */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  color: var(--blue);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2em;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px var(--shadow);
  z-index: 20;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.carousel-arrow:hover {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 20px var(--blue-light);
}

.carousel-arrow.left {
  left: 20px;
}

.carousel-arrow.right {
  right: 20px;
}

/* ===== Carousel Indicators ===== */
.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.indicator:hover {
  background: var(--text-secondary);
  transform: scale(1.2);
}

.indicator.active {
  background: var(--blue);
  width: 26px;
  border-radius: 4px;
}

/* ===== Search Results Section ===== */
.search-results-section {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}

.search-results-header {
  margin-bottom: 20px;
}

.search-results-header h3 {
  font-size: 1.4em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.search-results-header p {
  color: var(--text-secondary);
  font-size: 0.95em;
}

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ===== Latest Chapters Section ===== */
.latest-chapters-section {
  max-width: 1200px;
  margin: 50px auto 0;
  padding: 0 20px;
}

.section-divider {
  text-align: center;
  margin-bottom: 30px;
}

.section-divider h2 {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.section-divider p {
  color: var(--text-secondary);
  font-size: 1em;
}

.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.chapter-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.chapter-card:hover {
  border-color: var(--blue);
  background: var(--blue-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow);
}

.chapter-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 10px;
}

.chapter-card-title {
  font-weight: 600;
  font-size: 0.95em;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
  display: -webkit-box;       /* required for -webkit-line-clamp */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;

  -webkit-line-clamp: 3;     /* WebKit prefixed */
  line-clamp: 3;             /* standard property for compat */
}

.chapter-card-badge {
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.7em;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.chapter-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.8em;
  flex-wrap: wrap;
}

.chapter-card-date {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chapter-card-novel {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--bg-main);
  border-radius: 6px;
  font-size: 0.78em;
  font-weight: 500;
}

/* ===== Responsive ===== */
@media (max-width: 968px) {
  .carousel-wrapper {
    padding: 40px 15px;
  }

  .carousel-container {
    gap: 20px;
  }

  .carousel-track {
    gap: 20px;
  }

  .novel-card.active {
    width: 340px;
    height: 520px;
  }

  .novel-card.inactive {
    width: 240px;
    height: 420px;
  }

  .carousel-arrow {
    width: 44px;
    height: 44px;
    font-size: 1.8em;
  }

  .carousel-arrow.left {
    left: 10px;
  }

  .carousel-arrow.right {
    right: 10px;
  }
}

@media (max-width: 768px) {
  .carousel-wrapper {
    min-height: 500px;
  }

  .novel-card.active {
    width: 300px;
    height: 480px;
  }

  .novel-card.inactive {
    width: 180px;
    height: 360px;
    opacity: 0.25;
  }

  .chapters-grid,
  .search-results-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 580px) {
  .carousel-container {
    gap: 10px;
  }

  .carousel-track {
    gap: 10px;
  }

  .novel-card.active {
    width: 260px;
    height: 440px;
  }

  .novel-card.inactive {
    width: 140px;
    height: 320px;
    opacity: 0.2;
    transform: scale(0.8) translateZ(-100px);
  }

  .carousel-arrow {
    width: 40px;
    height: 40px;
    font-size: 1.6em;
  }

  .chapters-grid,
  .search-results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .carousel-wrapper {
    padding: 0 50px;
    min-height: 400px;
  }

  .carousel-arrow {
    width: 40px;
    height: 40px;
    font-size: 1.4em;
  }

  .carousel-arrow.left {
    left: 5px;
  }

  .carousel-arrow.right {
    right: 5px;
  }

  .novel-banner {
    height: 280px;
  }

  .novel-title {
    font-size: 1.5em;
  }
}

/* ===== User Alert ===== */
.user-alert {
  background: linear-gradient(135deg, var(--blue-light), rgba(0, 122, 255, 0.05));
  border: 1px solid rgba(0, 122, 255, 0.2);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 20px auto;
  max-width: 1200px;
  display: none;
  align-items: center;
  gap: 16px;
}

.user-alert.show {
  display: flex;
}

.user-alert-icon {
  font-size: 1.8em;
}

.user-alert-content {
  flex: 1;
}

.user-alert-content h3 {
  margin-bottom: 4px;
  color: var(--text-primary);
  font-size: 1.05em;
}

.user-alert-content p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.92em;
}

/* ===== Search Container ===== */
.search-container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 20px;
}

.search-box {
  width: 100%;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.98em;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: var(--transition);
}

.search-box:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-light);
}

.search-box::placeholder {
  color: var(--text-secondary);
}

/* ===== Main Section ===== */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 20px 80px;
}

.novels-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 400px;
}

.section-header {
  text-align: center;
  margin-bottom: 40px;
}

.section-header h2 {
  font-size: clamp(2em, 5vw, 3em);
  font-weight: 700;
  margin-bottom: 8px;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.1em;
}

/* ===== Modal ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 36px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-icon {
  font-size: 2.8em;
  margin-bottom: 14px;
}

.modal-content h2 {
  margin-bottom: 10px;
  font-size: 1.6em;
}

.modal-content p {
  color: var(--text-secondary);
  margin-bottom: 22px;
  line-height: 1.5;
  font-size: 0.95em;
}

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.close-modal {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 10px;
  font-size: 0.95em;
  transition: var(--transition);
}

.close-modal:hover {
  color: var(--text-primary);
}

/* ===== Footer ===== */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 0.9em;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.footer-link:hover {
  color: var(--blue);
}

/* ===== Content Wrapper ===== */
#content {
  min-height: 400px;
}

/* ===== Modal Fixes ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 36px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 2001;
}

/* All Chapters Modal - Higher z-index */
#allChaptersModal .modal {
  z-index: 3000;
}

#allChaptersModal .modal-content {
  z-index: 3001;
}

/* Login Modal - Lower z-index so it appears behind */
#loginModal {
  z-index: 2500;
}

#loginModal .modal-content {
  z-index: 2501;
}

.modal-icon {
  font-size: 2.8em;
  margin-bottom: 14px;
}

.modal-content h2 {
  margin-bottom: 10px;
  font-size: 1.6em;
}

.modal-content p {
  color: var(--text-secondary);
  margin-bottom: 22px;
  line-height: 1.5;
  font-size: 0.95em;
}

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.close-modal {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 10px;
  font-size: 0.95em;
  transition: var(--transition);
}

.close-modal:hover {
  color: var(--text-primary);
}

/* Apple-style Close Button */
.modal-close-btn {
  background: #ff3b30;
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4em;
  font-weight: 300;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: #ff453a;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.modal-close-btn:active {
  transform: scale(0.95);
}

/* Carousel Slide Animation */
.carousel-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  width: 100%;
  transition: none;
}


.novel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 30px var(--shadow-elevated);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

/* === Sticky, Centered Search Bar === */
.search-container {
  position: sticky;
  top: 110px; /* increased distance from header */
  z-index: 98;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0 18px;
  background: transparent;
}


/* Solid, floating bar with no border */
.search-box {
  width: 100%;
  max-width: 580px;
  padding: 14px 22px;
  border: none;
  outline: none;
  border-radius: 40px;
  font-size: 1rem;
  background: #ffffff; /* visible white bar */
  color: var(--text-primary);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.search-box:focus {
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.search-box::placeholder {
  color: var(--text-secondary);
}

/* === Dropdown Below Search Bar === */
.search-dropdown {
  position: absolute; /* ensures it stays directly below */
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 580px;
  margin-top: 8px;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  display: none;
  max-height: 260px;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
  z-index: 200;
}

.search-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.95rem;
  color: #333;
  transition: background 0.15s ease;
}

.search-item:hover {
  background: rgba(0, 123, 255, 0.08);
}

.search-empty {
  padding: 12px 16px;
  text-align: center;
  color: #777;
  font-style: italic;
}

/* ===== FINAL FIX: Working Responsive Menu Toggle ===== */
/* ===== FINAL FIX: Working Responsive Menu Toggle ===== */
@media (max-width: 850px) {
  /* show the menu toggle */
  .menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    transition: all 0.25s ease;
    z-index: 1002;
    padding: 10px;
  }

  .menu-toggle:hover {
    background: rgba(0, 122, 255, 0.1);
  }

  .hamburger-line {
    width: 24px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 3px;
    transition: var(--transition);
  }

  /* Hide header buttons initially */
  .header-actions {
    display: none !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    position: absolute;
    top: 72px;
    right: 20px;
    width: 220px;
    padding: 16px;
    border-radius: 16px;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    animation: dropdownFade 0.25s ease;
    z-index: 1001;
  }

  /* Show when toggled */
  .header-actions.show {
    display: flex !important;
  }

  .header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    position: relative;
  }
}

@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.header-actions {
  display: none;
  gap: 12px;
  flex-direction: column;
  position: absolute;
  top: 55px;
  right: 0;
  background: white;
  padding: 12px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  z-index: 1000;
}

/* Triangle pointer */
.header-actions::before {
  content: '';
  position: absolute;
  top: -10px;
  right: 8px;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid white;
}

.header-actions.show {
  display: flex !important;
}

/* ===== Profile Page Styles ===== */
.profile-container {
  max-width: 1000px;
  margin: 60px auto;
  padding: 0 20px;
}

.profile-header {
  text-align: center;
  margin-bottom: 50px;
}

.profile-header h1 {
  font-size: clamp(2em, 5vw, 3em);
  color: var(--blue);
  margin-bottom: 15px;
  font-weight: 700;
}

.profile-header p {
  color: var(--text-secondary);
  font-size: clamp(1em, 2.5vw, 1.2em);
}

.profile-section {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 40px 30px;
  margin-bottom: 30px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px var(--shadow);
}

.section-title {
  font-size: clamp(1.4em, 3vw, 1.8em);
  color: var(--text-primary);
  margin-bottom: 25px;
  font-weight: 600;
}

.current-avatar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  padding: 20px;
  background: var(--bg-main);
  border-radius: 12px;
  flex-wrap: wrap;
}

.avatar-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3em;
  border: 3px solid var(--blue);
  overflow: hidden;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-info h3 {
  font-size: clamp(1.2em, 3vw, 1.5em);
  margin-bottom: 8px;
  color: var(--text-primary);
}

.avatar-info p {
  color: var(--text-secondary);
  font-size: clamp(0.9em, 2.5vw, 1em);
}

.upload-section {
  margin-bottom: 40px;
}

.upload-area {
  border: 3px dashed var(--border);
  border-radius: 15px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-main);
}

.upload-area:hover {
  border-color: var(--blue);
  background: var(--blue-light);
}

.upload-area.dragover {
  border-color: var(--blue);
  background: var(--blue-light);
  transform: scale(1.02);
}

.upload-icon {
  font-size: 3em;
  margin-bottom: 15px;
  color: var(--text-secondary);
}

.upload-text {
  font-size: clamp(1em, 2.5vw, 1.15em);
  color: var(--text-primary);
  margin-bottom: 10px;
}

.upload-hint {
  font-size: clamp(0.85em, 2vw, 0.95em);
  color: var(--text-secondary);
}

#fileInput {
  display: none;
}

.divider {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 35px 0;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider-text {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: clamp(0.9em, 2.5vw, 1em);
}

.silhouettes-section {
  margin-top: 30px;
}

.silhouette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.silhouette-option {
  aspect-ratio: 1;
  background: var(--bg-main);
  border: 3px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  color: var(--text-secondary);
  position: relative;
  overflow: hidden;
}

.silhouette-option:hover {
  border-color: var(--blue);
  transform: scale(1.05);
  box-shadow: 0 4px 12px var(--blue-light);
}

.silhouette-option.selected {
  border-color: var(--blue);
  background: var(--blue-light);
}

.silhouette-option.selected::after {
  content: '✓';
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: var(--blue);
  color: white;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
}

.silhouette-crop {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

@media (max-width: 768px) {
  .silhouette-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
}

/* ===== About Page Styles ===== */
.about-container {
  max-width: 900px;
  margin: 60px auto;
  padding: 0 20px;
}

.about-hero {
  text-align: center;
  margin-bottom: 60px;
}

.about-hero h1 {
  font-size: clamp(2.5em, 6vw, 3.5em);
  color: var(--blue);
  margin-bottom: 15px;
  font-weight: 700;
}

.about-hero p {
  color: var(--text-secondary);
  font-size: clamp(1.1em, 2.5vw, 1.3em);
}

.about-content {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 50px 40px;
  margin-bottom: 40px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px var(--shadow);
  line-height: 1.8;
}

.about-content h2 {
  font-size: clamp(1.6em, 4vw, 2em);
  color: var(--text-primary);
  margin-bottom: 20px;
  font-weight: 600;
}

.about-content p {
  color: var(--text-primary);
  font-size: clamp(1em, 2.5vw, 1.1em);
  margin-bottom: 20px;
}

.about-content strong {
  color: var(--blue);
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 50px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 35px 25px;
  text-align: center;
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--shadow);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px var(--shadow-elevated);
  border-color: var(--blue);
}

.stat-number {
  font-size: clamp(2.5em, 5vw, 3.5em);
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 10px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: clamp(0.95em, 2vw, 1.1em);
  font-weight: 500;
}

.cta-section {
  background: linear-gradient(135deg, var(--blue-light), rgba(0, 122, 255, 0.05));
  border: 1px solid rgba(0, 122, 255, 0.2);
  border-radius: 20px;
  padding: 50px 40px;
  text-align: center;
}

.cta-section h2 {
  font-size: clamp(1.8em, 4vw, 2.3em);
  color: var(--text-primary);
  margin-bottom: 15px;
  font-weight: 700;
}

.cta-section p {
  color: var(--text-secondary);
  font-size: clamp(1em, 2.5vw, 1.2em);
  margin-bottom: 30px;
}

.cta-section .btn {
  padding: 14px 40px;
  font-size: clamp(1em, 2.5vw, 1.15em);
  display: inline-flex;
  text-decoration: none;
}

@media (max-width: 768px) {
  .about-content {
    padding: 35px 25px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .cta-section {
    padding: 35px 25px;
  }
}

/* ===== Contact Page Styles ===== */
.page-container {
  max-width: 800px;
  margin: 60px auto;
  padding: 0 20px;
}

.page-header {
  text-align: center;
  margin-bottom: 60px;
}

.page-header h1 {
  font-size: clamp(2.5em, 6vw, 3.5em);
  color: var(--blue);
  margin-bottom: 15px;
  font-weight: 700;
}

.page-header p {
  color: var(--text-secondary);
  font-size: clamp(1.1em, 2.5vw, 1.3em);
}

.contact-section {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 50px 40px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px var(--shadow);
}

.contact-section h2 {
  font-size: clamp(1.6em, 4vw, 2em);
  color: var(--text-primary);
  margin-bottom: 20px;
  font-weight: 600;
}

.contact-section p {
  color: var(--text-primary);
  font-size: clamp(1em, 2.5vw, 1.1em);
  line-height: 1.8;
  margin-bottom: 30px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 30px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: white;
  text-decoration: none;
  padding: 14px 28px;
  border-radius: 10px;
  font-weight: 600;
  font-size: clamp(1em, 2.5vw, 1.1em);
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--shadow);
}

.contact-link:hover {
  background: var(--blue-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--blue-light);
}

@media (max-width: 768px) {
  .contact-section {
    padding: 35px 25px;
  }
}

/* Hamburger Menu Toggle */
.menu-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  transition: var(--transition);
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.menu-toggle:hover {
  background: rgba(0, 122, 255, 0.1);
}

.hamburger-line {
  width: 24px;
  height: 3px;
  background: var(--text-primary);
  border-radius: 3px;
  transition: var(--transition);
}

.menu-toggle:hover .hamburger-line {
  background: var(--blue);
}

.menu-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* ===== Notification System ===== */
.notification-container {
  display: none;
  position: relative;
  margin-right: 10px;
  align-items: center;
  justify-content: center;
}

.notification-container.show {
  display: flex !important;
}

.notification-bell {
  background: transparent;
  border: none;
  font-size: 1.3em;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.notification-bell:hover {
  background: rgba(0, 122, 255, 0.1);
  transform: scale(1.05);
}

.notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #ff3b30;
  color: white;
  border-radius: 50%;
  font-size: 0.7em;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  padding: 2px 6px;
  box-shadow: 0 2px 8px rgba(255, 66, 77, 0.4);
}

.notification-dropdown {
  position: absolute;
  top: 58px;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  width: 380px;
  max-width: calc(100vw - 40px);
  max-height: 70vh;
  overflow: hidden;
  display: none;
  flex-direction: column;
  z-index: 1002;
  animation: dropdownFade 0.25s ease;
}

.notification-dropdown::before {
  content: '';
  position: absolute;
  top: -10px;
  right: 12px;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid rgba(255, 255, 255, 0.98);
}

.notification-dropdown.active {
  display: flex !important;
}

.notification-header {
  padding: 16px 20px;
  border-bottom: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-main);
  border-radius: 16px 16px 0 0;
  flex-shrink: 0;
}

.notification-title {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--text-primary);
}

.mark-all-read {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
}

.mark-all-read:hover {
  background: var(--blue-light);
}

.notification-list {
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.notification-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background: var(--blue-light);
}

.notification-item.unread {
  background: var(--blue-light);
  border-left: 4px solid var(--blue);
  padding-left: 26px;
}

.notification-item.unread::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--blue);
  border-radius: 50%;
}

.notification-message {
  color: var(--text-primary);
  font-size: 0.95em;
  line-height: 1.5;
  margin-bottom: 6px;
}

.notification-item.unread .notification-message {
  font-weight: 600;
}

.notification-time {
  color: var(--text-secondary);
  font-size: 0.8em;
}

.no-notifications {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95em;
}

.no-notifications::before {
  content: '🔔';
  display: block;
  font-size: 3em;
  margin-bottom: 10px;
  opacity: 0.3;
}

@media (max-width: 600px) {
  .notification-dropdown {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 85vh !important;
    max-height: 85vh !important;
    border-radius: 20px 20px 0 0 !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25) !important;
    animation: slideUpMobile 0.3s ease-out !important;
    z-index: 9999 !important;
    overflow: hidden !important;
  }

  @keyframes slideUpMobile {
    from {
      transform: translateY(100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  .notification-dropdown::before {
    display: none !important;
  }

  .notification-header {
    padding: 18px 20px;
    font-size: 1.1em;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
    flex-shrink: 0 !important;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .notification-list {
    flex: 1 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    -webkit-overflow-scrolling: touch;
  }

  .notification-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: white;
  }

  .notification-message {
    font-size: 0.95em;
    line-height: 1.5;
  }

  .notification-time {
    font-size: 0.8em;
  }

  .no-notifications {
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .notification-bell {
    width: 42px;
    height: 42px;
    font-size: 1.2em;
  }

  .notification-badge {
    top: 4px;
    right: 4px;
    font-size: 0.65em;
    min-width: 14px;
    height: 14px;
  }
}

.notification-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  animation: fadeIn 0.25s ease;
}

.notification-backdrop.active {
  display: block !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dropdownFade {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reauth-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(255, 159, 10, 0.95) 0%, rgba(255, 107, 0, 0.95) 100%);
  backdrop-filter: blur(10px);
  border-bottom: 3px solid #ff9f0a;
  color: white;
  padding: 16px 20px;
  z-index: 10000;
  animation: slideDown 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.reauth-banner.show {
  display: block;
}

.reauth-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.reauth-icon {
  font-size: 1.8em;
  flex-shrink: 0;
}

.reauth-message {
  flex: 1;
  min-width: 200px;
}

.reauth-message strong {
  display: block;
  font-size: 1.1em;
  font-weight: 700;
  margin-bottom: 4px;
}

.reauth-message span {
  font-size: 0.95em;
  opacity: 0.95;
}

.reauth-btn {
  background: white;
  color: #ff9f0a;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95em;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.reauth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  background: #f0f0f0;
}

.reauth-dismiss {
  background: transparent;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 1.2em;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
}

.reauth-dismiss:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Push content down when banner shows */
body.reauth-active {
  padding-top: 80px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .reauth-banner {
    padding: 14px 16px;
  }
  
  .reauth-content {
    gap: 12px;
  }
  
  .reauth-icon {
    font-size: 1.5em;
  }
  
  .reauth-message strong {
    font-size: 1em;
  }
  
  .reauth-message span {
    font-size: 0.9em;
  }
  
  .reauth-btn {
    padding: 8px 20px;
    font-size: 0.9em;
  }
  
  body.reauth-active {
    padding-top: 100px;
  }
}

@media (max-width: 480px) {
  .reauth-content {
    justify-content: center;
    text-align: center;
  }
  
  .reauth-message {
    flex-basis: 100%;
  }
  
  .reauth-btn {
    flex: 1;
  }
  
  body.reauth-active {
    padding-top: 120px;
  }
}