/**
 * Single Post Template Styles
 * ServiziWP AI Search Plugin
 */

/* ============ WRAPPER ============ */
.swp-single-post-wrapper {
  max-width: 1140px;
  margin: 0 auto;
  padding: 50px 20px;
  font-family: Montserrat, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #0c0c0c;
  background: #fff;
}

.swp-single-post {
  width: 100%;
}

/* ============ BREADCRUMB ============ */
.swp-breadcrumb {
  margin-bottom: 30px;
}

.swp-breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 14px;
  color: #7A7A7A;
}

.swp-breadcrumb-list li {
  display: flex;
  align-items: center;
}

.swp-breadcrumb-list li:not(:last-child)::after {
  content: '>';
  margin-left: 8px;
  color: #7A7A7A;
}

.swp-breadcrumb-list a {
  color: #6EC1E4;
  text-decoration: none;
  transition: color 0.2s;
}

.swp-breadcrumb-list a:hover {
  color: #4054B2;
}

.swp-breadcrumb-list li:last-child span {
  color: #0c0c0c;
  font-weight: 500;
}

/* ============ HEADER ============ */
.swp-post-header {
  margin-bottom: 30px;
  text-align: left;
}

.swp-post-title {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: #0c0c0c;
  margin: 0 0 20px 0;
  font-family: Montserrat, sans-serif;
}

.swp-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 15px;
  color: #7A7A7A;
  align-items: center;
}

.swp-post-meta > span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swp-post-meta svg {
  flex-shrink: 0;
  color: #6EC1E4;
}

.swp-post-category a {
  color: #6EC1E4;
  text-decoration: none;
  transition: color 0.2s;
}

.swp-post-category a:hover {
  color: #4054B2;
}

/* ============ FEATURED IMAGE ============ */
.swp-post-thumbnail {
  margin-bottom: 40px;
  text-align: center;
}

.swp-post-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ============ TABLE OF CONTENTS ============ */
.swp-toc-container {
  max-width: 800px;
  margin: 0 auto 40px;
  padding: 24px;
  background: #f7f7f7;
  border: 1px solid #dddddd;
  border-radius: 10px;
}

.swp-toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.swp-toc-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: #0c0c0c;
}

.swp-toc-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #6EC1E4;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  padding: 4px 8px;
  transition: color 0.2s;
}

.swp-toc-toggle:hover {
  color: #4054B2;
}

.swp-toc-toggle-icon {
  transition: transform 0.3s ease;
}

.swp-toc-container.collapsed .swp-toc-toggle-icon {
  transform: rotate(-90deg);
}

.swp-toc-nav {
  transition: all 0.3s ease;
}

.swp-toc-container.collapsed .swp-toc-nav {
  display: none;
}

.swp-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc-counter;
}

.swp-toc-list li {
  counter-increment: toc-counter;
  margin-bottom: 8px;
}

.swp-toc-list li.h2::before {
  content: counter(toc-counter) ". ";
  font-weight: 600;
}

.swp-toc-list li.h3 {
  margin-left: 20px;
  counter-increment: none;
}

.swp-toc-list li.h3::before {
  content: "• ";
  color: #6EC1E4;
}

.swp-toc-list a {
  color: #0c0c0c;
  text-decoration: none;
  transition: color 0.2s;
  font-size: 15px;
  line-height: 1.5;
}

.swp-toc-list a:hover,
.swp-toc-list a.active {
  color: #6EC1E4;
}

/* ============ CONTENT ============ */
.swp-post-content-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

.swp-post-content {
  font-size: 1.125rem;
  line-height: 1.7;
  color: #0c0c0c;
  margin-bottom: 50px;
}

.swp-post-content h2 {
  font-size: 2rem;
  font-weight: 600;
  margin: 40px 0 20px;
  color: #0c0c0c;
  line-height: 1.3;
  scroll-margin-top: 100px;
}

