/* ===== CSS Variables & Design Tokens ===== */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(30, 30, 55, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0c0;
    --text-muted: #6a6a8a;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-pink: #f093fb;
    --accent-blue: #667eea;
    --accent-purple: #764ba2;
    --accent-coral: #f5576c;
    --accent-gold: #ffd700;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(118, 75, 162, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(240, 147, 251, 0.05) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

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

img {
    max-width: 100%;
    display: block;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 3px;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
}

/* ===== Navigation ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(15, 15, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar .logo {
    font-size: 1.4rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.navbar .nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar .nav-links a,
.navbar .nav-links button {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-sans);
}

.navbar .nav-links a:hover,
.navbar .nav-links button:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.navbar .nav-links .btn-publish {
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 600;
}

.navbar .nav-links .btn-publish:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.navbar .user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: var(--bg-glass);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
}

.navbar .nav-links a.user-info {
    padding: 4px 12px 4px 4px;
}

.navbar .user-info img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.navbar .user-info span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.container-sm {
    max-width: 560px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    border-color: rgba(102, 126, 234, 0.2);
}

/* ===== Post Grid ===== */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.post-card .post-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: var(--transition);
}

.post-card:hover .post-image {
    transform: scale(1.03);
}

.post-card .post-image-wrapper {
    overflow: hidden;
    position: relative;
}

.post-card .post-image-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, rgba(30, 30, 55, 0.8));
    pointer-events: none;
}

.post-card .post-body {
    padding: 20px;
}

.post-card .post-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card .post-excerpt {
    font-size: 0.88rem;
    color: var(--text-secondary);
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
}

.post-card .post-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.post-card .post-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clickable-author {
    cursor: pointer;
}

.clickable-author:hover {
    opacity: 0.9;
}

.post-card .post-author .author-info {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}

.post-card .post-author img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

.post-card .post-author .name {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.post-card .post-author .contact {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.post-card .post-stats {
    display: flex;
    gap: 12px;
}

.post-card .post-stats .stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-card .post-stats .stat svg {
    width: 14px;
    height: 14px;
}

/* ===== Detail Page ===== */
.detail-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 24px;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.detail-card:hover {
    transform: none;
    box-shadow: none;
}

.detail-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
}

.detail-body {
    padding: 32px;
}

.detail-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 16px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.detail-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.detail-author img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
}

.detail-author .author-info .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.detail-author .author-info .time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.detail-author .author-info .contact {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.detail-content {
    font-size: 1rem;
    line-height: 1.9;
    color: var(--text-secondary);
    white-space: pre-wrap;
    margin-bottom: 32px;
}

/* ===== Interaction Buttons ===== */
.interaction-bar {
    display: flex;
    gap: 12px;
    padding: 20px 32px;
    border-top: 1px solid var(--border-color);
    background: rgba(15, 15, 26, 0.5);
}

.interaction-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-sans);
}

.interaction-btn:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
    background: rgba(102, 126, 234, 0.1);
}

.interaction-btn.active {
    background: rgba(102, 126, 234, 0.15);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.interaction-btn.active.liked {
    color: var(--accent-coral);
    border-color: var(--accent-coral);
    background: rgba(245, 87, 108, 0.15);
}

.interaction-btn.active.favorited {
    color: var(--accent-gold);
    border-color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.1);
}

.interaction-btn svg {
    width: 18px;
    height: 18px;
}

/* ===== Auth Pages ===== */
.auth-container {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    padding: 40px 36px;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
}

.auth-card h2 {
    font-size: 1.6rem;
    margin-bottom: 8px;
    text-align: center;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 32px;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: var(--font-sans);
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    width: 100%;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

/* ===== Links ===== */
.auth-link {
    text-align: center;
    margin-top: 24px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.auth-link a {
    color: var(--accent-blue);
    font-weight: 600;
    transition: var(--transition);
}

.auth-link a:hover {
    color: var(--accent-pink);
}

/* ===== Toast/Alert ===== */
.toast {
    position: fixed;
    top: 80px;
    right: 24px;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 9999;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    max-width: 360px;
}

.toast-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.toast-error {
    background: rgba(245, 87, 108, 0.15);
    color: var(--accent-coral);
    border: 1px solid rgba(245, 87, 108, 0.3);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ===== Page Header ===== */
.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ===== Publish Page ===== */
.publish-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 32px 24px;
}

.publish-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    padding: 36px;
    position: relative;
    overflow: hidden;
}

.publish-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
}

.user-home-card {
    padding: 24px;
    margin-bottom: 18px;
}

.user-home-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-home-header img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
}

.user-home-header h1 {
    margin: 0;
    font-size: 1.4rem;
}

.user-home-header p {
    margin: 4px 0 0;
    color: var(--text-muted);
}

.user-home-header .contact {
    color: var(--text-secondary);
}

.user-post-header {
    text-align: left;
    margin-bottom: 20px;
}

.dm-user-btn {
    margin-top: 10px;
    width: auto;
    padding: 8px 14px;
    font-size: 0.85rem;
}

.messages-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 620px;
}

.messages-sidebar {
    border-right: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.messages-sidebar-title {
    padding: 14px 16px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}

.messages-list {
    max-height: 560px;
    overflow: auto;
}

.conversation-item {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    color: inherit;
    padding: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    text-align: left;
}

.conversation-item:hover,
.conversation-item.active {
    background: rgba(102, 126, 234, 0.1);
}

.conversation-item img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
}

