/* Research View Styles */
:root {
  --primary-color: #ff4500;
  --text-main: #1a1a1a;
  --text-muted: #666;
  --bg-light: #f8f9fa;
  --white: #ffffff;
  --spacing-xl: 40px;
  --spacing-lg: 24px;
  /* Reader Settings Defaults */
  --reader-font-size: 20px;
  --reader-font-family: "Lora", serif;
  --heading-font-family: "Outfit", sans-serif;
}

body {
  background: var(--white);
  font-family: var(--reader-font-family);
  color: var(--text-main);
  line-height: 1.8;
  margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--heading-font-family);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.view-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  z-index: 1000;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.back-btn,
.header-icon-btn {
  background: #f5f5f5;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: #444;
}

.back-btn:hover,
.header-icon-btn:hover {
  background: #eee;
  transform: scale(1.05);
  color: var(--primary-color);
}

.category-tag {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--primary-color);
  background: #fff5f0;
  padding: 6px 16px;
  border-radius: 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Dropdown Panels */
.settings-dropdown,
.share-dropdown {
  position: relative;
}

.settings-panel,
.share-panel {
  position: absolute;
  top: calc(100% + 15px);
  right: 0;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  padding: 20px;
  min-width: 240px;
  display: none;
  z-index: 1001;
  animation: slideInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-panel.active,
.share-panel.active {
  display: block;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Settings Panel Content */
.settings-group {
  margin-bottom: 20px;
}

.settings-group:last-child {
  margin-bottom: 0;
}

.settings-group label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.size-controls,
.font-controls {
  display: flex;
  gap: 8px;
}

.size-controls button,
.font-controls button {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  color: #444;
}

.size-controls button:hover,
.font-controls button:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.font-controls button.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Share Panel Content */
.share-panel a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #444;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.2s;
}

.share-panel a:hover {
  background: #f8fafc;
  color: var(--primary-color);
}

.share-panel hr {
  border: none;
  border-top: 1px solid #f0f0f0;
  margin: 10px 0;
}

/* Hero Section */
.research-hero {
  position: relative;
  height: 60vh;
  min-height: 400px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  margin-top: 70px;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.5s ease;
}

.research-hero:hover .hero-bg {
  transform: scale(1.05);
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 30%, rgba(0, 0, 0, 0.8));
}

.hero-content {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: var(--spacing-xl) 20px;
  color: white;
  width: 100%;
}

.research-title {
  font-size: clamp(32px, 5vw, 56px);
  margin-bottom: 24px;
  line-height: 1.1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.research-meta {
  display: flex;
  align-items: center;
  gap: 20px;
}

.author-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-info img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.author-name {
  display: block;
  font-weight: 700;
  font-size: 16px;
}

.published-date {
  font-size: 13px;
  opacity: 0.8;
}

/* Article Layout */
.article-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 50px;
  padding: 60px 20px;
}

.article-sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.sidebar-card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.02),
    0 10px 15px -3px rgba(0, 0, 0, 0.03);
}

.sidebar-card h3 {
  font-family: "Outfit", sans-serif;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 20px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.researcher-item {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 10px;
  border-radius: 16px;
  transition: all 0.2s;
}

.researcher-item:hover {
  background: rgba(255, 255, 255, 0.5);
}

.researcher-item img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.r-info {
  flex: 1;
}

.r-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}

.r-role {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.follow-btn {
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  background: linear-gradient(135deg, var(--primary-color), #ff6b35);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 69, 0, 0.2);
}

.follow-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 69, 0, 0.3);
}

.follow-btn.following {
  background: #f1f5f9;
  color: #475569;
  box-shadow: none;
}

.follow-btn.following:hover {
  background: #e2e8f0;
}

.view-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.view-tags .tag {
  font-size: 13px;
  color: var(--primary-color);
  font-weight: 600;
}

/* Related Research Section */
.related-research-card {
  margin-top: 24px;
}

.related-research-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.related-item {
  display: flex;
  gap: 16px;
  padding: 12px;
  background: white;
  border-radius: 20px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid #f1f5f9;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  overflow: hidden;
}

.related-item:hover {
  transform: translateY(-4px);
  border-color: var(--primary-color-soft);
  box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.12);
}

