/*
 * AIFree.vn — Header, menu, footer, series article layout
 */

/* Blog sidebar: search — input full width, button below (not cramped inline) */
#secondary .wp-block-search__inside-wrapper,
.sidebar-main .wp-block-search__inside-wrapper {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

#secondary .wp-block-search__button,
.sidebar-main .wp-block-search__button {
  width: 100%;
  margin: 0;
  border-radius: 6px;
}

#secondary .wp-block-search__input,
.sidebar-main .wp-block-search__input {
  width: 100%;
  border-radius: 6px;
}

.header-nav .nav > li > a {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.header-nav .nav > li > a:hover,
.header-nav .nav > li.active > a {
  color: #2563eb;
}

.header.stuck,
.header-main.stuck {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.footer-1 {
  padding-top: 2.5rem;
  padding-bottom: 1.5rem;
}

.footer-1 .widget-title,
.footer-1 h3 {
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
  color: #1f2937;
}

.footer-1 .wp-block-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-1 .wp-block-list li {
  margin-bottom: 0.35rem;
}

.footer-1 .wp-block-list a {
  color: #4b5563;
  text-decoration: none;
}

.footer-1 .wp-block-list a:hover {
  color: #2563eb;
}

/* Absolute footer: center menu + copyright, avoid pull-left layout glitches */
.absolute-footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.absolute-footer .footer-primary,
.absolute-footer .footer-secondary {
  float: none !important;
  width: 100%;
  max-width: 100%;
}

.absolute-footer .footer-primary {
  order: 1;
}

.absolute-footer .footer-secondary {
  order: 2;
  margin-top: 0.5rem;
}

.absolute-footer .footer-nav {
  justify-content: center;
  margin-bottom: 0.5rem;
}

.copyright-footer {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: #6b7280;
  margin-top: 0.35rem;
}

.copyright-footer strong {
  font-weight: 600;
  color: inherit;
}

.copyright-footer a {
  color: #4b5563;
  text-decoration: none;
}

.copyright-footer a:hover {
  color: #2563eb;
}

.aifree-footer-sep {
  opacity: 0.45;
  margin: 0 0.15rem;
}

.aifree-footer-tagline {
  color: #9ca3af;
  font-weight: 400;
}

.absolute-footer.dark .copyright-footer {
  color: rgba(255, 255, 255, 0.72);
}

.absolute-footer.dark .copyright-footer a {
  color: rgba(255, 255, 255, 0.85);
}

.absolute-footer.dark .copyright-footer a:hover {
  color: #fff;
}

.absolute-footer.dark .aifree-footer-tagline {
  color: rgba(255, 255, 255, 0.55);
}

.footer-nav .nav {
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.footer-nav .nav > li > a {
  font-size: 0.9rem;
  color: #4b5563;
}

.footer-nav .nav > li > a:hover {
  color: #2563eb;
}

.aifree-page-about h2,
.aifree-page-contact h2 {
  margin-top: 0;
}

.aifree-page-about h3,
.aifree-page-contact h3 {
  margin-top: 1.5rem;
  font-size: 1.15rem;
}

.blog-archive .post-item .box-text {
  padding: 1.25rem;
}

/* Category / blog archive — consistent header & grid */
.archive .archive-page-header {
  padding: 2rem 0 1.5rem;
  text-align: center;
  max-width: 720px;
  margin: 0 auto 1rem;
}

.archive .archive-page-header .page-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 0.5rem;
}

.archive .archive-page-header .taxonomy-description {
  color: #6b7280;
  font-size: 1rem;
  line-height: 1.6;
}

.archive .blog-archive .post-item {
  margin-bottom: 1.5rem;
}

.archive #content.blog-wrapper {
  padding-top: 0.5rem;
}

/* —— Linuxize-style category / tag archive (full width, no sidebar) —— */
.aifree-archive-list-layout #secondary,
.aifree-archive-list-layout .post-sidebar,
.aifree-archive-list-layout .widget-area {
  display: none !important;
}

.aifree-archive-list-layout .aifree-archive-main {
  background: #fff;
}

.aifree-archive-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.aifree-archive-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.aifree-archive-header__title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  color: #111827;
}

.aifree-archive-header__desc {
  font-size: 1.05rem;
  line-height: 1.65;
  color: #6b7280;
}

.aifree-archive-header__desc p:last-child {
  margin-bottom: 0;
}

/* Featured: 3 columns */
.aifree-archive-featured {
  margin-bottom: 2.5rem;
}

.aifree-archive-featured__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 0;
}

