/* ============================================
   青玉案 · 新中式留言板 - 宽屏版
   ============================================ */

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

:root {
    /* 新中式配色 - 青玉系列 */
    --primary-900: #064e3b;
    --primary-800: #065f46;
    --primary-700: #047857;
    --primary-600: #059669;
    --primary-500: #10b981;
    --primary-400: #34d399;
    --primary-300: #6ee7b7;
    --primary-100: #d1fae5;
    --primary-50: #ecfdf5;
    
    /* 墨韵灰 */
    --ink-900: #1c1917;
    --ink-800: #292524;
    --ink-700: #44403c;
    --ink-600: #57534e;
    --ink-500: #78716c;
    --ink-400: #a8a29e;
    --ink-300: #d6d3d1;
    --ink-200: #e7e5e4;
    --ink-100: #f5f5f4;
    --ink-50: #fafaf9;
    
    /* 宣纸白 */
    --paper: #ffffff;
    --paper-warm: #fdfcfa;
    
    /* 点缀 */
    --gold: #d4af37;
    --cinnabar: #dc2626;
    
    /* 字体 */
    --font-serif: 'Noto Serif SC', 'Source Han Serif SC', serif;
    --font-sans: 'Noto Sans SC', -apple-system, sans-serif;
    
    /* 动画 */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--paper-warm);
    color: var(--ink-800);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   宽屏布局 - 电脑端 (默认)
   ============================================ */
.app-container {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "sidebar header right"
        "sidebar main right"
        "sidebar footer right";
}

/* 左侧边栏 */
.sidebar {
    grid-area: sidebar;
    background: linear-gradient(180deg, var(--primary-900) 0%, var(--primary-800) 100%);
    color: white;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03));
    pointer-events: none;
}

.sidebar-brand {
    margin-bottom: 3rem;
}

.sidebar-logo {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    margin-bottom: 0.5rem;
}

.sidebar-tagline {
    font-size: 0.75rem;
    opacity: 0.7;
    letter-spacing: 0.1em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-400);
    transform: scaleY(0);
    transition: transform 0.3s var(--ease-out);
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255,255,255,0.1);
}

.nav-item:hover::before,
.nav-item.active::before {
    transform: scaleY(1);
}

.nav-icon {
    font-size: 1.25rem;
    opacity: 0.8;
}

.nav-text {
    font-size: 0.9375rem;
    font-weight: 500;
}

.nav-badge {
    margin-left: auto;
    background: var(--primary-400);
    color: var(--primary-900);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
}

.sidebar-footer {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    right: 2rem;
}

.sidebar-stats {
    display: flex;
    gap: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.6875rem;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* 装饰元素 */
.sidebar-deco {
    position: absolute;
    bottom: 120px;
    right: -20px;
    opacity: 0.1;
}

.deco-circle {
    width: 150px;
    height: 150px;
    border: 2px solid white;
    border-radius: 50%;
    animation: rotate 20s linear infinite;
}

.deco-circle::before {
    content: '';
    position: absolute;
    inset: 20px;
    border: 1px solid white;
    border-radius: 50%;
}

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

/* 头部区域 */
.header {
    grid-area: header;
    background: var(--paper);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--ink-200);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ink-900);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.header-btn {
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--ink-200);
    background: var(--paper);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--ink-700);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-btn:hover {
    border-color: var(--primary-500);
    color: var(--primary-600);
}

.header-btn.primary {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: white;
}

.header-btn.primary:hover {
    background: var(--primary-700);
}

/* 主内容区 */
.main-content {
    grid-area: main;
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(100vh - 140px);
}

/* 右侧边栏 */
.right-sidebar {
    grid-area: right;
    background: var(--ink-50);
    border-left: 1px solid var(--ink-200);
    padding: 1.5rem;
    overflow-y: auto;
}

.widget {
    background: var(--paper);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.widget-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink-900);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.widget-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--primary-500);
    border-radius: 2px;
}

/* 快速留言表单 */
.quick-form .form-group {
    margin-bottom: 1rem;
}

.quick-form input,
.quick-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--ink-200);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: var(--paper-warm);
}

.quick-form input:focus,
.quick-form textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-50);
}

.quick-form textarea {
    min-height: 80px;
    resize: vertical;
}

.submit-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary-600);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.submit-btn:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.submit-btn:hover::before {
    left: 100%;
}

/* 留言列表 - 宽屏网格 */
.messages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.message-card {
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.4s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.message-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-300));
    transform: scaleX(0);
    transition: transform 0.4s var(--ease-out);
}

.message-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: var(--primary-200);
}

.message-card:hover::before {
    transform: scaleX(1);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.message-author {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ink-900);
}

.message-time {
    font-size: 0.75rem;
    color: var(--ink-400);
}

.message-content {
    color: var(--ink-700);
    line-height: 1.8;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--ink-100);
}

.message-contact {
    display: flex;
    gap: 0.75rem;
}

.contact-link {
    font-size: 0.75rem;
    color: var(--primary-600);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.2s;
}

