/**
 * 如东在线 - 主样式表（海滨清新风格）
 * frontend/assets/css/style.css
 *
 * 主色：浅海蓝 #2a9dbb → 深蓝 #1e7fa0
 * 背景：米白 #f8f7f2
 * 强调色：暖橙 #f09836
 * 文字：深灰 #2c3e50 / 浅灰 #7f8c8d
 */

/* ======== CSS 变量 ======== */
:root {
    --primary:       #2a9dbb;
    --primary-dk:    #1e7fa0;
    --primary-lt:    #c3e8f3;
    --accent:        #f09836;
    --accent-dk:     #d97c1a;
    --bg:            #f8f7f2;
    --bg-white:      #ffffff;
    --text:          #2c3e50;
    --text-light:    #7f8c8d;
    --border:        #e8e4dc;
    --shadow:        0 4px 24px rgba(42,157,187,0.08);
    --shadow-hover:  0 8px 32px rgba(42,157,187,0.18);
    --radius:        12px;
    --radius-sm:     6px;
    --transition:    all 0.25s ease;
    --max-width:     1200px;
    --header-h:      68px;
}

/* ======== Reset & Base ======== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dk); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
h1, h2, h3, h4 { line-height: 1.3; }

/* ======== 工具类 ======== */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ======== 顶部通告栏 ======== */
.top-notice {
    background: var(--accent); color: #fff; text-align: center;
    padding: 8px 20px; font-size: 14px;
}

/* ======== 站点头部 ======== */
.site-header {
    position: sticky; top: 0; z-index: 1000;
    background: var(--bg-white);
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
    height: var(--header-h);
}
.header-inner {
    display: flex; align-items: center; height: 100%; gap: 20px;
}
/* Logo */
.logo a {
    display: flex; align-items: center; gap: 8px;
    font-size: 22px; font-weight: 800; color: var(--primary-dk);
}
.logo a:hover { color: var(--primary); }
.logo-icon { font-size: 28px; }

/* 主导航 */
.main-nav {
    display: flex; gap: 6px; flex: 1; justify-content: center;
}
.main-nav a {
    padding: 8px 16px; border-radius: var(--radius-sm);
    font-size: 15px; font-weight: 500; color: var(--text);
    position: relative;
}
.main-nav a:hover, .main-nav a.active {
    color: var(--primary); background: var(--primary-lt);
}
.main-nav a.active::after {
    content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
    width: 20px; height: 3px; background: var(--primary); border-radius: 2px;
}

/* 头部右侧 */
.header-right { display: flex; align-items: center; gap: 14px; }
.search-box { display: flex; align-items: center; background: var(--bg); border-radius: 20px; padding: 4px 12px; }
.search-box input {
    border: none; background: transparent; outline: none; width: 140px; padding: 6px 4px;
}
.search-box button {
    border: none; background: transparent; cursor: pointer; font-size: 16px; padding: 4px;
}

/* 用户菜单 */
.user-menu { position: relative; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary-lt); }
.user-name { font-size: 14px; font-weight: 500; }
.user-dropdown {
    position: absolute; top: 120%; right: 0; width: 160px;
    background: var(--bg-white); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover); padding: 8px 0;
    display: none; z-index: 100;
}
.user-dropdown.open, .user-menu:hover .user-dropdown { display: block; }
.user-dropdown a { display: block; padding: 8px 16px; font-size: 14px; color: var(--text); }
.user-dropdown a:hover { background: var(--primary-lt); color: var(--primary-dk); }

/* 认证链接 */
.auth-links { display: flex; gap: 8px; }
.btn-sm { padding: 6px 16px; font-size: 13px; }

/* 移动端汉堡 */
.mobile-toggle {
    display: none; background: none; border: none; font-size: 26px; cursor: pointer; color: var(--primary-dk);
}

/* ======== 主内容 ======== */
.site-main { min-height: 70vh; padding-top: 20px; }
.main-inner { display: block; }
/* 需要两栏布局的页面通过 .has-sidebar 类激活 */
.main-inner.has-sidebar { display: flex; gap: 24px; }
.main-content { flex: 1; min-width: 0; }
.sidebar {
    width: 300px; flex-shrink: 0; display: flex; flex-direction: column; gap: 20px;
}