@media (max-width: 849px) {
  .aifree-archive-featured__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.aifree-archive-card {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  height: 100%;
}

.aifree-archive-card__image-link {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #e5e7eb;
}

.aifree-archive-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.aifree-archive-card__meta {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin: 0.85rem 1rem 0.35rem;
  line-height: 1.4;
}

.aifree-archive-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 1rem 0.5rem;
}

.aifree-archive-card__title a {
  color: #111827;
  text-decoration: none;
}

.aifree-archive-card__title a:hover {
  color: #2563eb;
}

.aifree-archive-card__excerpt {
  font-size: 0.875rem;
  line-height: 1.55;
  color: #4b5563;
  margin: 0 1rem 1.1rem;
  flex: 1;
}

.aifree-archive-list-section {
  border-top: 1px solid #e5e7eb;
  padding-top: 0.5rem;
}

.aifree-archive-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.aifree-archive-item {
  padding: 1.35rem 0;
  border-bottom: 1px solid #f3f4f6;
  margin: 0;
}

.aifree-archive-item--row {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.aifree-archive-item__body {
  flex: 1;
  min-width: 0;
}

.aifree-archive-item__thumb {
  flex: 0 0 112px;
  display: block;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #e5e7eb;
}

.aifree-archive-item__thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Tablet / mobile: ảnh list full width phía trên (tránh thumb nhỏ lệch trái) */
@media (max-width: 849px) {
  .aifree-archive-item--row {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .aifree-archive-item__thumb {
    order: -1;
    flex: none;
    width: 100%;
    max-width: none;
    align-self: stretch;
    aspect-ratio: 16 / 10;
  }

  .aifree-archive-item__body {
    width: 100%;
  }
}

.aifree-archive-item:first-child {
  padding-top: 0.75rem;
}

.aifree-archive-item__title {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 0.45rem;
}

.aifree-archive-item__title a {
  color: #111827;
  text-decoration: none;
}

.aifree-archive-item__title a:hover {
  color: #2563eb;
}

.aifree-archive-item__meta {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.aifree-archive-item__sep {
  margin: 0 0.35rem;
  color: #d1d5db;
}

.aifree-archive-badge {
  display: inline;
  font-size: 0.8125rem;
  font-weight: 600;
}

.aifree-archive-badge--lesson {
  color: #2563eb;
}

.aifree-archive-badge--hub {
  color: #7c3aed;
}

.aifree-archive-badge--series {
  color: #059669;
}

.aifree-archive-badge--new {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: #7c3aed;
  color: #fff;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  vertical-align: middle;
}

.aifree-archive-item__excerpt {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #4b5563;
  margin: 0;
}

.aifree-archive-pagination {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
  text-align: center;
}

.aifree-archive-pagination ul.page-numbers {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.aifree-archive-pagination ul.page-numbers li {
  margin: 0;
  padding: 0;
  line-height: 1;
}

.aifree-archive-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.65rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  color: #f9fafb;
  background: #374151;
  border: 1px solid #4b5563;
  box-sizing: border-box;
}

.aifree-archive-pagination a.page-numbers:hover {
  background: #4b5563;
  color: #fff;
}

.aifree-archive-pagination .page-numbers.current {
  background: #fff;
  color: #111827;
  border-color: #d1d5db;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.aifree-archive-pagination .page-numbers.dots {
  background: transparent;
  border-color: transparent;
  color: #9ca3af;
  min-width: 1.5rem;
  padding: 0;
}

.aifree-archive-pagination .page-numbers .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.aifree-archive-empty {
  color: #6b7280;
  font-size: 1rem;
}

/* —— Series article: hide Flatsome default sidebar (Search/Categories widgets) —— */
.aifree-series-layout .post-sidebar,
.aifree-series-layout #secondary,
.aifree-series-layout .widget-area,
.aifree-series-layout .aifree-article-row > .post-sidebar {
  display: none !important;
}

/* —— Series article: ToC left + series nav right —— */
.aifree-series-layout #main {
  background: #fff;
}

.aifree-series-layout .blog-wrapper.aifree-article-shell {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.aifree-series-layout .aifree-article-row {
  align-items: flex-start;
}

@media (min-width: 850px) {
  .aifree-series-layout .aifree-article-row {
    display: flex;
    flex-wrap: nowrap;
  }

  .aifree-series-layout .aifree-sidebar-left.col {
    flex: 0 0 22%;
    max-width: 22%;
    order: 1;
  }

  .aifree-series-layout .aifree-article-main.col {
    flex: 0 0 56%;
    max-width: 56%;
    order: 2;
  }

  .aifree-series-layout .aifree-sidebar-right.col {
    flex: 0 0 22%;
    max-width: 22%;
    order: 3;
  }

  /* Never show WP block search in series side column */
  .aifree-series-layout .aifree-sidebar-right .wp-block-search,
  .aifree-series-layout .aifree-article-row .wp-block-search {
    display: none !important;
  }

  .aifree-series-layout .aifree-toc-toggle {
    display: none !important;
  }
}

@media (max-width: 849px) {
  .aifree-series-layout .aifree-article-row {
    display: flex;
    flex-direction: column;
  }

  .aifree-series-layout .aifree-article-main {
    order: 1;
  }

  .aifree-series-layout .aifree-sidebar-right {
    order: 2;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
  }

  .aifree-series-layout .aifree-sidebar-left {
    order: 3;
    margin-top: 1rem;
  }

  .aifree-sidebar-left .aifree-sidebar-panel__title {
    display: none;
  }
}

.aifree-series-layout .aifree-article-row > .col {
  padding-top: 0.5rem;
  padding-bottom: 2rem;
}

.aifree-series-layout .aifree-entry-header {
  text-align: left !important;
  max-width: none;
  margin-bottom: 1rem;
}

.aifree-series-layout .aifree-lesson-kicker {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #2563eb;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}

.aifree-series-layout .entry-header .entry-divider.is-divider {
  margin: 0.5rem 0 1rem;
  max-width: 3rem;
  height: 2px;
  background: #2563eb;
  opacity: 1;
}

.aifree-series-layout .entry-image.aifree-featured-image .badge {
  display: none;
}

.aifree-sidebar-panel {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 0.5rem;
  font-size: 0.875rem;
}

.aifree-sidebar-panel__title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
  margin: 0 0 0.75rem;
}

.aifree-toc-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid #e5e7eb;
}

.aifree-toc-nav li {
  margin: 0;
  padding: 0;
}

.aifree-toc-nav a {
  display: block;
  padding: 0.35rem 0 0.35rem 0.85rem;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: #4b5563;
  text-decoration: none;
  line-height: 1.35;
}

.aifree-toc-nav a:hover,
.aifree-toc-nav a.is-active {
  color: #2563eb;
  border-left-color: #2563eb;
}

.aifree-toc-nav .level-h3 a {
  padding-left: 1.35rem;
  font-size: 0.8125rem;
}

.aifree-series-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.aifree-series-nav li {
  margin-bottom: 0.5rem;
}

.aifree-series-nav a {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  color: #374151;
  text-decoration: none;
  line-height: 1.35;
  border: 1px solid transparent;
}

.aifree-series-nav a:hover {
  background: #f3f4f6;
  color: #2563eb;
}

.aifree-series-nav li.is-current a {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
  font-weight: 600;
}

.aifree-series-nav .lesson-num {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin-bottom: 0.15rem;
}

.aifree-series-nav li.is-current .lesson-num {
  color: #2563eb;
}

.aifree-series-hub-link {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.aifree-series-hub-link a {
  color: #2563eb;
  text-decoration: none;
}

.aifree-series-badge {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  background: #f0f9ff;
  border-left: 3px solid #2563eb;
  margin-bottom: 1.25rem;
}

.aifree-article-main .entry-content h2 {
  scroll-margin-top: 100px;
}

.aifree-article-main .entry-content h3 {
  scroll-margin-top: 100px;
}

.aifree-toc-toggle {
  display: none;
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.6rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: left;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
}

@media (max-width: 849px) {
  .aifree-sidebar-panel {
    position: static;
    max-height: none;
  }

  .aifree-toc-toggle {
    display: block;
  }

  .aifree-sidebar-left .aifree-toc-panel.is-collapsed .aifree-toc-nav {
    display: none;
  }

  .header-nav .nav > li > a {
    padding: 0.65rem 0;
  }
}

@media (min-width: 850px) and (max-width: 1099px) {
  .aifree-series-layout .aifree-article-main.col {
    flex: 0 0 58%;
    max-width: 58%;
  }

  .aifree-series-layout .aifree-sidebar-left.col,
  .aifree-series-layout .aifree-sidebar-right.col {
    flex: 0 0 21%;
    max-width: 21%;
  }
}
