/* ===================================
   Typecho-lifetR-Theme Styles
   一款简约文字typecho博客主题
   Bootstrap 4 Based
   =================================== */

/* --- CSS Variables --- */
:root {
    --lifet-bg: #f5f5f5;
    --lifet-card-bg: #ffffff;
    --lifet-text: #333333;
    --lifet-text-secondary: #999999;
    --lifet-text-muted: #bbbbbb;
    --lifet-border: #e8e8e8;
    --lifet-link: #555555;
    --lifet-link-hover: #333333;
    --lifet-logo-bg: #555555;
    --lifet-logo-color: #ffffff;
    --lifet-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
    --lifet-bg: #1a1a1a;
    --lifet-card-bg: #242424;
    --lifet-text: #e0e0e0;
    --lifet-text-secondary: #888888;
    --lifet-text-muted: #666666;
    --lifet-border: #333333;
    --lifet-link: #aaaaaa;
    --lifet-link-hover: #e0e0e0;
    --lifet-logo-bg: #e0e0e0;
    --lifet-logo-color: #1a1a1a;
}

/* --- Base --- */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--lifet-font);
    background-color: var(--lifet-bg);
    color: var(--lifet-text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--lifet-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--lifet-link-hover);
    text-decoration: none;
}

/* --- Layout --- */
.lifet-wrapper {
    min-height: 100vh;
    padding: 2rem 0;
}

.lifet-card {
    background: var(--lifet-card-bg);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    min-height: 70vh;
}

/* --- Header --- */
.lifet-header {
    margin-bottom: 1.5rem;
}

.lifet-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.lifet-logo {
    display: flex;
    align-items: center;
}

.lifet-logo-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.lifet-logo-link:hover {
    text-decoration: none;
}

.lifet-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--lifet-logo-bg);
    color: var(--lifet-logo-color);
}

.lifet-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--lifet-text);
    letter-spacing: 0.02em;
}

.lifet-logo-img {
    max-height: 40px;
    width: auto;
}

/* --- Search --- */
.lifet-search-form {
    display: flex;
    align-items: center;
    border: 1px solid var(--lifet-border);
    border-radius: 3px;
    overflow: hidden;
    background: var(--lifet-card-bg);
}

.lifet-search-input {
    width: 110px;
    height: 32px;
    padding: 0 10px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--lifet-text);
    font-size: 13px;
}

.lifet-search-input::placeholder {
    color: var(--lifet-text-muted);
}

.lifet-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-left: 1px solid var(--lifet-border);
    background: transparent;
    color: var(--lifet-text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
}

.lifet-search-btn:hover {
    color: var(--lifet-text);
}

/* --- Navigation --- */
.lifet-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--lifet-border);
}

.lifet-nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.lifet-nav-item {
    font-size: 14px;
    color: var(--lifet-text-secondary);
    transition: color 0.2s ease;
}

.lifet-nav-item:hover,
.lifet-nav-item.active {
    color: var(--lifet-text);
}

.lifet-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lifet-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    color: var(--lifet-text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
}

.lifet-btn-icon:hover {
    color: var(--lifet-text);
}

/* --- Post List --- */
.lifet-post-item {
    padding: 2rem 0;
    border-bottom: 1px solid var(--lifet-border);
}

.lifet-post-item:first-child {
    padding-top: 1rem;
}

.lifet-post-item:last-child {
    border-bottom: none;
}

.lifet-post-title {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.lifet-post-title a {
    color: var(--lifet-text);
}

.lifet-post-title a:hover {
    opacity: 0.7;
}

/* Thumbnail layout */
.lifet-post-item.has-thumb {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

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

.lifet-post-thumb {
    flex-shrink: 0;
    width: 150px;
    height: 100px;
    overflow: hidden;
    border-radius: 4px;
    margin-top: 0.25rem;
}

.lifet-post-thumb a {
    display: block;
    width: 100%;
    height: 100%;
}

.lifet-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.lifet-post-thumb img:hover {
    transform: scale(1.05);
}

.lifet-post-excerpt {
    font-size: 14px;
    color: var(--lifet-text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.lifet-post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.lifet-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 12px;
    color: var(--lifet-text-muted);
}

.lifet-meta-item svg {
    color: var(--lifet-text-muted);
}

.lifet-meta-item a {
    color: var(--lifet-text-muted);
}

.lifet-meta-item a:hover {
    color: var(--lifet-text-secondary);
}

/* --- Single Post --- */
.lifet-post-single-title {
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    color: var(--lifet-text);
}

.lifet-post-meta-single {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--lifet-border);
    margin-bottom: 1.5rem;
}

.lifet-post-content {
    font-size: 15px;
    line-height: 1.8;
    color: var(--lifet-text);
    word-break: break-word;
}

.lifet-post-content p {
    margin-bottom: 1rem;
}

.lifet-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.lifet-post-content h1,
.lifet-post-content h2,
.lifet-post-content h3,
.lifet-post-content h4,
.lifet-post-content h5,
.lifet-post-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--lifet-text);
}

