/**
 * 主CSS文件 - 合并所有样式模块
 */

/* 导入基础样式 */
@import url('base.css');

/* 导入组件样式 */
@import url('components/modal.css');
@import url('components/card.css');
@import url('components/article.css');

/* 导入页面样式 */
@import url('pages/thoughts.css');

/* Flash消息样式 */
.flash-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 400px;
}

.flash-message.show {
    transform: translateX(0);
}

.flash-success {
    background-color: #10b981;
}

.flash-error {
    background-color: #ef4444;
}

.flash-warning {
    background-color: #f59e0b;
}

.flash-info {
    background-color: #3b82f6;
}

/* 动画效果 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-30px);
    }
    70% {
        transform: translateY(-15px);
    }
    90% {
        transform: translateY(-4px);
    }
}

.fade-in {
    animation: slideIn 0.3s ease;
}

.fade-out {
    animation: slideOut 0.3s ease;
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

.shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

.float {
    animation: float 3s ease-in-out infinite;
}

.bounce {
    animation: bounce 1s;
}

/* 滚动触发动画 */
.scroll-animate {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s ease-out;
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 页面加载动画 */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 选中文本样式 */
::selection {
    background: #dbeafe;
    color: #1e40af;
}

::-moz-selection {
    background: #dbeafe;
    color: #1e40af;
}

/* 焦点样式 */
.focus-ring:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* 响应式文字大小 */
.text-responsive {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
}

.text-responsive-lg {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

.text-responsive-xl {
    font-size: clamp(1.5rem, 4vw, 2rem);
}

/* 背景图案 */
.bg-pattern {
    background-image: radial-gradient(circle at 1px 1px, #e5e7eb 1px, transparent 1px);
    background-size: 20px 20px;
}

.bg-pattern-dots {
    background-image: radial-gradient(circle, #d1d5db 1px, transparent 1px);
    background-size: 10px 10px;
}

.bg-pattern-grid {
    background-image:
        linear-gradient(to right, #e5e7eb 1px, transparent 1px),
        linear-gradient(to bottom, #e5e7eb 1px, transparent 1px);
    background-size: 20px 20px;
}

/* 渐变文字 */
.text-gradient {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-rainbow {
    background: linear-gradient(135deg, #ef4444, #f59e0b, #10b981, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 导航栏样式 */
.navbar {
    background: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e5e7eb;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    text-decoration: none;
}

.navbar-brand:hover {
    color: #3b82f6;
    text-decoration: none;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-nav a {
    color: #4b5563;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.navbar-nav a:hover {
    color: #3b82f6;
    background-color: #f3f4f6;
    text-decoration: none;
}

.navbar-nav a.active {
    color: #3b82f6;
    background-color: #eff6ff;
}

/* 表单样式增强 */
.form-group {
    margin-bottom: 1rem;
}

.form-control-lg {
    padding: 0.75rem 1rem;
    font-size: 1.125rem;
    border-radius: 0.5rem;
}

.form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* 加载状态 */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式工具类补充 */
.container-fluid {
    width: 100%;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container-sm {
        max-width: 640px;
    }
}

@media (min-width: 768px) {
    .container-md {
        max-width: 768px;
    }
}

@media (min-width: 1024px) {
    .container-lg {
        max-width: 1024px;
    }
}

@media (min-width: 1280px) {
    .container-xl {
        max-width: 1280px;
    }
}

/* 富文本内容样式增强 */
.prose {
    color: #4b5563;
    line-height: 1.6;
}

.prose p {
    margin-bottom: 1rem;
}

.prose h1,
.prose h2,
.prose h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* 富文本图片预占尺寸，防止图片加载后布局变化 */
.prose img {
    max-width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    object-fit: cover;
    background-color: #f3f4f6;
    display: block;
}

.prose img[src] {
    aspect-ratio: auto;
}

/* 为富文本中的其他媒体元素也添加约束 */
.prose video,
.prose iframe {
    max-width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    background-color: #000;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1f2937;
        color: #f9fafb;
    }

    .card {
        background-color: #374151;
        border-color: #4b5563;
    }

    .form-control {
        background-color: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .navbar {
        background-color: #374151;
        border-color: #4b5563;
    }
}

/* Homepage layout */
.site-nav {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(14px);
}

.site-nav-inner {
    align-items: center;
    display: flex;
    gap: 2rem;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 72rem;
    min-height: 4rem;
    padding: 0 1rem;
}

.site-brand {
    color: #020617;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0;
}

.site-brand:hover {
    color: #020617;
}

.site-nav-links,
.site-nav-actions {
    align-items: center;
    display: flex;
    gap: 0.375rem;
}

.site-nav-link,
.site-nav-button {
    border-radius: 0.375rem;
    color: #475569;
    display: inline-flex;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.625rem 0.75rem;
}

.site-nav-link:hover,
.site-nav-button:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.site-nav-button {
    background: #0f172a;
    color: #ffffff;
}

.site-nav-button:hover {
    background: #1e293b;
    color: #ffffff;
}

.home-shell {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.home-header {
    align-items: end;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    padding-bottom: 1.25rem;
}

.home-kicker {
    color: #64748b;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin: 0 0 0.375rem;
    text-transform: uppercase;
}

.home-header h1 {
    color: #020617;
    font-size: clamp(2rem, 3vw, 3rem);
    font-weight: 800;
    line-height: 1.05;
    margin: 0;
}

.home-thoughts-link {
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    color: #334155;
    display: none;
    font-size: 0.875rem;
    font-weight: 700;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
}

.home-grid {
    align-items: start;
    display: grid;
    gap: 2rem;
    grid-template-columns: minmax(0, 1fr) 22rem;
}

.home-feed {
    min-width: 0;
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.post-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
    padding: 1.25rem 1.375rem;
}

.post-card-meta,
.post-card-footer,
.post-stats,
.post-actions,
.post-author {
    align-items: center;
    display: flex;
}

.post-card-meta {
    color: #64748b;
    gap: 0.75rem;
    justify-content: space-between;
    margin-bottom: 0.875rem;
}

.post-author {
    color: #0f172a;
    font-size: 0.875rem;
    font-weight: 700;
    gap: 0.625rem;
}

.post-avatar {
    align-items: center;
    background: #0f766e;
    border-radius: 999px;
    color: #ffffff;
    display: inline-flex;
    font-size: 0.8125rem;
    height: 2rem;
    justify-content: center;
    width: 2rem;
}

.post-date {
    color: #64748b;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.post-title {
    display: -webkit-box;
    font-size: 1.375rem;
    font-weight: 800;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.25;
    margin: 0 0 0.625rem;
    overflow: hidden;
}

.post-title a {
    color: #020617;
}

.post-title a:hover {
    color: #0f766e;
}

.post-excerpt {
    color: #334155;
    display: -webkit-box;
    font-size: 1rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-height: 1.75;
    margin: 0;
    max-width: 44rem;
    overflow: hidden;
}

.post-card-footer {
    border-top: 1px solid #f1f5f9;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.875rem;
}

.post-stats {
    color: #64748b;
    font-size: 0.8125rem;
    gap: 0.875rem;
}

.post-stats span {
    align-items: center;
    display: inline-flex;
    gap: 0.3125rem;
}

.post-edited {
    background: #fef3c7;
    border-radius: 999px;
    color: #92400e;
    padding: 0.125rem 0.5rem;
}

.post-actions {
    gap: 0.625rem;
}

.post-read-link,
.post-icon-link {
    align-items: center;
    border-radius: 0.375rem;
    display: inline-flex;
    font-size: 0.875rem;
    font-weight: 700;
    justify-content: center;
    min-height: 2.25rem;
}

.post-read-link {
    background: #0f172a;
    color: #ffffff;
    padding: 0 0.875rem;
}

.post-read-link:hover {
    background: #1e293b;
    color: #ffffff;
}

.post-icon-link {
    border: 1px solid #cbd5e1;
    color: #475569;
    width: 2.25rem;
}

.home-sidebar {
    position: sticky;
    top: 5.5rem;
}

.thought-panel {
    background: #ffffff;
    border: 1px solid #dbe3ea;
    border-radius: 0.5rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.thought-panel-head {
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    padding: 1rem;
}

.thought-panel-head p {
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin: 0 0 0.25rem;
    text-transform: uppercase;
}

.thought-panel-head h2 {
    color: #020617;
    font-size: 1.125rem;
    font-weight: 800;
    margin: 0;
}

.quick-thought-form {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem;
}

.quick-thought-input,
.quick-thought-select {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    color: #0f172a;
    font-size: 0.875rem;
    width: 100%;
}

.quick-thought-input {
    min-height: 5.5rem;
    padding: 0.75rem;
    resize: vertical;
}

.quick-thought-actions {
    align-items: center;
    display: flex;
    gap: 0.625rem;
    margin-top: 0.75rem;
}

.quick-thought-select {
    flex: 1;
    padding: 0.625rem;
}

.quick-thought-submit {
    background: #0f766e;
    border: 0;
    border-radius: 0.5rem;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.875rem;
    font-weight: 800;
    justify-content: center;
    padding: 0.6875rem 0.875rem;
}

.quick-thought-submit.disabled {
    background: #94a3b8;
}

.thought-list {
    display: flex;
    flex-direction: column;
    max-height: 32rem;
    overflow-y: auto;
}

.thought-item {
    border-bottom: 1px solid #eef2f7;
    color: #334155;
    display: block;
    padding: 0.875rem 1rem;
}

.thought-item:hover {
    background: #f8fafc;
    color: #0f172a;
}

.thought-item-top {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.375rem;
}

.thought-type {
    background: #ecfdf5;
    border-radius: 999px;
    color: #047857;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.125rem 0.5rem;
    text-transform: capitalize;
}

.thought-item time {
    color: #64748b;
    font-size: 0.75rem;
}

.thought-copy {
    display: block;
    font-size: 0.875rem;
    line-height: 1.6;
}

.thought-empty,
.empty-state {
    color: #64748b;
    padding: 2rem;
    text-align: center;
}

.empty-state {
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 0.5rem;
}

.empty-state i {
    color: #94a3b8;
    font-size: 2.5rem;
}

.empty-state h3 {
    color: #0f172a;
    font-size: 1.25rem;
    margin: 1rem 0 0.375rem;
}

.home-pagination {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.home-pagination a,
.home-pagination span,
.home-pagination em {
    align-items: center;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    color: #334155;
    display: inline-flex;
    font-size: 0.875rem;
    font-style: normal;
    font-weight: 700;
    gap: 0.375rem;
    min-height: 2.25rem;
    padding: 0 0.75rem;
}

.home-pagination span {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

@media (max-width: 1023px) {
    .home-grid {
        grid-template-columns: 1fr;
    }

    .home-sidebar {
        display: none;
    }

    .home-thoughts-link {
        display: inline-flex;
    }
}

@media (max-width: 720px) {
    .site-nav-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.75rem;
        padding-bottom: 0.875rem;
        padding-top: 0.875rem;
    }

    .site-nav-links,
    .site-nav-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    .home-header {
        align-items: flex-start;
        gap: 1rem;
    }

    .post-card {
        padding: 1rem;
    }

    .post-card-meta,
    .post-card-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.75rem;
    }

    .post-title {
        font-size: 1.1875rem;
    }
}
