/* style.css - 档案柜全局样式 */

:root {
    --bg: #FAF8F3;
    --card-bg: #FCFAF6;
    --text: #000000;
    --accent: #b8860b;
    --accent-light: rgba(184, 134, 11, 0.15);
    --accent-shadow: rgba(184, 134, 11, 0.08);
    --accent-shadow-hover: rgba(184, 134, 11, 0.12);
    --muted: #888888;
    --radius: 5px;
}

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

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    padding: 2rem;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* ========== 标题 ========== */
h1 {
    font-size: 2.2rem;
    font-weight: 300;
    color: var(--text);
    border-bottom: 1px solid var(--accent);
    padding-bottom: 0.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ========== 按钮（统一风格：透明底 + 金色文字边框） ========== */
.btn,
h1 a,
.back,
.new-bag-toggle {
    display: inline-block;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.4rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn:hover,
h1 a:hover,
.back:hover,
.new-bag-toggle:hover {
    background: var(--accent);
    color: var(--card-bg);
}

.btn {
    padding: 0.8rem 2rem;
    font-size: 1rem;
    font-weight: 500;
}

.btn:active {
    transform: scale(0.98);
}

/* ========== 卡片（统一内边距、圆角、边框、阴影） ========== */
.card,
.bag-card,
.archive-item {
    background: var(--card-bg);
    border: 1px solid var(--accent-light);
    border-radius: var(--radius);
    box-shadow: 0 2px 8px var(--accent-shadow);
    padding: 2rem;
}

.bag-card,
.archive-item {
    transition: box-shadow 0.2s, transform 0.2s;
}

.bag-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--accent-shadow-hover);
}

.archive-item:hover {
    box-shadow: 0 4px 16px var(--accent-shadow-hover);
}

/* 卡片标题 */
.bag-card h2,
.card h2 {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.card h2 {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--accent);
    margin-bottom: 1.5rem;
}

/* 卡片内标题链接：无边框、无背景、纯黑 */
.bag-card h2 a,
.archive-item h3 a {
    color: var(--text);
    text-decoration: none;
    border: none;
    padding: 0;
    background: transparent;
}

.bag-card h2 a:hover,
.archive-item h3 a:hover {
    color: var(--accent);
    background: transparent;
    border: none;
}

/* ========== 档案列表 ========== */
.bag-card .archive-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.bag-card .archive-list a {
    display: inline-block;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.3rem 0.8rem;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.bag-card .archive-list a:hover {
    background: var(--accent);
    color: var(--card-bg);
}

.archive-list {
    list-style: none;
    display: grid;
    gap: 1rem;
}

.archive-item h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

/* ========== 元信息与描述 ========== */
.archive-meta,
.meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.archive-meta span {
    margin-right: 1rem;
}

.meta {
    font-size: 0.9rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--accent);
}

.meta span {
    margin-right: 1.5rem;
}

.bag-card .desc,
.bag-desc,
.subtitle {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.subtitle {
    margin-bottom: 2rem;
}

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text);
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--bg);
    color: var(--text);
    transition: box-shadow 0.2s;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-light);
}

textarea {
    min-height: 200px;
    resize: vertical;
    line-height: 1.6;
}

.hint {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.3rem;
}

/* 档案袋选择器 */
.bag-selector {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.bag-selector select {
    flex: 1;
}

.new-bag-toggle {
    font-size: 0.9rem;
    white-space: nowrap;
}

.new-bag-input {
    display: none;
    margin-top: 0.5rem;
}

.new-bag-input.active {
    display: block;
}

/* ========== 消息提示 ========== */
.message {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    border-left: 4px solid var(--accent);
}

.message.success {
    background: #f5efe0;
    color: #7a5c00;
}

.message.error {
    background: #f8e8e8;
    color: #8b1a1a;
}

/* ========== 档案正文 ========== */
.content {
    line-height: 1.8;
    font-size: 1.05rem;
    color: var(--text);
}

.content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 1rem 0;
    border: 1px solid var(--accent-light);
}

.content p {
    margin-bottom: 1rem;
    text-indent: 2em;
}

.content h2,
.content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-weight: 500;
    color: var(--text);
}

.content blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 1rem;
    color: var(--muted);
    margin: 1rem 0;
}

.content code {
    background: #f0ece0;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius);
    font-size: 0.9em;
}

.content pre {
    background: #2c2c2c;
    color: #f0ece0;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1rem 0;
}

.content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* ========== 其他 ========== */
.bag-list {
    display: grid;
    gap: 1.5rem;
}

.back {
    margin-bottom: 1.5rem;
}

.empty {
    color: #999;
    font-style: italic;
}

.footer {
    margin-top: 3rem;
    text-align: center;
    font-size: 0.8rem;
    color: #aaa;
}

hr {
    border: none;
    border-top: 1px solid var(--accent);
    margin: 2rem 0;
}