/* =====================================================
   TGT Comic — CSS toàn bộ frontend
   ===================================================== */

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

:root {
    --bg:        #0f1117;
    --bg2:       #1a1d27;
    --bg3:       #242736;
    --accent:    #e8552d;
    --accent2:   #ff7b52;
    --text:      #e2e4ed;
    --text2:     #9196a8;
    --border:    #2e3245;
    --radius:    8px;
    --shadow:    0 2px 12px rgba(0,0,0,.4);
}

body.tgt-body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* Container */
.tgt-container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.tgt-main { padding: 24px 16px 48px; max-width: 1200px; margin: 0 auto; }

/* ---- Header ---- */
.tgt-header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow);
}
.tgt-header-inner {
    display: flex; align-items: center; gap: 20px;
    height: 56px; flex-wrap: wrap;
}
.tgt-logo {
    font-size: 1.25em; font-weight: 700; color: var(--accent);
    white-space: nowrap;
}
.tgt-nav { display: flex; gap: 16px; }
.tgt-nav a {
    color: var(--text2); font-size: .9em;
    transition: color .2s;
}
.tgt-nav a:hover { color: var(--text); }
.tgt-search { display: flex; gap: 6px; margin-left: auto; }
.tgt-search-input {
    background: var(--bg3); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius);
    padding: 6px 12px; font-size: .9em; width: 200px;
    outline: none;
}
.tgt-search-input:focus { border-color: var(--accent); }
.tgt-search-btn {
    background: var(--accent); border: none; border-radius: var(--radius);
    color: #fff; padding: 6px 12px; cursor: pointer; font-size: .9em;
}

/* ---- Page title ---- */
.tgt-page-title {
    display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px;
}
.tgt-page-title h1 { font-size: 1.4em; }
.tgt-count { color: var(--text2); font-size: .85em; }

/* ---- Filter bar ---- */
.tgt-filter-bar {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px;
}
.tgt-filter-tag {
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 20px; padding: 4px 12px; font-size: .8em;
    color: var(--text2); transition: all .2s;
}
.tgt-filter-tag:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Grid truyện ---- */
.tgt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