.conversation-text {
    flex: 1;
    min-width: 0;
}

.conversation-text .top,
.conversation-text .bottom {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.conversation-text .name {
    font-weight: 600;
    color: var(--text-primary);
}

.conversation-text .time,
.conversation-text .bottom {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.conversation-text .bottom span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unread-dot {
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 6px;
    background: var(--accent-coral);
    color: #fff;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.messages-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.messages-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.messages-stream {
    flex: 1;
    max-height: 480px;
    overflow: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 70%;
}

.message-item.mine {
    margin-left: auto;
    align-items: flex-end;
}

.message-item.other {
    margin-right: auto;
    align-items: flex-start;
}

.message-bubble {
    padding: 10px 12px;
    border-radius: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.message-item.mine .message-bubble {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.35);
}

.message-time {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.messages-input-wrap {
    border-top: 1px solid var(--border-color);
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.messages-input-wrap textarea {
    flex: 1;
    min-height: 48px;
    max-height: 140px;
    resize: vertical;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    font-family: var(--font-sans);
    font-size: 0.92rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.messages-input-wrap .btn {
    width: auto;
    padding: 10px 16px;
}

/* ===== Profile Page ===== */
.profile-card {
    padding: 28px;
    margin-bottom: 18px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.profile-header img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
}

.profile-header h2 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.profile-header p {
    color: var(--text-muted);
    font-size: 0.86rem;
}

.profile-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
}

.profile-row .label {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.profile-row .value {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.my-posts-card {
    padding: 20px;
}

.my-posts-title {
    margin: 0 0 14px;
    font-size: 1.05rem;
}

.works-tip {
    margin: 0 0 14px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.works-link-btn {
    max-width: 180px;
}

.my-posts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    gap: 10px;
}

#works-content {
    width: 100%;
    overflow-x: auto;
}

#works-content .my-posts-card {
    width: 100%;
    min-width: 920px;
}

.my-post-item {
    display: block;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    transition: var(--transition);
}

.my-post-item:hover {
    border-color: var(--accent-blue);
    background: rgba(102, 126, 234, 0.08);
}

.my-post-item h4 {
    margin: 0 0 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.my-post-item p {
    margin: 0 0 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.my-post-item .meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.my-post-item-manage .meta svg,
.my-post-item .meta svg {
    width: 14px;
    height: 14px;
    vertical-align: text-bottom;
}

.my-post-item-manage {
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    min-width: 0;
}

.my-post-item-manage .manage-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.my-post-item-manage h4 {
    margin: 0 0 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.manage-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-mini {
    width: auto;
    padding: 8px 12px;
    font-size: 0.82rem;
}

.btn-danger {
    color: var(--accent-coral);
    border-color: rgba(245, 87, 108, 0.4);
}

.btn-danger:hover {
    background: rgba(245, 87, 108, 0.12);
}

.manage-content {
    margin: 0 0 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.edit-post-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--border-color);
}

.edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.hidden {
    display: none !important;
}

.image-preview {
    width: 100%;
    height: 250px;
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
    overflow: hidden;
    transition: var(--transition);
    background: var(--bg-secondary);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview.has-image {
    border-style: solid;
    border-color: var(--accent-blue);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
}

/* ===== Loading ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Site Footer ===== */
.site-footer {
    padding: 28px 24px;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
}

.footer-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.1fr 1.4fr 1.5fr;
    gap: 28px;
    text-align: left;
}

.footer-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    line-height: 1.65;
}

.footer-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.site-footer a {
    color: var(--text-muted);
    transition: var(--transition);
    width: fit-content;
}

.site-footer a:hover {
    color: var(--accent-blue);
}

.footer-copy {
    max-width: 1200px;
    margin: 18px auto 0;
    padding-top: 14px;
    border-top: 1px dashed var(--border-color);
    font-size: 0.82rem;
    text-align: left;
}

/* ===== Comments ===== */
.comments-card {
    margin-top: 20px;
    padding: 24px;
}

.comments-title {
    margin: 0 0 16px;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.comment-form textarea {
    width: 100%;
    min-height: 96px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    resize: vertical;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.comment-form .btn {
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.comment-form .btn svg {
    width: 16px;
    height: 16px;
}

.comments-login-tip {
    margin-bottom: 16px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.comment-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

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

.comment-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.comment-author {
    font-weight: 600;
    color: var(--text-primary);
}

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

.comment-content p {
    margin: 0;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .post-grid {
        grid-template-columns: 1fr;
    }

    .navbar {
        padding: 0 16px;
    }

    .navbar .nav-links {
        gap: 4px;
    }

    .navbar .nav-links a,
    .navbar .nav-links button {
        padding: 6px 10px;
        font-size: 0.82rem;
    }

    .detail-body {
        padding: 20px;
    }

    .detail-title {
        font-size: 1.4rem;
    }

    .interaction-bar {
        padding: 16px 20px;
        flex-wrap: wrap;
    }

    .auth-card {
        padding: 32px 24px;
    }

    .comments-card {
        padding: 20px;
    }

    .works-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .messages-layout {
        grid-template-columns: 1fr;
    }

    .messages-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .messages-stream {
        max-height: 400px;
    }
}

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

    .container,
    .detail-container,
    .publish-container {
        padding: 16px;
    }

    .works-grid {
        grid-template-columns: 1fr;
    }
}