/* ======== 卡片 ======== */
.card {
    background: var(--bg-white); border-radius: var(--radius);
    box-shadow: var(--shadow); transition: var(--transition);
    overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card-body { padding: 16px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--primary); }
.card-meta { font-size: 13px; color: var(--text-light); display: flex; gap: 12px; align-items: center; }
.tag {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    background: var(--primary-lt); color: var(--primary-dk); font-size: 12px;
}

/* ======== 小部件（侧边栏） ======== */
.widget {
    background: var(--bg-white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px;
}
.widget-title {
    font-size: 16px; font-weight: 700; color: var(--primary-dk);
    padding-bottom: 12px; margin-bottom: 14px; border-bottom: 2px solid var(--primary-lt);
}
.stat-list li { padding: 8px 0; font-size: 14px; display: flex; justify-content: space-between; }
.hot-list li { padding: 6px 0; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.post-list li { padding: 7px 0; font-size: 14px; border-bottom: 1px dashed var(--border); }
.post-list li:last-child { border-bottom: none; }

/* ======== 文章列表项 ======== */
.article-item {
    display: flex; gap: 16px; padding: 16px; border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.article-item:hover { background: var(--primary-lt); border-radius: var(--radius-sm); }
.article-thumb { width: 120px; height: 80px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; }
.article-info { flex: 1; min-width: 0; }
.article-title { font-size: 16px; font-weight: 600; display: block; margin-bottom: 6px; }
.article-summary { font-size: 13px; color: var(--text-light); line-height: 1.6; }

/* ======== 按钮 ======== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 28px; border-radius: 25px; font-size: 15px; font-weight: 600;
    border: none; cursor: pointer; transition: var(--transition);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(42,157,187,0.3); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dk); }
.btn-outline {
    background: transparent; color: var(--primary); border: 2px solid var(--primary); padding: 8px 26px;
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 16px; font-size: 13px; }

/* ======== 表单 ======== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 15px; transition: var(--transition); background: var(--bg-white);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-lt); }
textarea.form-control { min-height: 120px; resize: vertical; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237f8c8d' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ======== 回到顶部 ======== */
.back-to-top {
    position: fixed; bottom: 30px; right: 30px; width: 44px; height: 44px;
    background: var(--primary); color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; cursor: pointer; opacity: 0; visibility: hidden;
    transition: var(--transition); box-shadow: 0 4px 16px rgba(42,157,187,0.3); z-index: 999;
}
.back-to-top.show { opacity: 1; visibility: visible; }
.back-to-top:hover { background: var(--primary-dk); transform: translateY(-3px); }

/* ======== 分页 ======== */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 30px 0; }
.pagination a, .pagination .current {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 12px;
    border-radius: var(--radius-sm); font-size: 14px;
}
.pagination a { background: var(--bg-white); color: var(--text); border: 1px solid var(--border); }
.pagination a:hover { background: var(--primary-lt); color: var(--primary-dk); }
.pagination .current { background: var(--primary); color: #fff; }

/* ======== 页脚 ======== */
.site-footer {
    background: var(--primary-dk); color: rgba(255,255,255,0.85);
    padding: 50px 0 0; margin-top: 60px;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; padding-bottom: 30px; }
.footer-col h4 { color: #fff; font-size: 16px; margin-bottom: 16px; }
.footer-col p { font-size: 14px; line-height: 1.8; }
.footer-col ul li { padding: 5px 0; }
.footer-col ul li a { color: rgba(255,255,255,0.7); font-size: 14px; }
.footer-col ul li a:hover { color: var(--accent); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1); padding: 18px 0;
    text-align: center; font-size: 13px; color: rgba(255,255,255,0.5);
}

/* ======== 面包屑 ======== */
.breadcrumb { display: flex; gap: 8px; font-size: 13px; color: var(--text-light); margin-bottom: 20px; }
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border); }

/* ======== Alert 提示 ======== */
.alert { padding: 14px 20px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #e8f8f0; color: #1a7d4e; border: 1px solid #a3e4c0; }
.alert-error   { background: #fde8e8; color: #9b1c1c; border: 1px solid #f5a5a5; }
.alert-info    { background: var(--primary-lt); color: var(--primary-dk); border: 1px solid #8cd5ea; }
