/* ===== Viblo Clone - Stylesheet ===== */
/* Design system based on Viblo.asia newest page */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family:
    "Open Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  color: #333;
  background: #f5f5f5;
  line-height: 1.5;
}

a {
  color: #5488c7;
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: #3a6ba8;
  text-decoration: underline;
}

ul,
ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* --- Container --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* --- Header / Main Navbar --- */
.main-navbar {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.main-navbar .container {
  display: flex;
  align-items: center;
  height: 50px;
  gap: 12px;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.4rem;
  font-weight: 700;
  color: #5488c7;
  text-decoration: none;
  flex-shrink: 0;
}

.navbar-logo:hover {
  text-decoration: none;
  color: #5488c7;
}

.navbar-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #5488c7, #2ebf91);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
}

.navbar-nav a {
  color: #555;
  font-size: 0.93rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  transition:
    background 0.15s,
    color 0.15s;
  white-space: nowrap;
}

.navbar-nav a:hover {
  background: #f0f4f8;
  color: #5488c7;
  text-decoration: none;
}

.navbar-nav a.active {
  color: #5488c7;
}

.navbar-search {
  flex: 1;
  max-width: 360px;
  margin-left: auto;
  position: relative;
}

.navbar-search input {
  width: 100%;
  padding: 7px 36px 7px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 0.86rem;
  background: #f9f9f9;
  outline: none;
  transition:
    border-color 0.2s,
    background 0.2s;
}

.navbar-search input:focus {
  border-color: #5488c7;
  background: #fff;
}

.navbar-search .search-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  padding: 5px 10px;
  color: #888;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.navbar-search .search-btn:hover {
  color: #5488c7;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.navbar-actions .icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #666;
  font-size: 1rem;
  transition:
    background 0.15s,
    color 0.15s;
}

.navbar-actions .icon-btn:hover {
  background: #f0f4f8;
  color: #5488c7;
}

.btn-write {
  padding: 6px 16px;
  background: #5488c7;
  color: #fff !important;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-write:hover {
  background: #3a6ba8;
  text-decoration: none;
}

.btn-login {
  padding: 6px 14px;
  border: 1px solid #5488c7;
  color: #5488c7 !important;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-login:hover {
  background: #5488c7;
  color: #fff !important;
  text-decoration: none;
}

/* --- Feed Bar (Sub-navigation) --- */
.feed-bar {
  background: #203f66;
  padding: 0;
}

.feed-bar .container {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.feed-bar .container::-webkit-scrollbar {
  display: none;
}

.feed-bar a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 10px 14px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.feed-bar a:hover {
  color: #fff;
  text-decoration: none;
}

.feed-bar a.active {
  color: #fff;
  border-bottom-color: #5488c7;
}

.feed-bar .badge {
  display: inline-block;
  background: #e74c3c;
  color: #fff;
  font-size: 0.68rem;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 4px;
  vertical-align: top;
}

/* --- Main Layout --- */
.main-content {
  padding: 20px 0 40px;
}

.main-content .container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

/* --- Post Feed --- */
.post-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* --- Post Card --- */
.post-card {
  background: #fff;
  padding: 18px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  gap: 14px;
  transition: background 0.15s;
}

.post-card:first-child {
  border-radius: 6px 6px 0 0;
}

.post-card:last-child {
  border-radius: 0 0 6px 6px;
  border-bottom: none;
}

.post-card:only-child {
  border-radius: 6px;
}

.post-card:hover {
  background: #fafcff;
}

.post-avatar {
  flex-shrink: 0;
}

.post-avatar .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5488c7, #2ebf91);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
}

.post-avatar .avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.post-info {
  flex: 1;
  min-width: 0;
}

/* Post meta top row */
.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: #888;
}

.post-meta .author {
  color: #5488c7;
  font-weight: 600;
}

.post-meta .author:hover {
  text-decoration: underline;
}

.post-meta .separator {
  color: #ccc;
}

/* Post title */
.post-title {
  margin-bottom: 8px;
}

.post-title a {
  color: #333;
  font-size: 1.14rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-title a:hover {
  color: #5488c7;
  text-decoration: none;
}

/* Tags */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: opacity 0.15s;
}

.tag:hover {
  opacity: 0.8;
  text-decoration: none;
}

.tag.primary {
  background: #e8f0fe;
  color: #5488c7;
}

.tag.secondary {
  background: #f0f0f0;
  color: #666;
}

/* Post footer (stats + votes) */
.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.post-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
  color: #888;
}

.post-stats .stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.post-stats .stat i {
  font-size: 0.85rem;
}

.post-votes {
  display: flex;
  align-items: center;
  gap: 2px;
}

.post-votes .vote-btn {
  color: #aaa;
  font-size: 0.9rem;
  padding: 2px 4px;
  transition: color 0.15s;
  display: flex;
  align-items: center;
}

