/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #1f2430; background: #f6f7fb; line-height: 1.6; }
img { max-width: 100%; display: block; }
a { color: #2b5fd9; text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 40px; }

/* ===== Header ===== */
.site-header { background: #fff; border-bottom: 1px solid #e6e8ee; position: sticky; top: 0; z-index: 50; padding: 0 10px; }
.header-inner { display: flex; align-items: center; gap: 24px; padding: 14px 0; flex-wrap: wrap; }
.logo { font-size: 22px; font-weight: 800; color: #1f2430; }
.main-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.main-nav a { color: #444; font-weight: 500; }
.search-form { margin-left: auto; display: flex; }
.search-form input { border: 1px solid #dcdfe6; border-radius: 6px 0 0 6px; padding: 8px 12px; width: 220px; font-size: 14px; }
.search-form button { border: 1px solid #dcdfe6; border-left: none; background: #f0f2f7; border-radius: 0 6px 6px 0; padding: 0 14px; cursor: pointer; }

.breadcrumb-bar { background: #eef1f8; padding: 10px 0; font-size: 13px; }
.breadcrumb { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; }
.breadcrumb li:not(:last-child)::after { content: '›'; margin-left: 6px; color: #999; }

/* ===== Hero ===== */
.hero { text-align: center; padding: 48px 0 28px; }
.hero h1 { font-size: 30px; margin-bottom: 10px; }
.hero p { color: #5b6270; max-width: 640px; margin: 0 auto; }

.category-strip { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding-bottom: 30px; }
.category-pill { background: #fff; border: 1px solid #dcdfe6; border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 600; }
.category-pill:hover { background: #2b5fd9; color: #fff; text-decoration: none; }

/* ===== Sections & grid ===== */
.main-content { padding: 24px 10px 60px; min-height: 60vh; }
.section-title { font-size: 20px; margin: 34px 0 16px; display: flex; align-items: center; justify-content: space-between; }
.see-more { font-size: 13px; font-weight: 500; }
.page-title { font-size: 26px; margin: 20px 0 8px; }
.page-intro { color: #5b6270; margin-bottom: 20px; }

/* ===== Bo loc Lop / Chuyen de tren trang danh muc ===== */
.filter-bar { margin: 4px 0 24px; display: flex; flex-direction: column; gap: 10px; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-label { font-size: 13px; font-weight: 700; color: #5b6270; margin-right: 2px; }
.filter-pill { display: inline-block; background: #fff; border: 1px solid #dcdfe6; border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 600; color: #444; }
.filter-pill:hover { background: #eef1f8; text-decoration: none; }
.filter-pill.active { background: #2b5fd9; color: #fff; border-color: #2b5fd9; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.doc-card { background: #fff; border: 1px solid #e6e8ee; border-radius: 10px; overflow: hidden; transition: box-shadow .15s; }
.doc-card:hover { box-shadow: 0 6px 20px rgba(20,30,60,.08); }
.doc-card-thumb { position: relative; height: 230px; background: #fff; overflow: hidden; }
.doc-card-thumb img { display: block; width: 100%; height: auto; }
.badge { position: absolute; top: 8px; left: 8px; background: #21b573; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 4px; }
.doc-card-body { padding: 12px 14px 16px; }
.doc-card-cat { font-size: 11px; color: #2b5fd9; font-weight: 700; text-transform: uppercase; }
.doc-card-title { font-size: 15px; margin: 6px 0; line-height: 1.4; }
.doc-card-title a { color: #1f2430; }
.doc-card-summary { font-size: 13px; color: #6b7280; margin: 0 0 10px; }
.doc-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.doc-card-meta .price { font-weight: 700; color: #d9455f; }
.doc-card-meta .price small { font-weight: 400; color: #9aa1ac; }
.pdf-tag { color: #21b573; font-size: 11px; font-weight: 600; }
.doc-card-body .buy-word-btn, .doc-card-body .btn-sm.btn-block { margin: 10px 0 0; }

.doc-card-more {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 296px; background: #f6f7fb; border: 2px dashed #c7cce0; border-radius: 10px;
  color: #2b5fd9; text-decoration: none; text-align: center; transition: background .15s, border-color .15s;
}
.doc-card-more:hover { background: #eef1f8; border-color: #2b5fd9; text-decoration: none; }
.doc-card-more-icon { font-size: 28px; font-weight: 700; line-height: 1; }
.doc-card-more-text { font-size: 15px; font-weight: 700; }

/* ===== Document detail ===== */
.doc-detail { display: grid; grid-template-columns: 1fr 320px; gap: 32px; margin-top: 10px; }
.doc-detail h1 { font-size: 26px; margin-bottom: 8px; }
.doc-detail-summary { color: #5b6270; font-size: 15px; }
.doc-detail-content { margin-top: 20px; font-size: 15px; }
.doc-detail-thumb { border-radius: 10px; border: 1px solid #e6e8ee; margin-bottom: 16px; }
.buy-box { background: #fff; border: 1px solid #e6e8ee; border-radius: 10px; padding: 18px; }
.buy-row { display: flex; justify-content: space-between; font-size: 14px; margin: 10px 0 6px; }
.buy-note { font-size: 12px; color: #8a919c; margin-top: 10px; }
.doc-detail-stats { margin-top: 14px; font-size: 13px; color: #6b7280; display: flex; gap: 16px; }

.doc-preview { margin: 18px 0; }
.doc-preview-title { font-size: 16px; margin: 0 0 10px; }
.doc-preview-frame { position: relative; width: 100%; height: 70vh; min-height: 420px; max-height: 800px; border: 1px solid #e6e8ee; border-radius: 10px; overflow: hidden; background: #f3f4f7; }
.doc-preview-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

.admin-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff8e1; border: 1px solid #ffe082; border-radius: 8px; padding: 10px 14px; margin: 16px 0; }
.status-pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.status-pill.status-draft { background: #fdecec; color: #b3261e; }
.status-pill.status-live { background: #e5f8ee; color: #21b573; }
button.status-pill { border: none; font-family: inherit; cursor: pointer; }
button.status-pill:disabled { opacity: .6; cursor: default; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

@media (max-width: 860px) {
  .doc-detail { grid-template-columns: 1fr; }
}

/* ===== QR payment modal (mua & thanh toan ngay tren trang, khong chuyen trang) ===== */
.qr-modal-overlay { position: fixed; inset: 0; background: rgba(20,25,40,.55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 200; }
.qr-modal-overlay[hidden] { display: none; }
.qr-modal { background: #fff; border-radius: 12px; padding: 28px 24px; max-width: 380px; width: 100%; text-align: center; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.qr-modal h3 { margin: 0 0 10px; font-size: 18px; }
.qr-modal-close { position: absolute; top: 10px; right: 12px; background: none; border: none; font-size: 18px; cursor: pointer; color: #8a919c; padding: 4px 8px; }
.qr-modal-close:hover { color: #1f2430; }
.qr-code-box { display: flex; justify-content: center; margin: 16px 0; min-height: 220px; align-items: center; }
.qr-code-box img { image-rendering: pixelated; }

/* ===== Buttons ===== */
.btn { display: inline-block; padding: 10px 18px; border-radius: 6px; font-weight: 600; cursor: pointer; border: none; font-size: 14px; font-family: inherit; text-decoration: none; }
.btn-block { display: block; width: 100%; text-align: center; margin: 8px 0; }
.btn-primary { background: #2b5fd9; color: #fff; }
.btn-primary:hover { background: #234ec0; text-decoration: none; }
.btn-outline { background: #fff; border: 1px solid #2b5fd9; color: #2b5fd9; }
.btn-outline:hover { background: #eef1f8; text-decoration: none; }

/* ===== Forms ===== */
.checkout-wrap { max-width: 520px; margin: 0 auto; }
.checkout-summary { display: flex; gap: 14px; align-items: center; background: #fff; border: 1px solid #e6e8ee; border-radius: 10px; padding: 16px; margin-bottom: 20px; }
.checkout-summary img { border-radius: 6px; }
.checkout-summary .price { color: #d9455f; font-weight: 700; font-size: 18px; }
.checkout-form label, .admin-form label { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.checkout-form input, .admin-form input, .admin-form select, .admin-form textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #dcdfe6; border-radius: 6px; font-size: 14px; margin-top: 4px; font-family: inherit;
}

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fdecec; color: #b3261e; border: 1px solid #f6c6c3; }
.alert-info { background: #e8f0ff; color: #234ec0; border: 1px solid #c6d7f6; }
.alert ul { margin: 0; padding-left: 18px; }

/* ===== Result page ===== */
.result-box { max-width: 520px; margin: 40px auto; text-align: center; background: #fff; border: 1px solid #e6e8ee; border-radius: 10px; padding: 32px 24px; }
.result-success { color: #21b573; }
.result-fail { color: #d9455f; }
.result-pending { color: #d99a00; }
.result-box .btn { margin: 6px; }

/* ===== Pagination ===== */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 30px 0; }
.pagination a { border: 1px solid #dcdfe6; border-radius: 6px; padding: 6px 12px; font-size: 14px; color: #444; }
.pagination a.active { background: #2b5fd9; color: #fff; border-color: #2b5fd9; }

.empty-state { text-align: center; padding: 60px 0; }

/* ===== Footer ===== */
.site-footer { background: #1f2430; color: #c9cddb; margin-top: 40px; padding: 0 10px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; padding: 40px 0; }
.footer-col h3, .footer-col h4 { color: #fff; margin-top: 0; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col ul li { margin-bottom: 6px; }
.footer-col a { color: #c9cddb; }
.footer-bottom { text-align: center; padding: 16px 0; border-top: 1px solid #333a4d; font-size: 13px; }

@media (max-width: 700px) {
  .footer-inner { grid-template-columns: 1fr; }
  .header-inner { gap: 10px; }
  .search-form { width: 100%; margin-left: 0; order: 3; }
  .search-form input { flex: 1; }
}