.related-hero-thumb {
  width: 90px;
  height: 90px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.related-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.related-info h4 {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 8px 0;
  line-height: 1.4;
  font-family: "Outfit", sans-serif;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-abstract {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 12px 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: "Lora", serif;
}

.related-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  padding-top: 12px;
  border-top: 1px solid #f8fafc;
}

.related-stats {
  display: flex;
  gap: 16px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.related-stats i {
  color: var(--primary-color);
  opacity: 0.8;
}

/* Hide related research on mobile */
@media (max-width: 900px) {
  .related-research-card {
    display: block;
  }
}

/* Main Content */
.article-main {
  max-width: 100%;
}

.abstract-section {
  margin-bottom: 40px;
}

.abstract-section h2 {
  font-size: 22px;
  margin-bottom: 16px;
  color: var(--text-main);
  font-weight: 800;
}

.abstract-section p {
  font-size: 16px;
  color: #444;
  font-style: italic;
  border-left: 4px solid var(--primary-color);
  padding-left: 24px;
  margin: 0;
}

.content-divider {
  height: 1px;
  background: #efefef;
  margin: 50px 0;
  position: relative;
}

.content-divider::after {
  content: "• • •";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 0 15px;
  color: #ccc;
  letter-spacing: 5px;
}

.research-body-content {
  font-size: var(--reader-font-size);
  line-height: 1.7;
  color: rgba(41, 41, 41, 1);
  font-family: var(--reader-font-family);
  letter-spacing: -0.003em;
  word-break: break-word;
}

.research-body-content p {
  margin-bottom: 1.38em; /* 29px at 21px base */
  font-weight: 400;
}

/* Drop cap for first paragraph */
.research-body-content > p:first-of-type::first-letter {
  float: left;
  font-size: 6.3em;
  line-height: 0.9;
  margin: 0.07em 0.1em 0 0;
  font-weight: 700;
  color: var(--primary-color);
}

.research-body-content h1,
.research-body-content h2,
.research-body-content h3,
.research-body-content h4 {
  color: rgba(41, 41, 41, 1);
  font-family: var(--heading-font-family);
  margin-top: 2em;
  margin-bottom: 0.46em;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.022em;
}

.research-body-content h1 {
  font-size: 2em; /* 42px */
  margin-top: 1.95em;
}

.research-body-content h2 {
  font-size: 1.62em; /* 34px */
  border-bottom: none;
  padding-bottom: 0;
}

.research-body-content h3 {
  font-size: 1.38em; /* 29px */
}

.research-body-content h4 {
  font-size: 1.14em; /* 24px */
}

.research-body-content blockquote {
  margin: 3rem 0;
  padding: 1.5rem 2.5rem;
  border-left: 5px solid var(--primary-color);
  background: #fffafa;
  font-style: italic;
  font-size: 1.4rem;
  line-height: 1.6;
  color: #444;
  position: relative;
  border-radius: 0 12px 12px 0;
}

.research-body-content blockquote::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 15px;
  font-size: 4rem;
  color: var(--primary-color);
  opacity: 0.1;
  font-family: "Montserrat", sans-serif;
}

.research-body-content ul,
.research-body-content ol {
  margin-bottom: 2.5rem;
  padding-left: 1.5rem;
}

.research-body-content li {
  margin-bottom: 0.8rem;
  position: relative;
}

.research-body-content ul li::marker {
  color: var(--primary-color);
}

/* Modernize media elements and hide editor handles */
.research-body-content img {
  max-width: 100%;
  border-radius: 20px;
  margin: 3.5rem 0;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
  display: block;
}

.media-selection-handle,
.delete-media-btn,
.resize-handle {
  display: none !important;
}

.research-body-content .media-wrapper {
  position: relative;
  margin: 3.5rem 0;
}

.research-body-content figure {
  margin: 3.5rem 0;
  text-align: center;
}

.research-body-content figcaption {
  font-size: 0.9rem;
  color: #888;
  margin-top: 1rem;
  font-style: italic;
}

.research-body-content iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  margin: 3.5rem 0;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.research-body-content strong {
  color: #000;
  font-weight: 700;
}

.research-body-content a {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 69, 0, 0.2);
  transition: all 0.2s;
}

.research-body-content a:hover {
  border-bottom-color: var(--primary-color);
}

/* Footer Interaction */
.article-footer {
  margin-top: 80px;
  padding-top: 40px;
  border-top: 1px solid #eee;
}

.interaction-bar {
  display: flex;
  gap: 20px;
}

.action-btn {
  background: transparent;
  border: 1px solid #ddd;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: #fff5f0;
}

.view-footer {
  padding: 60px 20px;
  background: #1a1a1a;
  color: #777;
  text-align: center;
  font-size: 14px;
}

/* Follow Button */
.follow-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--primary-color);
  background: transparent;
  color: var(--primary-color);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
}

.follow-btn.following {
  background: #f0f0f0;
  border-color: #ddd;
  color: #666;
}

.follow-btn:hover:not(.following) {
  background: var(--primary-color);
  color: white;
}

/* Likes */
.action-btn.liked {
  color: var(--primary-color);
  border-color: var(--primary-color);
  background: #fff5f0;
}

