/*
Theme Name: Trường Đời
Theme URI: https://github.com/truongdoi
Author: Antigravity
Author URI: https://gemini.google.com
Description: WordPress Classic Theme for Trường Đời. Highly responsive, minimalist design with rich aesthetics.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: truongdoi
*/

/* ==========================================================================
   1. THIẾT LẬP CƠ BẢN (THE BOOK VIBE)
   ========================================================================== */
:root {
    --bg-book: #FCFCFA; 
    --text-ink: #1C1C1E; 
    --text-muted: #6E6E73;
    --border-light: #E5E5EA;
    --bg-shade: #F3F4F6;
    
    --font-book: 'Lora', serif;
    --font-ui: 'Inter', sans-serif;
    
    --max-width: 720px; 
    --transition: 0.3s ease;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-book);
    color: var(--text-ink);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* Page context specific typography and constraints */
body.home {
    font-family: var(--font-ui);
    --max-width: 720px;
}

body.single-post, body.archive, body.search, body.error404 {
    font-family: var(--font-book);
    line-height: 1.8;
    font-size: 1.125rem;
    --max-width: 680px;
}

a { 
    color: inherit; 
    text-decoration: none; 
}

ul { 
    list-style: none; 
}

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

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.divider {
    height: 1px;
    background-color: var(--border-light);
    margin: 40px 0;
    width: 100px;
}

/* ==========================================================================
   2. HEADER & BREADCRUMB
   ========================================================================== */
.site-header {
    text-align: center;
}

body.home .site-header {
    padding: 40px 0 20px;
}

body.single-post .site-header, 
body.archive .site-header, 
body.search .site-header, 
body.error404 .site-header {
    padding: 32px 0;
    font-family: var(--font-ui);
    border-bottom: 1px solid transparent;
}

.logo {
    font-family: var(--font-book);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: block;
}

body.home .logo {
    font-size: 1.6rem; 
    margin-bottom: 8px;
}

body.single-post .logo, 
body.archive .logo, 
body.search .logo, 
body.error404 .logo {
    font-size: 1.4rem; 
    margin-bottom: 12px;
}

/* Custom Uploaded Logo Image Styling */
.custom-logo-link {
    display: inline-block;
    transition: opacity 0.2s ease;
}

.custom-logo-link:hover {
    opacity: 0.8;
}

.custom-logo {
    max-height: 98px; /* Tối ưu nhất cho mắt và tỷ lệ khung hình */
    width: auto;
    display: block;
    margin: 0 auto;
}

body.home .custom-logo-link {
    margin-bottom: 8px;
}

body.single-post .custom-logo-link,
body.archive .custom-logo-link,
body.search .custom-logo-link,
body.error404 .custom-logo-link {
    margin-bottom: 12px;
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

body.home .breadcrumb {
    font-family: var(--font-ui);
}

body.single-post .breadcrumb, 
body.archive .breadcrumb, 
body.search .breadcrumb, 
body.error404 .breadcrumb {
    font-family: var(--font-ui);
}

.breadcrumb-icon {
    fill: currentColor;
    width: 14px;
    height: 14px;
}

.breadcrumb a {
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--text-ink);
}

/* ==========================================================================
   3. HOMEPAGE LỜI MỞ ĐẦU (HERO)
   ========================================================================== */
.hero {
    padding: 20px 0 40px;
    text-align: center;
}

.hero h1 {
    font-family: var(--font-book);
    font-size: 2.2rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-ink);
    margin-bottom: 24px;
}

.hero .quote {
    font-family: var(--font-ui);
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.8;
}

/* ==========================================================================
   4. THANH SEARCH KHỔNG LỒ (SEARCH UTILITY)
   ========================================================================== */
.search-section {
    padding: 20px 0 60px;
}

.search-box {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
}