.post-votes .vote-btn:hover {
  color: #5488c7;
}

.post-votes .vote-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: #555;
  min-width: 20px;
  text-align: center;
}

/* --- Sidebar --- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-block {
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
}

.sidebar-block-header {
  padding: 14px 16px 10px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-block-header i {
  color: #5488c7;
}

/* Trending sidebar */
.trending-list {
  padding: 8px 0;
}

.trending-item {
  padding: 10px 16px;
  display: flex;
  gap: 10px;
  transition: background 0.15s;
}

.trending-item:hover {
  background: #fafcff;
}

.trending-item .rank {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: #f0f0f0;
  color: #888;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.trending-item .rank.top {
  background: #5488c7;
  color: #fff;
}

.trending-item .trending-info {
  min-width: 0;
}

.trending-item .trending-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.trending-item .trending-title:hover {
  color: #5488c7;
  text-decoration: none;
}

.trending-item .trending-meta {
  font-size: 0.75rem;
  color: #999;
  margin-top: 3px;
}

/* Tags sidebar */
.sidebar-tags {
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-tags .stag {
  display: inline-block;
  padding: 4px 12px;
  background: #f5f5f5;
  color: #555;
  border-radius: 14px;
  font-size: 0.78rem;
  font-weight: 600;
  transition:
    background 0.15s,
    color 0.15s;
}

.sidebar-tags .stag:hover {
  background: #e8f0fe;
  color: #5488c7;
  text-decoration: none;
}

/* Authors sidebar */
.author-list {
  padding: 8px 0;
}

.author-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
}

.author-item:hover {
  background: #fafcff;
}

.author-item .author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5488c7, #8360c3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.author-item .author-info .author-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
}

.author-item .author-info .author-name:hover {
  color: #5488c7;
  text-decoration: none;
}

.author-item .author-info .author-posts {
  font-size: 0.75rem;
  color: #999;
}

/* Promo sidebar */
.sidebar-promo {
  padding: 20px 16px;
  background: linear-gradient(135deg, #203f66, #5488c7);
  color: #fff;
  text-align: center;
}

.sidebar-promo h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.sidebar-promo p {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-bottom: 12px;
  line-height: 1.4;
}

.sidebar-promo .btn-promo {
  display: inline-block;
  padding: 7px 20px;
  background: #fff;
  color: #5488c7;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  transition: opacity 0.15s;
}

.sidebar-promo .btn-promo:hover {
  opacity: 0.9;
  text-decoration: none;
}

/* --- Pagination --- */
.pagination-wrapper {
  display: flex;
  justify-content: center;
  padding: 24px 0;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination .page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #555;
  font-size: 0.86rem;
  font-weight: 600;
  transition: all 0.15s;
  padding: 0 10px;
}

.pagination .page-btn:hover {
  border-color: #5488c7;
  color: #5488c7;
  background: #f0f4f8;
}

.pagination .page-btn.active {
  background: #5488c7;
  color: #fff;
  border-color: #5488c7;
}

.pagination .page-btn.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* --- Footer --- */
.site-footer {
  background: #203f66;
  color: rgba(255, 255, 255, 0.7);
  padding: 30px 0 20px;
  font-size: 0.82rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  margin-bottom: 20px;
}

.footer-col h5 {
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.footer-col a {
  display: block;
  color: rgba(255, 255, 255, 0.6);
  padding: 3px 0;
  font-size: 0.8rem;
  transition: color 0.15s;
}

.footer-col a:hover {
  color: #fff;
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
  text-align: center;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
}

/* --- Search Overlay --- */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

.search-overlay.open {
  display: flex;
}

.search-overlay-inner {
  background: #fff;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  padding: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.search-overlay-inner input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #5488c7;
  border-radius: 6px;
  font-size: 1rem;
  outline: none;
}

.search-overlay-inner p {
  margin-top: 12px;
  font-size: 0.82rem;
  color: #888;
  text-align: center;
}

/* --- Loading indicator --- */
.loading {
  text-align: center;
  padding: 30px;
  color: #888;
  font-size: 0.9rem;
}

.loading .spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid #e0e0e0;
  border-top-color: #5488c7;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 8px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .main-content .container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .navbar-nav {
    display: none;
  }

  .navbar-search {
    max-width: 200px;
  }

  .btn-write {
    display: none;
  }

  .post-card {
    padding: 14px 16px;
  }

  .post-title a {
    font-size: 1rem;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr);
  }

  .feed-bar a {
    padding: 8px 10px;
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  .navbar-search {
    max-width: 140px;
  }

  .navbar-actions .icon-btn.hide-xs {
    display: none;
  }

  .post-card {
    gap: 10px;
  }

  .post-avatar .avatar {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
  }
}

/* --- Utility --- */
.text-muted {
  color: #888;
}
.text-primary {
  color: #5488c7;
}
.fw-bold {
  font-weight: 700;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