.lifet-post-content blockquote {
    border-left: 3px solid var(--lifet-border);
    padding-left: 1rem;
    color: var(--lifet-text-secondary);
    margin: 1rem 0;
}

.lifet-post-content pre {
    background: var(--lifet-bg);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 13px;
}

.lifet-post-content code {
    background: var(--lifet-bg);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

.lifet-post-content pre code {
    background: transparent;
    padding: 0;
}

.lifet-post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.lifet-post-content table th,
.lifet-post-content table td {
    border: 1px solid var(--lifet-border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.lifet-post-content table th {
    background: var(--lifet-bg);
    font-weight: 600;
}

.lifet-post-content a {
    color: var(--lifet-text);
    border-bottom: 1px dashed var(--lifet-text-muted);
}

.lifet-post-content a:hover {
    border-bottom-style: solid;
}

/* --- Post Tags --- */
.lifet-post-tags {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--lifet-border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.lifet-post-tags a {
    font-size: 12px;
    color: var(--lifet-text-muted);
}

.lifet-post-tags a:hover {
    color: var(--lifet-text);
}

/* --- Pagination --- */
.lifet-pagination {
    padding: 2rem 0 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.lifet-pagination .page-navigator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.lifet-pagination .page-navigator li {
    display: inline-flex;
}

.lifet-pagination .page-navigator li a,
.lifet-pagination .page-navigator li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 13px;
    color: var(--lifet-text-secondary);
    background: var(--lifet-bg);
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1;
}

.lifet-pagination .page-navigator li a:hover {
    color: var(--lifet-card-bg);
    background: var(--lifet-text-secondary);
}

.lifet-pagination .page-navigator li.current a,
.lifet-pagination .page-navigator li.current span {
    color: var(--lifet-card-bg);
    background: var(--lifet-text-secondary);
    font-weight: 500;
}

/* prev / next text links fallback */
.lifet-pagination > a,
.lifet-pagination > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 13px;
    color: var(--lifet-text-secondary);
    background: var(--lifet-bg);
    text-decoration: none;
    transition: all 0.2s ease;
}

.lifet-pagination > a:hover {
    color: var(--lifet-card-bg);
    background: var(--lifet-text-secondary);
}

/* --- Page Title --- */
.lifet-page-title {
    font-size: 1.35rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    color: var(--lifet-text);
    padding-top: 0.75rem;
}

/* --- Archive Page --- */
.lifet-archive-year {
    margin-bottom: 1.5rem;
}

.lifet-archive-year-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--lifet-text);
}

.lifet-archive-list {
    padding-left: 1rem;
}

.lifet-archive-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.25rem 0;
    font-size: 14px;
}

.lifet-archive-date {
    color: var(--lifet-text-secondary);
    white-space: nowrap;
}

.lifet-archive-link {
    color: var(--lifet-text);
}

.lifet-archive-link:hover {
    opacity: 0.7;
}

/* --- Tags Page --- */
.lifet-tags-list {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem 0.5rem;
}

.lifet-tag-item {
    font-size: 14px;
    color: var(--lifet-text);
    text-align: left;
}

.lifet-tag-item:hover {
    opacity: 0.6;
    color: var(--lifet-text);
}

@media (max-width: 576px) {
    .lifet-tags-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- Links Page --- */
.lifet-link-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    background: var(--lifet-bg);
    transition: background 0.2s ease;
    text-decoration: none;
}

.lifet-link-card:hover {
    background: var(--lifet-border);
    text-decoration: none;
}

.lifet-link-avatar {
    flex-shrink: 0;
}

.lifet-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.lifet-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--lifet-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lifet-text-muted);
}

.lifet-avatar-placeholder-sm {
    width: 32px;
    height: 32px;
}

.lifet-link-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.lifet-link-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--lifet-text);
    white-space: nowrap;
}

.lifet-link-desc {
    font-size: 14px;
    color: var(--lifet-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Comments --- */
.lifet-comments {
    margin-top: 2.5rem;
}

.lifet-comments-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--lifet-text);
}

/* Comment Form */
.lifet-comment-form {
    margin-bottom: 2rem;
}

.lifet-comment-form .row {
    margin-bottom: 1rem;
}

.lifet-comment-form .form-control {
    background: var(--lifet-card-bg);
    border-color: var(--lifet-border);
    color: var(--lifet-text);
    font-size: 13px;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
}

.lifet-comment-form .form-control::placeholder {
    color: var(--lifet-text-muted);
}

.lifet-comment-form .form-control:focus {
    border-color: var(--lifet-text-secondary);
    box-shadow: none;
}

.lifet-comment-textarea-wrap {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.lifet-comment-avatar {
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.lifet-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.lifet-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--lifet-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lifet-text-muted);
}

.lifet-comment-input {
    flex: 1;
    position: relative;
}

