/*
Theme Name: TruyenXXX - Wattpad Style
Description: Clean, minimal reading experience inspired by Wattpad
Version: 1.0
*/

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --bg2: #f6f6f6;
  --bg3: #eeeeee;
  --border: #e0e0e0;
  --text: #2a2a2a;
  --text-muted: #777;
  --text-light: #aaa;
  --primary: #FF6122;
  --primary-dark: #e05010;
  --link: #FF6122;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-reading: Georgia, 'Times New Roman', serif;
}

html { font-size: 16px; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6; }
a { color: var(--link); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

/* ===== HEADER ===== */
#header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.site-logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary) !important;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.header-search {
  flex: 1;
  max-width: 380px;
  display: flex;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  padding: 0 14px;
  align-items: center;
  gap: 8px;
}
.header-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
}
.header-search button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}
.header-search:focus-within { border-color: var(--primary); }

/* ===== NAV ===== */
#nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }
.nav-inner a {
  display: block;
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all .2s;
}
.nav-inner a:hover, .nav-inner a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===== LAYOUT ===== */
#main { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }
.layout { display: flex; gap: 32px; }
.main-content { flex: 1; min-width: 0; }
.sidebar { width: 260px; flex-shrink: 0; }

/* ===== SECTION ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.section-more {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}
.section-more:hover { text-decoration: underline; }

/* ===== STORY CARD (Wattpad style) ===== */
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px;
}
.story-card { cursor: pointer; }
.story-card-thumb {
  aspect-ratio: 2/3;
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-light);
  position: relative;
}
.story-card:hover .story-card-thumb {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.story-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.story-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
}
.story-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.story-card-meta { font-size: 0.75rem; color: var(--text-muted); }

/* ===== STORY LIST ===== */
.story-list { display: flex; flex-direction: column; }
.story-list-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.story-list-item:last-child { border-bottom: none; }
.story-list-thumb {
  width: 60px;
  height: 80px;
  border-radius: 6px;
  background: var(--bg2);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-light);
}
.story-list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.story-list-info { flex: 1; min-width: 0; }
.story-list-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.story-list-title:hover { color: var(--primary); }
.story-list-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
  margin-bottom: 6px;
}
.story-list-meta { font-size: 0.75rem; color: var(--text-light); }

/* ===== SINGLE POST ===== */
.post-wrap { max-width: 720px; }
.post-title {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 16px;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.post-content {
  font-family: var(--font-reading);
  font-size: 1.1rem;
  line-height: 2;
  color: #333;
}
.post-content p { margin-bottom: 1.4em; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 36px 0;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all .2s;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 700;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }

/* ===== TAGS ===== */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.tag {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all .2s;
}
.tag:hover { background: var(--primary); border-color: var(--primary); color: white; }

/* ===== SIDEBAR ===== */
.widget {
  margin-bottom: 28px;
}
.widget-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}
.widget-list { list-style: none; }
.widget-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.widget-list li:last-child { border-bottom: none; }
.widget-list a { color: var(--text); }
.widget-list a:hover { color: var(--primary); }
.widget-list .count { color: var(--text-muted); font-size: 0.8rem; }

/* ===== FOOTER ===== */
#footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 40px 20px 20px;
  margin-top: 60px;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
  margin-bottom: 28px;
}
.footer-col-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
  margin-bottom: 12px;
}
.footer-col ul { list-style: none; }
.footer-col li { padding: 5px 0; }
.footer-col a { font-size: 0.85rem; color: var(--text-muted); }
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .layout { flex-direction: column; }
  .story-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .post-title { font-size: 1.4rem; }
  .post-content { font-size: 1rem; }
  .header-search { max-width: none; flex: 1; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .story-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .header-inner { gap: 12px; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }
