/* ═══════════════════════════════════════════════════════════
   eJournalHub — Final Fixes: Newsletter + Mobile Polish
   ═══════════════════════════════════════════════════════════ */

/* ── 1. Newsletter Section — Complete Rebuild ──────────────── */
.ejh-nl-section {
  background: linear-gradient(135deg, #08081a 0%, #13133a 50%, #091420 100%);
  padding: 80px 0;
  position: relative;
  overflow: hidden;
}
.ejh-nl-section::before {
  content: '';
  position: absolute;
  top: -150px; left: -150px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(108,99,255,0.2) 0%, transparent 65%);
  pointer-events: none;
}
.ejh-nl-section::after {
  content: '';
  position: absolute;
  bottom: -100px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(67,198,172,0.15) 0%, transparent 65%);
  pointer-events: none;
}

/* Layout */
.ejh-nl-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

/* Left side */
.ejh-nl-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(108,99,255,0.2);
  border: 1px solid rgba(108,99,255,0.4);
  color: #a89fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}
.ejh-nl-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 14px;
}
.ejh-nl-desc {
  color: rgba(255,255,255,0.58);
  font-size: 1rem;
  line-height: 1.65;
  margin-bottom: 22px;
}
.ejh-nl-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.ejh-nl-stats span {
  color: rgba(255,255,255,0.45);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Right side — form */
.ejh-nl-right {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 36px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08),
              0 20px 60px rgba(0,0,0,0.3);
}

.ejh-nl-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* THE ROW: input + button side by side */
.ejh-nl-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 14px;
}

/* Input — standalone, no pill tricks */
.ejh-nl-input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0 18px;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  color: #fff;
  font-size: 0.9375rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
  -webkit-appearance: none;
  box-sizing: border-box;
  /* Kill any inherited rules */
  width: auto !important;
  max-width: 100% !important;
  box-shadow: none !important;
}
.ejh-nl-input::placeholder {
  color: rgba(255,255,255,0.3);
}
.ejh-nl-input:focus {
  border-color: rgba(108,99,255,0.7);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.15) !important;
}

/* Button — standalone */
.ejh-nl-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  background: linear-gradient(135deg, #6C63FF 0%, #43C6AC 100%);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(108,99,255,0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  font-family: inherit;
}
.ejh-nl-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(108,99,255,0.5);
}
.ejh-nl-btn:active { transform: scale(0.97); }
.ejh-nl-btn svg { flex-shrink: 0; }

.ejh-nl-note {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.3);
  margin: 0;
  text-align: center;
}

/* Mobile: stack vertically */
@media (max-width: 768px) {
  .ejh-nl-inner {
    grid-template-columns: 1fr;
    gap: 36px;
    text-align: center;
  }
  .ejh-nl-stats { justify-content: center; }
  .ejh-nl-right { padding: 24px 20px; }
  .ejh-nl-row { flex-direction: column; gap: 10px; }
  .ejh-nl-input, .ejh-nl-btn {
    width: 100% !important;
    height: 52px;
  }
  .ejh-nl-btn { justify-content: center; }
  .ejh-nl-section { padding: 50px 0; }
}

/* ── 2. Bottom Nav — Full Fix ───────────────────────────────── */
.ejh-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  z-index: 9999;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(24px) saturate(2);
  -webkit-backdrop-filter: blur(24px) saturate(2);
  border-top: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 -2px 20px rgba(0,0,0,0.08);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
[data-theme="dark"] .ejh-bottom-nav {
  background: rgba(10,10,22,0.94);
  border-top-color: rgba(255,255,255,0.07);
  box-shadow: 0 -2px 20px rgba(0,0,0,0.4);
}

.ejh-bottom-nav__inner {
  display: flex;
  align-items: stretch;
  height: 64px;
  width: 100%;
}