.contact-link:hover {
    color: var(--primary-800);
}

.message-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--ink-200);
    background: transparent;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--ink-500);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.action-btn:hover {
    border-color: var(--primary-500);
    color: var(--primary-600);
    background: var(--primary-50);
}

/* 点赞按钮 */
.like-btn {
    position: relative;
    transition: all 0.3s var(--ease-out);
}

.like-btn .like-icon {
    font-size: 1rem;
    transition: all 0.3s;
}

.like-btn .like-count {
    font-weight: 600;
    min-width: 1rem;
    text-align: center;
}

.like-btn.liked {
    border-color: var(--primary-500);
    background: var(--primary-50);
    color: var(--primary-600);
}

.like-btn.liked .like-icon {
    color: var(--primary-500);
    animation: heartBeat 0.3s ease-out;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px) scale(0.5);
    }
}

/* 页脚 */
.footer {
    grid-area: footer;
    background: var(--paper);
    padding: 1rem 2rem;
    border-top: 1px solid var(--ink-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--ink-500);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--ink-800);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    z-index: 1000;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.4s var(--ease-out);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    background: var(--primary-600);
}

.toast.error {
    background: var(--cinnabar);
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--ink-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 空状态 */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: var(--ink-400);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--ink-600);
}

/* ============================================
   手机端悬浮按钮
   ============================================ */
.fab {
    display: none;
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-600);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transition: all 0.3s var(--ease-out);
    z-index: 999;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

/* 刷新悬浮按钮 - 左下角 */
.fab-refresh {
    display: none;
    position: fixed;
    left: 1.5rem;
    bottom: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    color: var(--primary-600);
    border: 1px solid var(--primary-200);
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s var(--ease-out);
    z-index: 999;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.fab-refresh:hover {
    transform: scale(1.1);
    background: var(--primary-50);
    border-color: var(--primary-400);
}

.fab-refresh:active {
    transform: scale(0.95);
}

.fab-refresh.spinning {
    animation: spin 1s linear infinite;
}

/* ============================================
   手机端底部抽屉表单
   ============================================ */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s;
}

.drawer-overlay.show {
    opacity: 1;
}

.drawer {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--paper);
    border-radius: 20px 20px 0 0;
    z-index: 201;
    transform: translateY(100%);
    transition: transform 0.3s var(--ease-out);
    max-height: 85vh;
    overflow-y: auto;
}

.drawer.show {
    transform: translateY(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ink-200);
    position: sticky;
    top: 0;
    background: var(--paper);
    z-index: 1;
}

.drawer-title {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ink-900);
}

.drawer-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--ink-100);
    color: var(--ink-600);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.drawer-close:hover {
    background: var(--ink-200);
    color: var(--ink-800);
}

.drawer-body {
    padding: 1.25rem;
}

.drawer-form .form-group {
    margin-bottom: 1rem;
}

.drawer-form label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ink-700);
    margin-bottom: 0.375rem;
}

.drawer-form label .required {
    color: var(--cinnabar);
    margin-left: 0.25rem;
}

.drawer-form input,
.drawer-form textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--ink-200);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--paper-warm);
    transition: all 0.2s;
}

.drawer-form input:focus,
.drawer-form textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-50);
}

.drawer-form textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.drawer-submit {
    width: 100%;
    padding: 1rem;
    background: var(--primary-600);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.5rem;
}

.drawer-submit:active {
    transform: scale(0.98);
    background: var(--primary-700);
}

/* ============================================
   手机端响应式
   ============================================ */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
            "header"
            "main"
            "footer";
    }
    
    .sidebar {
        display: none;
    }
    
    /* 手机端隐藏右侧边栏，使用悬浮按钮替代 */
    .right-sidebar {
        display: none;
    }
    
    .main-content {
        max-height: none;
        padding: 1rem;
        padding-bottom: 5rem;
    }
    
    .messages-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* 显示悬浮按钮 */
    .fab {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    /* 显示刷新按钮 */
    .fab-refresh {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    /* 显示抽屉 */
    .drawer-overlay,
    .drawer {
        display: block;
    }
}

@media (max-width: 640px) {
    .header {
        padding: 1rem;
        flex-direction: row;
        justify-content: center;
    }
    
    /* 手机端隐藏头部按钮 */
    .header-actions {
        display: none;
    }
    
    .message-card {
        padding: 1rem;
    }
    
    .footer {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 5rem;
    }
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--ink-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ink-400);
}

/* 入场动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-card {
    animation: fadeInUp 0.5s var(--ease-out) backwards;
}

.message-card:nth-child(1) { animation-delay: 0.05s; }
.message-card:nth-child(2) { animation-delay: 0.1s; }
.message-card:nth-child(3) { animation-delay: 0.15s; }
.message-card:nth-child(4) { animation-delay: 0.2s; }
.message-card:nth-child(5) { animation-delay: 0.25s; }
.message-card:nth-child(6) { animation-delay: 0.3s; }