.swp-post-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 30px 0 15px;
  color: #0c0c0c;
  line-height: 1.3;
  scroll-margin-top: 100px;
}

.swp-post-content h4,
.swp-post-content h5,
.swp-post-content h6 {
  font-weight: 600;
  margin: 25px 0 15px;
  color: #0c0c0c;
  scroll-margin-top: 100px;
}

.swp-post-content p {
  margin-bottom: 20px;
}

.swp-post-content a {
  color: #6EC1E4;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
}

.swp-post-content a:hover {
  color: #4054B2;
  border-bottom-color: #4054B2;
}

.swp-post-content ul,
.swp-post-content ol {
  margin: 20px 0;
  padding-left: 30px;
}

.swp-post-content li {
  margin-bottom: 10px;
}

.swp-post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 20px 0;
}

.swp-post-content blockquote {
  margin: 30px 0;
  padding: 20px 30px;
  background: #f7f7f7;
  border-left: 4px solid #6EC1E4;
  font-style: italic;
  color: #0c0c0c;
}

.swp-post-content code {
  background: #f7f7f7;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
  color: #23A455;
}

.swp-post-content pre {
  background: #0c0c0c;
  color: #fff;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 20px 0;
}

.swp-post-content pre code {
  background: none;
  padding: 0;
  color: #fff;
}

/* ============ AUTHOR BOX ============ */
.swp-author-box {
  max-width: 800px;
  margin: 50px auto;
  padding: 30px 0;
  border-top: 1px solid #dddddd;
  border-bottom: 1px solid #dddddd;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.swp-author-avatar {
  flex-shrink: 0;
}

.swp-author-avatar img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid #6EC1E4;
}

.swp-author-info {
  flex: 1;
}

.swp-author-name {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: #0c0c0c;
}

.swp-author-bio {
  font-size: 15px;
  line-height: 1.6;
  color: #7A7A7A;
  margin: 0;
}

/* ============ POST NAVIGATION ============ */
.swp-post-navigation {
  max-width: 800px;
  margin: 50px auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.swp-post-nav-item {
  min-width: 0;
}

.swp-post-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: #f7f7f7;
  border-radius: 10px;
  text-decoration: none;
  color: #0c0c0c;
  transition: all 0.3s;
  height: 100%;
}

.swp-post-nav-link:hover {
  background: #6EC1E4;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(110, 193, 228, 0.3);
}

.swp-post-nav-link svg {
  flex-shrink: 0;
  color: #6EC1E4;
  transition: color 0.3s;
}

.swp-post-nav-link:hover svg {
  color: #fff;
}

.swp-post-nav-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.swp-post-nav-label {
  font-size: 13px;
  font-weight: 500;
  color: #7A7A7A;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.swp-post-nav-link:hover .swp-post-nav-label {
  color: rgba(255, 255, 255, 0.8);
}

.swp-post-nav-title {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.swp-post-nav-prev .swp-post-nav-link {
  justify-content: flex-start;
}

.swp-post-nav-next .swp-post-nav-link {
  justify-content: flex-end;
  text-align: right;
}

/* ============ RELATED POSTS ============ */
.swp-related-posts {
  max-width: 1140px;
  margin: 60px auto 0;
  padding-top: 50px;
  border-top: 2px solid #e5e7eb;
}

.swp-related-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 30px 0;
  color: #0c0c0c;
  text-align: center;
}

.swp-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
}