.lifet-comment-input textarea {
    padding: 0.75rem;
    padding-right: 3rem;
    resize: none;
    border-radius: 4px;
    border: 1px solid var(--lifet-border);
    min-height: 100px;
    width: 100%;
}

.lifet-comment-submit {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    background: var(--lifet-bg);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lifet-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lifet-comment-submit:hover {
    background: var(--lifet-border);
    color: var(--lifet-text);
}

/* Comment List */
.lifet-comments-count {
    font-size: 1rem;
    font-weight: 600;
    color: var(--lifet-text);
    margin-bottom: 1.5rem;
}

.lifet-comments-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lifet-comment-item {
    list-style: none;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

.lifet-comment-content {
    flex: 1;
    min-width: 0;
}

.lifet-comment-author {
    font-size: 14px;
    font-weight: 600;
    color: var(--lifet-text);
    margin-bottom: 0.5rem;
}

.lifet-comment-text {
    font-size: 14px;
    color: var(--lifet-text);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.lifet-comment-text p {
    margin: 0;
}

.lifet-comment-footer {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 13px;
}

.lifet-comment-time {
    color: var(--lifet-text-muted);
}

.lifet-comment-reply a {
    display: inline-block;
    font-size: 12px;
    color: var(--lifet-text-secondary);
    border: 1px solid var(--lifet-border);
    border-radius: 3px;
    padding: 1px 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.lifet-comment-reply a:hover {
    color: var(--lifet-text);
    border-color: var(--lifet-text-secondary);
}

/* Nested comments */
.lifet-comment-children {
    list-style: none;
    padding-left: 3rem;
    margin: 0;
}

.lifet-comment-logged {
    font-size: 13px;
    color: var(--lifet-text-secondary);
    margin-bottom: 1rem;
}

/* --- 404 Page --- */
.lifet-404 {
    text-align: center;
    padding: 4rem 0;
}

.lifet-404-title {
    font-size: 4rem;
    font-weight: 700;
    color: var(--lifet-text-muted);
    margin-bottom: 0.5rem;
}

.lifet-404-desc {
    font-size: 1rem;
    color: var(--lifet-text-secondary);
    margin-bottom: 1.5rem;
}

.lifet-404-link {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border: 1px solid var(--lifet-border);
    border-radius: 4px;
    color: var(--lifet-text);
    font-size: 14px;
    transition: all 0.2s ease;
}

.lifet-404-link:hover {
    background: var(--lifet-text);
    color: var(--lifet-card-bg);
    border-color: var(--lifet-text);
}

/* --- Empty State --- */
.lifet-empty {
    text-align: center;
    padding: 3rem 0;
    color: var(--lifet-text-secondary);
}

/* --- Footer --- */
.lifet-footer {
    text-align: center;
    padding: 2rem 0;
    font-size: 13px;
    color: var(--lifet-text-secondary);
}

.lifet-footer-links {
    margin-bottom: 0.5rem;
}

.lifet-footer-links a {
    color: var(--lifet-text-secondary);
    font-size: 13px;
}

.lifet-footer-links a:hover {
    color: var(--lifet-text);
}

.lifet-footer-sep {
    margin: 0 0.25rem;
    color: var(--lifet-text-muted);
}

.lifet-footer-copyright {
    margin: 0;
    color: var(--lifet-text-muted);
}

.lifet-footer-copyright a {
    color: var(--lifet-text-muted);
}

.lifet-footer-copyright a:hover {
    color: var(--lifet-text-secondary);
}

.lifet-footer-custom {
    margin-top: 0.5rem;
    font-size: 12px;
    color: var(--lifet-text-muted);
}

/* --- Back to Top --- */
.lifet-back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--lifet-text-secondary);
    color: var(--lifet-card-bg);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
}

.lifet-back-to-top.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.lifet-back-to-top:hover {
    background: var(--lifet-text);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .lifet-wrapper {
        padding: 0;
    }

    .lifet-card {
        border-radius: 0;
        padding: 1.25rem;
        box-shadow: none;
        min-height: 100vh;
    }

    .lifet-header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .lifet-search {
        width: 100%;
    }

    .lifet-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .lifet-nav-links {
        gap: 0.75rem;
    }

    .lifet-post-item {
        padding: 1.25rem 0;
    }

    .lifet-post-item.has-thumb {
        flex-direction: column;
    }

    .lifet-post-thumb {
        width: 100%;
        height: 160px;
        order: -1;
    }

    .lifet-post-single-title {
        font-size: 1.25rem;
    }

    .lifet-comment-textarea-wrap {
        flex-direction: column;
    }

    .lifet-archive-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .lifet-link-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }
}

/* --- Selection --- */
::selection {
    background: var(--lifet-text);
    color: var(--lifet-card-bg);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--lifet-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--lifet-text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--lifet-text-secondary);
}

/* --- Smooth transitions for dark mode --- */
body,
.lifet-card,
.lifet-link-card,
.lifet-search-form,
.lifet-search-input,
.lifet-search-btn,
.lifet-comment-form .form-control {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