.search-box input {
    width: 100%;
    padding: 20px 24px 20px 56px;
    font-family: var(--font-ui);
    font-size: 1.1rem;
    color: var(--text-ink);
    background-color: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    outline: none;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.search-box input::placeholder {
    color: #A1A1AA;
}

.search-box input:focus {
    border-color: var(--text-ink);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

/* ==========================================================================
   5. MÔN HỌC BẤT ỔN (LĨNH VỰC CUỘC SỐNG)
   ========================================================================== */
.domains-section {
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--border-light);
}

.section-question {
    font-family: var(--font-book);
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 32px;
    color: var(--text-ink);
}

.domains-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.domain-item {
    font-size: 1rem;
    color: var(--text-muted);
    padding: 10px 22px;
    border: 1px solid var(--border-light);
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
    font-family: var(--font-ui);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.domain-item:hover {
    color: var(--text-ink);
    border-color: var(--text-ink);
    background-color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   6. DYNAMIC STAGE ("AI NHẸ" - MINI CARDS)
   ========================================================================== */
.life-stage-section {
    padding: 40px 0 80px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
}

.stage-selector {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.stage-btn {
    font-size: 1rem;
    color: var(--text-muted);
    padding: 10px 24px;
    border-radius: 40px;
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.stage-btn:hover {
    color: var(--text-ink);
    border-color: var(--text-ink);
}

.stage-btn.active {
    background-color: var(--text-ink);
    color: var(--bg-book);
    border-color: var(--text-ink);
}

/* Vùng hiển thị Mini Cards */
.stage-suggestions {
    min-height: 120px;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.stage-suggestions.visible {
    opacity: 1;
    transform: translateY(0);
}

.view-all-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 28px;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-ink);
    border: 1px solid var(--border-light);
    border-radius: 40px;
    background-color: transparent;
    transition: all 0.2s ease;
    text-align: center;
}

.view-all-btn:hover {
    background-color: var(--text-ink);
    color: var(--bg-book);
    border-color: var(--text-ink);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Cấu trúc Mini Card */
.mini-card {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 500px;
    padding: 16px 20px;
    background-color: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    color: inherit;
    text-decoration: none;
}

.mini-card:hover {
    border-color: var(--text-ink);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.mc-icon {
    font-size: 1.4rem;
    margin-right: 16px;
}

.mc-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mc-title {
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-ink);
}

.mc-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.mc-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.mini-card:hover .mc-arrow {
    color: var(--text-ink);
}

/* ==========================================================================
   7. TIẾT HỌC HÔM NAY (DAILY STOIC & SOCIAL PROOF)
   ========================================================================== */
.lessons-section {
    padding: 80px 0 40px;
}

.lessons-section-title {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 24px;
    text-align: center;
}

.social-proof {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 48px;
}

.social-proof svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.lesson-item {
    margin-bottom: 60px;
}

.lesson-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
    font-family: var(--font-ui);
}

.lesson-title {
    font-family: var(--font-book);
    font-size: 1.8rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 16px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.lesson-title a {
    color: inherit;
    text-decoration: none;
}

.lesson-title:hover {
    opacity: 0.6;
}

.lesson-excerpt {
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 24px;
}

/* Khối "Bài học rút ra" */
.lesson-takeaways {
    background-color: #ffffff;
    border: 1px solid var(--border-light);
    padding: 24px 32px;
    border-radius: 4px;
}

.takeaway-title {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-ink);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.takeaway-divider {
    height: 1px;
    background-color: var(--border-light);
    margin-bottom: 16px;
    width: 40px;
}

.lesson-takeaways ul {
    list-style-type: none;
}

.lesson-takeaways ul li {
    position: relative;
    padding-left: 16px;
    font-size: 0.95rem;
    color: var(--text-ink);
    margin-bottom: 8px;
    line-height: 1.6;
    font-family: var(--font-ui);
}

.lesson-takeaways ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

/* ==========================================================================
   8. ARTICLE HEADER (MỞ BÀI)
   ========================================================================== */
.article-header {
    padding: 60px 0 40px;
}

.article-meta {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.journey-tag {
    background-color: var(--text-ink);
    color: var(--bg-book);
    padding: 4px 12px;
    border-radius: 40px;
    font-weight: 500;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

a.journey-tag:hover {
    background-color: var(--text-muted);
    color: #ffffff;
    transform: translateY(-1px);
}

.article-title {
    font-size: 2.4rem;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
    color: var(--text-ink);
}

.article-excerpt {
    font-size: 1.25rem;
    color: var(--text-muted);
    line-height: 1.6;
    font-style: italic;
}

/* ==========================================================================
   9. ARTICLE BODY (TRẢI NGHIỆM ĐỌC)
   ========================================================================== */
.article-content {
    padding-bottom: 60px;
}

.article-content p {
    margin-bottom: 28px;
}

.article-content h2 {
    font-family: var(--font-ui);
    font-size: 1.4rem;
    font-weight: 600;
    margin: 48px 0 20px;
    color: var(--text-ink);
}

/* Câu đáng nhớ (Highlight/Blockquote) */
.article-content blockquote {
    font-family: var(--font-book);
    font-size: 1.5rem;
    font-style: italic;
    color: var(--text-ink);
    text-align: center;
    margin: 56px auto;
    padding: 32px 40px 0 40px;
    position: relative;
    max-width: 580px;
    line-height: 1.7;
    border-left: none; /* Override default blockquote border */
}

.article-content blockquote::before {
    content: "“";
    font-size: 5rem;
    color: var(--border-light);
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-book), Georgia, serif;
    line-height: 1;
    height: 30px;
    overflow: hidden;
}

/* ==========================================================================
   10. CUSTOM BLOCKS (GIÁO CỤ TRỰC QUAN)
   ========================================================================== */
.custom-block,
.wp-block-group.custom-block {
    font-family: var(--font-ui);
    padding: 32px;
    border-radius: 12px;
    margin: 40px 0;
    background-color: var(--bg-shade);
    border-left: 5px solid var(--text-ink);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.01);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-left-width 0.25s ease;
}

.custom-block:hover,
.wp-block-group.custom-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}

.block-title {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-ink);
}

.block-title svg {
    flex-shrink: 0;
}

/* Block: Sai lầm thường gặp */
.block-mistakes {
    border-left-color: #DC2626; /* Đỏ trầm, cảnh báo */
    background-color: #FEF2F2; /* Soft red background */
}

.block-mistakes ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.block-mistakes ul li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 12px;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-ink);
}

.block-mistakes ul li:last-child {
    margin-bottom: 0;
}

.block-mistakes ul li::before {
    content: "✕";
    position: absolute;
    left: 0;
    color: #DC2626; /* Đỏ trầm, cảnh báo */
    font-weight: bold;
}

/* Block: Việc nên làm ngay */
.block-action {
    border-left-color: #059669; /* Xanh lá trầm, hành động */
    background-color: #ECFDF5; /* Soft green background */
}

.block-action ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.block-action ul li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 12px;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-ink);
}