/* ---- Card ---- */
.tgt-card { display: flex; flex-direction: column; }
.tgt-card-thumb {
    position: relative; display: block; overflow: hidden;
    border-radius: var(--radius); aspect-ratio: 2/3;
    background: var(--bg3);
}
.tgt-card-thumb img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .3s;
}
.tgt-card-thumb:hover img { transform: scale(1.05); }
.tgt-badge {
    position: absolute; top: 6px; left: 6px;
    background: var(--accent); color: #fff;
    font-size: .7em; padding: 2px 7px; border-radius: 4px;
}
.tgt-card-info { padding: 6px 2px; }
.tgt-card-title {
    display: block; font-size: .85em; font-weight: 600;
    line-height: 1.3; margin-bottom: 3px;
    overflow: hidden; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.tgt-card-title:hover { color: var(--accent); }
.tgt-card-chap { font-size: .75em; color: var(--text2); }

/* ---- Breadcrumb ---- */
.tgt-breadcrumb {
    display: flex; align-items: center; gap: 8px;
    font-size: .85em; color: var(--text2); margin-bottom: 20px;
}
.tgt-breadcrumb a:hover { color: var(--accent); }

/* ---- Info block (single) ---- */
.tgt-info-block {
    display: flex; gap: 28px; margin-bottom: 32px; flex-wrap: wrap;
}
.tgt-info-thumb {
    flex-shrink: 0; width: 200px;
}
.tgt-info-thumb img {
    width: 100%; border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.tgt-info-meta { flex: 1; min-width: 240px; }
.tgt-info-title { font-size: 1.5em; margin-bottom: 6px; }
.tgt-info-origin { color: var(--text2); font-size: .9em; margin-bottom: 14px; }

.tgt-meta-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.tgt-meta-table th,
.tgt-meta-table td { padding: 7px 0; vertical-align: top; font-size: .9em; }
.tgt-meta-table th {
    color: var(--text2); width: 100px; font-weight: 500;
}
.tgt-meta-table a { color: var(--accent2); }
.tgt-meta-table a:hover { text-decoration: underline; }

.tgt-genre-tag {
    display: inline-block; background: var(--bg3);
    border: 1px solid var(--border); border-radius: 4px;
    padding: 2px 8px; font-size: .8em; margin: 2px;
    color: var(--text2);
}
.tgt-genre-tag:hover { border-color: var(--accent); color: var(--accent); }

.tgt-read-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- Buttons ---- */
.tgt-btn {
    display: inline-block; padding: 10px 22px; border-radius: var(--radius);
    font-weight: 600; font-size: .9em; transition: opacity .2s;
}
.tgt-btn:hover { opacity: .85; }
.tgt-btn-primary { background: var(--accent); color: #fff; }
.tgt-btn-secondary {
    background: var(--bg3); color: var(--text);
    border: 1px solid var(--border);
}

/* ---- Section ---- */
.tgt-section { margin-bottom: 36px; }
.tgt-section-title {
    font-size: 1.1em; margin-bottom: 14px; padding-bottom: 8px;
    border-bottom: 2px solid var(--accent); display: inline-block;
}

/* ---- Mô tả ---- */
.tgt-desc {
    color: var(--text2); line-height: 1.8; font-size: .95em;
    background: var(--bg2); border-radius: var(--radius);
    padding: 16px; border: 1px solid var(--border);
}

/* ---- Chapter list ---- */
.tgt-chapter-list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px; max-height: 420px; overflow-y: auto;
    background: var(--bg2); border-radius: var(--radius);
    padding: 10px; border: 1px solid var(--border);
}
.tgt-chapter-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 10px; border-radius: 6px;
    background: var(--bg3); font-size: .85em;
    transition: background .2s;
}
.tgt-chapter-item:hover { background: var(--border); color: var(--accent); }
.tgt-chap-title { color: var(--text2); font-size: .8em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---- FAQ ---- */
.tgt-faq { display: flex; flex-direction: column; gap: 8px; }
.tgt-faq-item {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.tgt-faq-q {
    width: 100%; text-align: left; background: none; border: none;
    color: var(--text); padding: 12px 16px; font-size: .95em;
    cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    font-weight: 600;
}
.tgt-faq-q:hover { color: var(--accent); }
.tgt-faq-a {
    display: none; padding: 0 16px 14px; color: var(--text2); font-size: .9em;
}
.tgt-faq-a.open { display: block; }
.tgt-faq-icon { font-size: 1.2em; color: var(--accent); }

/* ---- Reviews ---- */
.tgt-reviews { display: flex; flex-direction: column; gap: 12px; }
.tgt-review-item {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px;
}
.tgt-review-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.tgt-review-name { font-weight: 600; font-size: .9em; }
.tgt-review-stars { color: #f5c518; font-size: 1em; }
.tgt-review-content { color: var(--text2); font-size: .9em; line-height: 1.7; }

/* ---- Pagination ---- */
.tgt-pagination { margin-top: 32px; display: flex; justify-content: center; }
.tgt-pagination .page-numbers {
    display: flex; gap: 6px; list-style: none; flex-wrap: wrap;
}
.tgt-pagination .page-numbers a,
.tgt-pagination .page-numbers span {
    display: inline-block; padding: 7px 13px; border-radius: var(--radius);
    background: var(--bg2); border: 1px solid var(--border); font-size: .9em;
}
.tgt-pagination .page-numbers a:hover { border-color: var(--accent); color: var(--accent); }
.tgt-pagination .page-numbers .current {
    background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ---- Footer ---- */
.tgt-footer {
    background: var(--bg2); border-top: 1px solid var(--border);
    padding: 20px 0; text-align: center; color: var(--text2); font-size: .85em;
    margin-top: 40px;
}

/* ---- Reader ---- */
.tgt-reader-body { background: #111; }
.tgt-reader-nav {
    background: rgba(15,17,23,.95); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100; padding: 0 12px;
}
.tgt-reader-nav-bottom {
    position: static; border-top: 1px solid var(--border);
    border-bottom: none; margin-top: 0;
}
.tgt-reader-nav-inner {
    max-width: 900px; margin: 0 auto; height: 52px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.tgt-reader-back { color: var(--text2); font-size: .85em; white-space: nowrap; }
.tgt-reader-back:hover { color: var(--accent); }
.tgt-reader-controls { display: flex; align-items: center; gap: 8px; }
.tgt-reader-btn {
    padding: 6px 14px; background: var(--bg3); border: 1px solid var(--border);
    border-radius: var(--radius); font-size: .85em; color: var(--text);
    transition: background .2s;
}
.tgt-reader-btn:hover:not(.disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.tgt-reader-btn.disabled { opacity: .35; cursor: default; }
.tgt-chap-select {
    background: var(--bg3); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius);
    padding: 6px 10px; font-size: .82em; max-width: 220px;
}
.tgt-reader-pages {
    max-width: 900px; margin: 0 auto; padding: 12px 0;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tgt-reader-page { width: 100%; max-width: 900px; }
.tgt-reader-error {
    text-align: center; padding: 80px 20px; color: var(--text2);
}

/* ---- Truyện tương tự ---- */
.tgt-similar-grid {
    grid-template-columns: repeat(6, 1fr) !important;
}
@media (max-width: 700px) {
    .tgt-similar-grid { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ---- Block Sắp ra mắt ---- */
.tgt-coming-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}
.tgt-coming-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.tgt-view-all {
    font-size: .85em;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 4px 12px;
    border-radius: 20px;
    transition: all .2s;
}
.tgt-view-all:hover {
    background: var(--accent);
    color: #fff;
}

/* ---- Empty / misc ---- */
.tgt-empty { color: var(--text2); padding: 40px 0; text-align: center; }

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 600px) {
    .tgt-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .tgt-info-thumb { width: 140px; }
    .tgt-info-title { font-size: 1.2em; }
    .tgt-search-input { width: 130px; }
    .tgt-chapter-list { grid-template-columns: 1fr 1fr; }
    .tgt-reader-back { display: none; }
    .tgt-chap-select { max-width: 160px; }
}

@media (max-width: 400px) {
    .tgt-grid { grid-template-columns: repeat(2, 1fr); }
}