.ejh-bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 2px;
  padding: 0;
  min-width: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: #9999b3;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: visible;
}
.ejh-bottom-nav__item.is-active { color: #6C63FF; }
[data-theme="dark"] .ejh-bottom-nav__item { color: #666680; }
[data-theme="dark"] .ejh-bottom-nav__item.is-active { color: #8B84FF; }

.ejh-bottom-nav__icon {
  width: 40px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: background 0.18s ease, transform 0.2s cubic-bezier(.34,1.56,.64,1);
  flex-shrink: 0;
}
.ejh-bottom-nav__icon svg { display: block; }

.ejh-bottom-nav__item.is-active .ejh-bottom-nav__icon {
  background: rgba(108,99,255,0.1);
  transform: translateY(-2px);
}
[data-theme="dark"] .ejh-bottom-nav__item.is-active .ejh-bottom-nav__icon {
  background: rgba(108,99,255,0.2);
}
.ejh-bottom-nav__item:active .ejh-bottom-nav__icon {
  transform: scale(0.88);
}

.ejh-bottom-nav__label {
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

/* Active top indicator */
.ejh-bottom-nav__item.is-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: linear-gradient(90deg, #6C63FF, #43C6AC);
  border-radius: 0 0 4px 4px;
}

/* Show only on mobile */
@media (max-width: 900px) {
  .ejh-bottom-nav { display: flex; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .ejh-back-top { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); right: 16px; }
  .ejh-toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  /* hide header hamburger — bottom nav handles menu */
  .ejh-header .ejh-mobile-toggle { display: none !important; }
}

/* ── 3. Mobile Menu Panel — Refined ─────────────────────────── */
@media (max-width: 900px) {
  .ejh-mobile-menu {
    width: 100vw !important;
    max-width: 100vw !important;
    border-left: none !important;
    border-radius: 24px 24px 0 0;
    top: auto !important;
    bottom: 0 !important;
    height: 85dvh !important;
    max-height: 85dvh !important;
    transform: translateY(105%) !important;
    right: 0 !important;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.2) !important;
  }
  .ejh-mobile-menu.is-open {
    transform: translateY(0) !important;
  }
  .ejh-mobile-menu__header {
    padding: 14px 20px !important;
    /* Drag handle pill */
    position: relative;
  }
  .ejh-mobile-menu__header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: rgba(0,0,0,0.12);
    border-radius: 2px;
  }
  [data-theme="dark"] .ejh-mobile-menu__header::before {
    background: rgba(255,255,255,0.15);
  }
  .ejh-mnav-link { padding: 13px 20px !important; }
  .ejh-mnav-sub-link { padding: 10px 20px 10px 32px !important; }
  .ejh-mobile-menu__footer { padding: 14px 20px calc(14px + env(safe-area-inset-bottom)) !important; }
}

/* ── 4. Sidebar: clean & styled ─────────────────────────────── */
.ejh-sidebar { position: sticky; top: 90px; }

/* Make sidebar not show below mobile posts grid */
@media (max-width: 900px) {
  .ejh-content-layout { display: block !important; }
  .ejh-sidebar {
    display: none; /* sidebar hidden on mobile — bottom nav provides navigation */
  }
  .ejh-single__layout { display: block !important; }
  .ejh-single .ejh-sidebar { display: none; }
}

/* ── 5. Topbar hidden on mobile ─────────────────────────────── */
@media (max-width: 900px) {
  .ejh-topbar { display: none; }
}

/* ── 6. Hero mobile ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .ejh-hero { height: 88vw; min-height: 300px; max-height: 480px; }
  .ejh-hero__title { font-size: 1.35rem; line-height: 1.3; }
  .ejh-hero__excerpt { display: none; }
  .ejh-hero__meta { flex-wrap: wrap; gap: 8px; }
  .ejh-hero__body { padding: 0 16px; }
  .ejh-hero__content { padding-bottom: 24px; }
  .ejh-hero__nav { display: none; }
  .ejh-hero__dots { right: 12px; bottom: 12px; }
}

/* ── 7. Trending grid mobile ─────────────────────────────────── */
@media (max-width: 640px) {
  .ejh-trending { padding: 32px 0; }
  .ejh-trending__grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  .ejh-section { padding: 32px 0; }
  .ejh-posts-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
}

/* ── 8. Cards mobile ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .ejh-card__body { padding: 14px; }
  .ejh-card__title { font-size: 1rem; -webkit-line-clamp: 2; }
  .ejh-card__excerpt { display: none; }
}

/* ── 9. Category grid mobile ─────────────────────────────────── */
@media (max-width: 640px) {
  .ejh-categories-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .ejh-cat-card { min-height: 100px; }
}

/* ── 10. Footer grid mobile ──────────────────────────────────── */
@media (max-width: 640px) {
  .ejh-footer__grid { grid-template-columns: 1fr !important; gap: 28px; }
  .ejh-footer__widgets { padding: 40px 0 !important; }
  .ejh-footer__bottom-inner { flex-direction: column; gap: 8px; text-align: center; }
}

/* ── 11. Container padding mobile ────────────────────────────── */
@media (max-width: 480px) {
  .ejh-container { padding: 0 14px; }
}

/* ── 12. Featured author mobile ──────────────────────────────── */
@media (max-width: 640px) {
  .ejh-featured-author__inner { flex-direction: column; text-align: center; gap: 20px; padding: 36px 0; }
}

/* ── 13. Scroll-to fix for single post ───────────────────────── */
@media (max-width: 900px) {
  .ejh-article { padding: 20px 16px !important; border-radius: 16px !important; }
  .ejh-article__title { font-size: 1.5rem !important; }
  .ejh-article__meta { flex-wrap: wrap; gap: 10px; }
  .ejh-article__actions { margin-top: 4px; }
  .ejh-post-nav { grid-template-columns: 1fr !important; gap: 10px; }
  .ejh-related-posts__grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .ejh-author-box { flex-direction: column !important; text-align: center !important; gap: 16px; }
  .ejh-author-box__links { justify-content: center; }
}
@media (max-width: 480px) {
  .ejh-related-posts__grid { grid-template-columns: 1fr !important; }
}

/* ── 14. Search overlay mobile ───────────────────────────────── */
@media (max-width: 640px) {
  .ejh-search-overlay { padding-top: 60px; align-items: flex-start; }
  .ejh-search-overlay .ejh-container { padding: 0 12px; }
  .ejh-search-overlay .ejh-search-form__input { font-size: 1.1rem !important; padding: 16px 18px !important; }
}

/* ── 15. Breadcrumbs mobile ──────────────────────────────────── */
@media (max-width: 640px) {
  .ejh-breadcrumbs { font-size: 0.75rem; padding: 10px 0; white-space: nowrap; overflow-x: auto; }
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR PREMIUM REDESIGN
   ═══════════════════════════════════════════════════════════ */

/* ── Widget container ───────────────────────────────────────── */
.ejh-sidebar .widget,
.ejh-sidebar .ejh-widget {
  background: rgba(255,255,255,0.82) !important;
  backdrop-filter: blur(20px) saturate(1.8) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.8) !important;
  border: 1px solid rgba(255,255,255,0.7) !important;
  box-shadow:
    0 4px 24px rgba(0,0,0,0.05),
    inset 0 1px 0 rgba(255,255,255,1) !important;
  border-radius: 20px !important;
  padding: 22px !important;
  overflow: hidden;
  position: relative;
}
[data-theme="dark"] .ejh-sidebar .widget,
[data-theme="dark"] .ejh-sidebar .ejh-widget {
  background: rgba(16,16,32,0.85) !important;
  border: 1px solid rgba(255,255,255,0.07) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04) !important;
}

/* Subtle gradient shimmer top edge */
.ejh-sidebar .widget::before,
.ejh-sidebar .ejh-widget::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #6C63FF, #43C6AC);
  border-radius: 20px 20px 0 0;
  opacity: 0.6;
}