.block-action ul li:last-child {
    margin-bottom: 0;
}

.block-action ul li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #059669;
    font-weight: bold;
}

/* ==========================================================================
   11. TẤM BẰNG TỐT NGHIỆP (INTERACTIVE GRADUATION)
   ========================================================================== */
.graduation-section {
    margin: 60px 0;
    padding: 40px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
    font-family: var(--font-ui);
}

.grad-header {
    text-align: center;
    margin-bottom: 32px;
}

.grad-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

.grad-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-ink);
    margin-bottom: 8px;
}

.grad-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.checklist-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 12px 16px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.check-item:hover {
    background-color: var(--bg-shade);
}

.check-item input {
    display: none; /* Ẩn checkbox mặc định */
}

/* Custom Checkbox UI */
.custom-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-light);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    margin-top: 2px;
}

.custom-checkbox svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: white;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.check-text {
    font-size: 1rem;
    color: var(--text-ink);
    transition: color 0.2s;
}

/* Trạng thái Checked */
.check-item input:checked + .custom-checkbox {
    background-color: var(--text-ink);
    border-color: var(--text-ink);
}

.check-item input:checked + .custom-checkbox svg {
    opacity: 1;
    transform: scale(1);
}

.check-item input:checked ~ .check-text {
    color: var(--text-muted);
    text-decoration: line-through;
    text-decoration-color: var(--border-light);
}

/* Thông điệp hoàn thành */
.completion-message {
    margin-top: 24px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    color: #059669;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
    height: 0;
    overflow: hidden;
}

.completion-message.show {
    opacity: 1;
    transform: translateY(0);
    height: auto;
    margin-top: 24px;
}

/* ==========================================================================
   12. ĐIỀU HƯỚNG HÀNH TRÌNH (TRẠM TIẾP THEO)
   ========================================================================== */
.next-journey {
    margin-top: 80px;
    padding-top: 60px;
    border-top: 1px solid var(--border-light);
    font-family: var(--font-ui);
}

.next-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 24px;
    display: block;
}

.next-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px;
    background-color: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    transition: all 0.2s;
}

.next-card:hover {
    border-color: var(--text-ink);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.next-card-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

.next-card-title {
    font-family: var(--font-book);
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-ink);
}

/* ==========================================================================
   13. FOOTER
   ========================================================================== */
.site-footer {
    text-align: center;
}

body.home .site-footer {
    padding: 60px 0 80px;
}

body.single-post .site-footer, 
body.archive .site-footer, 
body.search .site-footer, 
body.error404 .site-footer {
    padding: 80px 0;
    font-family: var(--font-ui);
}

.footer-quote {
    font-family: var(--font-book);
    font-style: italic;
    color: var(--text-ink);
    line-height: 1.8;
}

body.home .footer-quote {
    font-size: 1.3rem;
    margin-bottom: 40px;
}

body.home .footer-quote span {
    display: block;
    margin-bottom: 16px;
    color: var(--text-muted);
}

body.single-post .footer-quote, 
body.archive .footer-quote, 
body.search .footer-quote, 
body.error404 .footer-quote {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

body.single-post .footer-quote span, 
body.archive .footer-quote span, 
body.search .footer-quote span, 
body.error404 .footer-quote span {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.footer-copyright {
    font-size: 0.85rem;
    color: var(--text-muted);
}

body.home .footer-copyright {
    font-family: var(--font-ui);
}

/* Spinner Animation for Infinite Scroll */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Post Tags List Style (Below Graduation Checklist) */
.article-tags {
    margin: 40px auto 20px;
    padding-top: 30px;
    border-top: 1px solid var(--border-light);
    font-family: var(--font-ui);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    max-width: 700px;
}

.tags-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-link {
    font-size: 0.85rem;
    color: var(--text-muted);
    background-color: var(--bg-shade);
    padding: 6px 14px;
    border-radius: 40px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.tag-link:hover {
    color: var(--text-ink);
    background-color: var(--border-light);
    transform: translateY(-1px);
}