.action-btn.liked i {
  animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1);
  }
}

/* Comments Section */
.comments-section {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 2px solid #f0f0f0;
}

.comments-section h3 {
  font-size: 20px;
  margin-bottom: 30px;
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
}

.comment-input-wrapper {
  display: flex;
  gap: 16px;
  margin-top: 40px;
  background: #fcfcfc;
  padding: 24px;
  border-radius: 20px;
  border: 1px solid #f0f0f0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.user-avatar-small {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.input-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
}

#commentInput {
  width: 100%;
  min-height: 100px;
  padding: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  font-family: inherit;
  font-size: 15px;
  resize: none;
  background: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#commentInput:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(255, 69, 0, 0.1);
}

.btn-send-comment {
  background: linear-gradient(135deg, var(--primary-color), #ff6b35);
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(255, 69, 0, 0.2);
}

.btn-send-comment:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 69, 0, 0.3);
}

/* Comments List */
.comment-item {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-payload {
  flex: 1;
}

.comment-header {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-header .author {
  font-weight: 700;
  font-size: 15px;
  color: #1a1a1a;
}

.comment-header .time {
  font-size: 12px;
  color: #bbb;
}

.comment-text {
  font-size: 16px;
  color: #444;
  margin-bottom: 12px;
  line-height: 1.6;
}

.comment-actions button {
  background: #f5f5f5;
  border: none;
  color: #666;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 20px;
  transition: all 0.2s;
}

.comment-actions button:hover {
  background: #eee;
  color: var(--primary-color);
}

/* Replies */
.replies-list {
  margin-top: 16px;
}

.reply-item {
  margin-top: 16px;
  padding-left: 16px;
  border-left: 2px solid #f5f5f5;
}

.reply-input-box {
  margin-top: 20px;
  margin-left: 16px;
  background: #f9f9f9;
  padding: 2px;
  border-radius: 16px;
  border: 1px solid #f0f0f0;
}

.reply-field-wrapper {
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.reply-field-wrapper textarea {
  width: 100%;
  min-height: 70px;
  border: 1px solid #eef0f2;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  resize: none;
  margin-bottom: 12px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.reply-field-wrapper textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.reply-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.reply-btns .btn-cancel {
  background: transparent;
  border: none;
  color: #999;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 16px;
}

.btn-reply-send {
  background: var(--primary-color);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reply-send:hover {
  transform: scale(1.05);
  background: #e63e00;
}

/* Responsive */
@media (max-width: 900px) {
  .article-container {
    grid-template-columns: 1fr;
  }

  .article-sidebar {
    position: static;
    order: 2;
  }

  .article-main {
    order: 1;
    max-width: 100%;
  }

  .research-hero {
    height: 50vh;
  }
}

/* Login Prompt for Unauthenticated Users */
.comments-login-prompt {
  margin: 50px 0;
  padding: 40px 20px;
}

.login-prompt-card {
  background: linear-gradient(135deg, #fff5f2 0%, #ffffff 100%);
  border-radius: 24px;
  padding: 60px 40px;
  text-align: center;
  border: 1px solid #ffe5dc;
  box-shadow: 0 8px 30px rgba(255, 69, 0, 0.08);
}

.prompt-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #ff4500, #ff6b35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 8px 20px rgba(255, 69, 0, 0.2);
}

.prompt-icon i {
  font-size: 36px;
  color: white;
}

.login-prompt-card h3 {
  font-size: 32px;
  font-weight: 800;
  font-family: "Outfit", sans-serif;
  color: #1a202c;
  margin-bottom: 16px;
}

.login-prompt-card > p {
  font-size: 18px;
  color: #4a5568;
  line-height: 1.7;
  margin-bottom: 32px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.prompt-benefits {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: #2d3748;
  font-weight: 600;
}

.benefit-item i {
  color: var(--primary-color);
  font-size: 18px;
}

.prompt-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-prompt-primary,
.btn-prompt-secondary {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
}

.btn-prompt-primary {
  background: linear-gradient(135deg, #ff4500, #ff6b35);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 69, 0, 0.3);
}

.btn-prompt-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 69, 0, 0.4);
}

.btn-prompt-secondary {
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-prompt-secondary:hover {
  background: #fff5f2;
  transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
  .login-prompt-card {
    padding: 40px 24px;
  }
  
  .login-prompt-card h3 {
    font-size: 24px;
  }
  
  .login-prompt-card > p {
    font-size: 16px;
  }
  
  .prompt-benefits {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
  
  .prompt-actions {
    flex-direction: column;
  }
  
  .btn-prompt-primary,
  .btn-prompt-secondary {
    width: 100%;
  }
}