/* ── Widget Title ────────────────────────────────────────────── */
.ejh-sidebar .widget-title,
.ejh-sidebar .ejh-widget .widget-title {
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
  margin-bottom: 18px !important;
  padding-bottom: 14px !important;
  border-bottom: 1px solid rgba(0,0,0,0.06) !important;
  display: flex;
  align-items: center;
  gap: 8px;
}
[data-theme="dark"] .ejh-sidebar .widget-title {
  border-bottom-color: rgba(255,255,255,0.06) !important;
}
.ejh-sidebar .widget-title span {
  background: linear-gradient(135deg, #6C63FF, #43C6AC) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

/* ── Categories Widget — Card Style ────────────────────────── */
.ejh-widget-categories {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.ejh-widget-categories li a {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 14px !important;
  border-radius: 12px !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  color: var(--color-text) !important;
  text-decoration: none !important;
  border: 1px solid transparent !important;
  border-left: 3px solid var(--cat-color, #6C63FF) !important;
  background: rgba(0,0,0,0.02) !important;
  transition: all 0.18s ease !important;
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .ejh-widget-categories li a {
  background: rgba(255,255,255,0.03) !important;
  color: var(--color-text) !important;
}

/* Hover: fill with category color tint */
.ejh-widget-categories li a:hover {
  background: color-mix(in srgb, var(--cat-color, #6C63FF) 10%, transparent) !important;
  border-color: transparent !important;
  border-left-color: var(--cat-color, #6C63FF) !important;
  color: var(--cat-color, #6C63FF) !important;
  transform: translateX(3px) !important;
  box-shadow: 0 2px 12px color-mix(in srgb, var(--cat-color, #6C63FF) 20%, transparent) !important;
}

/* Fallback hover for older browsers */
.ejh-widget-categories li a:hover {
  background: rgba(108,99,255,0.08) !important;
}

.cat-icon {
  font-size: 1.1rem !important;
  width: 28px !important;
  height: 28px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0,0,0,0.04) !important;
  border-radius: 8px !important;
  flex-shrink: 0 !important;
  transition: transform 0.2s ease !important;
}
[data-theme="dark"] .cat-icon { background: rgba(255,255,255,0.06) !important; }
.ejh-widget-categories li a:hover .cat-icon { transform: scale(1.15) rotate(-5deg) !important; }

.cat-name {
  flex: 1 !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.cat-count {
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  min-width: 22px !important;
  height: 22px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0,0,0,0.06) !important;
  color: var(--color-text-secondary) !important;
  border-radius: 100px !important;
  padding: 0 7px !important;
  flex-shrink: 0 !important;
  transition: background 0.18s ease, color 0.18s ease !important;
}
[data-theme="dark"] .cat-count { background: rgba(255,255,255,0.08) !important; }
.ejh-widget-categories li a:hover .cat-count {
  background: var(--cat-color, #6C63FF) !important;
  color: #fff !important;
}

/* ── Recent Posts Widget ────────────────────────────────────── */
.ejh-widget-posts { gap: 12px !important; }

.ejh-widget-post-item {
  display: flex !important;
  gap: 12px !important;
  align-items: flex-start !important;
  padding: 10px !important;
  border-radius: 12px !important;
  transition: background 0.18s ease !important;
  cursor: pointer;
}
.ejh-widget-post-item:hover { background: rgba(108,99,255,0.05) !important; }
[data-theme="dark"] .ejh-widget-post-item:hover { background: rgba(108,99,255,0.1) !important; }

.ejh-widget-thumb {
  width: 64px !important;
  height: 48px !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
}
.ejh-widget-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  transition: transform 0.3s ease !important;
}
.ejh-widget-post-item:hover .ejh-widget-thumb img { transform: scale(1.08) !important; }

.ejh-widget-post-title {
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  color: var(--color-heading) !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-decoration: none !important;
}
.ejh-widget-post-title:hover { color: var(--color-primary) !important; }

.ejh-widget-post-date {
  font-size: 0.72rem !important;
  color: var(--color-text-muted) !important;
  margin-top: 4px !important;
}

/* ── Search Widget ──────────────────────────────────────────── */
.ejh-widget--search .ejh-search-form__input {
  background: rgba(0,0,0,0.04) !important;
  border: 1.5px solid rgba(0,0,0,0.08) !important;
  border-radius: 12px !important;
  padding: 11px 46px 11px 16px !important;
  font-size: 0.875rem !important;
  color: var(--color-text) !important;
}
[data-theme="dark"] .ejh-widget--search .ejh-search-form__input {
  background: rgba(255,255,255,0.05) !important;
  border-color: rgba(255,255,255,0.08) !important;
  color: var(--color-text) !important;
}
.ejh-widget--search .ejh-search-form__input:focus {
  border-color: var(--color-primary) !important;
  background: rgba(108,99,255,0.04) !important;
  box-shadow: 0 0 0 3px rgba(108,99,255,0.12) !important;
}

/* ── Tag Cloud Widget ───────────────────────────────────────── */
.ejh-tag-cloud { gap: 6px !important; }
.ejh-tag {
  padding: 5px 12px !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  border-radius: 100px !important;
  background: rgba(0,0,0,0.04) !important;
  border: 1px solid rgba(0,0,0,0.07) !important;
  color: var(--color-text-secondary) !important;
  transition: all 0.18s ease !important;
  text-decoration: none !important;
}
[data-theme="dark"] .ejh-tag {
  background: rgba(255,255,255,0.05) !important;
  border-color: rgba(255,255,255,0.08) !important;
}
.ejh-tag:hover {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  color: #fff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(108,99,255,0.3) !important;
}