/* Riutilizza le classi blog card esistenti */
/* Le classi .swp-blog-card sono già definite in ai-search.css */

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .swp-single-post-wrapper {
    padding: 30px 15px;
  }

  .swp-post-title {
    font-size: 2rem;
  }

  .swp-post-meta {
    font-size: 14px;
    gap: 15px;
  }

  .swp-toc-container {
    padding: 20px;
  }

  .swp-post-content {
    font-size: 1rem;
  }

  .swp-post-content h2 {
    font-size: 1.5rem;
  }

  .swp-post-content h3 {
    font-size: 1.25rem;
  }

  .swp-author-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .swp-post-navigation {
    grid-template-columns: 1fr;
  }

  .swp-post-nav-next .swp-post-nav-link {
    text-align: left;
  }

  .swp-related-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .swp-post-title {
    font-size: 1.75rem;
  }

  .swp-post-content {
    font-size: 0.95rem;
  }

  .swp-toc-list a {
    font-size: 14px;
  }

  .swp-author-avatar img {
    width: 80px;
    height: 80px;
  }

  .swp-author-name {
    font-size: 1.25rem;
  }
}

/* ============ COMMENTS SECTION ============ */
.swp-comments-section {
  max-width: 800px;
  margin: 60px auto 0;
  padding-top: 50px;
  border-top: 2px solid #e5e7eb;
}

.swp-comments-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 30px 0;
  color: #0c0c0c;
}

/* Comment List */
.swp-comments-list {
  list-style: none;
  padding: 0;
  margin: 0 0 40px 0;
}

.swp-comment {
  padding: 25px;
  margin-bottom: 20px;
  background: #f7f7f7;
  border-radius: 10px;
  border-left: 4px solid #6EC1E4;
}

.swp-comment-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.swp-comment-avatar {
  flex-shrink: 0;
}

.swp-comment-avatar img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid #6EC1E4;
}

.swp-comment-meta {
  flex: 1;
}

.swp-comment-author {
  font-size: 16px;
  font-weight: 600;
  color: #0c0c0c;
  margin: 0 0 4px 0;
}

.swp-comment-date {
  font-size: 13px;
  color: #7A7A7A;
}

.swp-comment-content {
  font-size: 15px;
  line-height: 1.6;
  color: #0c0c0c;
  margin: 0;
}

.swp-comment-awaiting {
  display: inline-block;
  padding: 4px 10px;
  background: #fff3cd;
  color: #856404;
  border-radius: 4px;
  font-size: 13px;
  margin-top: 10px;
}

/* Comment Form */
.swp-comment-respond {
  margin-top: 40px;
}

.swp-comment-reply-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 25px 0;
  color: #0c0c0c;
}

#commentform {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.comment-form-comment,
.comment-form-author,
.comment-form-email {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-form-comment label,
.comment-form-author label,
.comment-form-email label {
  font-size: 15px;
  font-weight: 500;
  color: #0c0c0c;
}

.comment-form-comment textarea,
.comment-form-author input,
.comment-form-email input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  color: #0c0c0c;
  background: #fff;
  border: 2px solid #dddddd;
  border-radius: 8px;
  transition: all 0.3s;
}

.comment-form-comment textarea:focus,
.comment-form-author input:focus,
.comment-form-email input:focus {
  outline: none;
  border-color: #6EC1E4;
  box-shadow: 0 0 0 3px rgba(110, 193, 228, 0.1);
}

.comment-form-comment textarea {
  min-height: 150px;
  resize: vertical;
}

.form-submit {
  margin: 0;
}

.form-submit .submit {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: #6EC1E4;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.form-submit .submit:hover {
  background: #4054B2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(64, 84, 178, 0.3);
}

.form-submit .submit:active {
  transform: translateY(0);
}

.comment-notes {
  font-size: 14px;
  color: #7A7A7A;
  margin-bottom: 15px;
}

.required {
  color: #dc3545;
}

/* No Comments Message */
.swp-no-comments {
  text-align: center;
  padding: 40px 20px;
  background: #f7f7f7;
  border-radius: 10px;
  color: #7A7A7A;
  font-size: 15px;
}

/* Responsive */
@media (max-width: 768px) {
  .swp-comments-section {
    padding-top: 30px;
  }

  .swp-comments-title {
    font-size: 1.5rem;
  }

  .swp-comment {
    padding: 20px;
  }

  .form-submit .submit {
    width: 100%;
  }
}
