/* ===== 全局重置 & 基础样式 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', '微软雅黑', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f5f7fa;
    color: #1a202c;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== 顶部导航栏 ===== */
.navbar {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-bottom: 1px solid #2d3748;
    padding: 14px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .brand a {
    color: #f0e6d0;
    text-decoration: none;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
}
.navbar .brand a:hover { color: #c9a84c; }
.navbar .brand small {
    font-weight: 300;
    font-size: 1rem;
    color: #a0aec0;
    margin-left: 12px;
}

.navbar .user-area {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.navbar .user-area .owner {
    background: rgba(255,255,255,0.08);
    padding: 4px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    color: #a0aec0;
    border: 1px solid #2d3748;
}
.navbar .user-area .owner i { color: #c9a84c; font-style: normal; }
.navbar .user-area .username { color: #f0e6d0; font-weight: 600; }
.navbar .user-area a {
    color: #a0aec0;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.95rem;
}
.navbar .user-area a:hover {
    background: rgba(255,255,255,0.08);
    color: #f0e6d0;
}
.navbar .user-area a.logout {
    background: rgba(229, 62, 62, 0.15);
    color: #f87171;
}
.navbar .user-area a.logout:hover {
    background: rgba(229, 62, 62, 0.25);
}

/* ===== 消息提示 ===== */
.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    border: 1px solid;
}
.alert-success { background: #f0fdf4; color: #166534; border-color: #86efac; }
.alert-danger { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fcd34d; }
.alert-info { background: #eff6ff; color: #1e3a8a; border-color: #93c5fd; }

/* ===== 主体容器 ===== */
.container {
    max-width: 1400px;
    width: 100%;
    margin: 30px auto;
    padding: 0 24px;
    flex: 1;
}

/* ===== 卡片通用 ===== */
.card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px 24px;
    margin-bottom: 20px;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card:hover {
    border-color: #c9a84c;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* ===== 底部页脚 ===== */
.footer {
    text-align: center;
    padding: 24px;
    color: #718096;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    font-size: 0.9rem;
    margin-top: 40px;
}
.footer strong { color: #c9a84c; }

/* ===== 按钮通用 ===== */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 30px;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 0.95rem;
    background: transparent;
}
.btn-primary { background: #4a90d9; color: #fff; border-color: #4a90d9; }
.btn-primary:hover { background: #357abd; transform: scale(1.02); }
.btn-success { background: #2ea043; color: #fff; border-color: #2ea043; }
.btn-success:hover { background: #22863a; transform: scale(1.02); }
.btn-warning { background: #c9a84c; color: #fff; border-color: #c9a84c; }
.btn-warning:hover { background: #b8943a; transform: scale(1.02); }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; transform: scale(1.02); }
.btn-outline { background: transparent; color: #4a5568; border-color: #d1d5db; }
.btn-outline:hover { background: #f3f4f6; color: #1a202c; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .navbar { padding: 12px 16px; }
    .navbar .brand a { font-size: 1.4rem; }
    .navbar .brand small { display: none; }
    .container { padding: 0 12px; margin: 16px auto; }
    .card { padding: 16px; }
}

/* ===== 首页特有样式 ===== */
.header-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 14px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.header-card h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
    border-left: 4px solid #c9a84c;
    padding-left: 12px;
}
.header-card .actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.header-card .search-form {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.header-card .search-form input {
    padding: 5px 12px;
    border-radius: 30px;
    border: 1px solid #d1d5db;
    background: #f7fafc;
    color: #1a202c;
    font-size: 0.85rem;
    width: 200px;
    transition: border 0.2s;
}
.header-card .search-form input:focus {
    outline: none;
    border-color: #c9a84c;
    box-shadow: 0 0 0 2px rgba(201,168,76,0.2);
}
.header-card .search-form input::placeholder { color: #9ca3af; }

/* ===== 三栏布局 ===== */
.grid-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 16px 16px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.home-layout {
    flex: 1;
    display: flex;
    gap: 16px;
    align-items: stretch;
}

/* ===== 左侧目录卡片 ===== */
.sidebar-left-card {
    flex: 0 0 200px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 12px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    max-height: 60vh;
    overflow-y: auto;
    position: sticky;
    top: 100px;
}
.sidebar-left-card h3 {
    padding: 0 14px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #e2e8f0;
    margin: 0 12px 4px;
}
.sidebar-left-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-left-card li {
    padding: 3px 14px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
}
.sidebar-left-card li:hover { background: #f8fafc; }
.sidebar-left-card a {
    text-decoration: none;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}
.sidebar-left-card a:hover { color: #1a202c; }
.sidebar-left-card a .world-id {
    color: #4a90d9;
    font-size: 0.7rem;
    font-weight: 500;
    min-width: 44px;
    flex-shrink: 0;
}

/* ===== 中间卡片网格 ===== */
.middle-card {
    flex: 1;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 16px 16px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.card-grid .card {
    margin-bottom: 0;
    transition: transform 0.2s, border-color 0.2s;
    background: #fafafa;
    border: 1px solid #e8ecf0;
    border-left: 3px solid #4a90d9;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.card-grid .card:hover {
    transform: translateY(-2px);
    border-left-color: #c9a84c;
    border-color: #c9a84c;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    background: #ffffff;
}
.card-grid .card a {
    text-decoration: none;
    color: inherit;
    display: block;
}
.card-grid .card h3 {
    margin: 0 0 2px 0;
    font-size: 0.9rem;
    color: #1a202c;
    font-weight: 600;
    line-height: 1.3;
}
.card-grid .card .tagline {
    color: #4a5568;
    font-size: 0.75rem;
    margin: 0 0 6px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-grid .card .meta {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}
.card-grid .card .meta .badge {
    background: #f3f4f6;
    color: #4a5568;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.6rem;
    border: 1px solid #e5e7eb;
}
.card-grid .card .meta .badge.status {
    background: #f0fdf4;
    color: #166534;
    border-color: #86efac;
}

/* ===== 右侧小部件卡片 ===== */
.sidebar-right-card {
    flex: 0 0 170px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sidebar-right-card .widget {
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 10px;
}
.sidebar-right-card .widget:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.sidebar-right-card .widget h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0;
    margin-bottom: 6px;
}
.sidebar-right-card .widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-right-card .widget ul li {
    padding: 3px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.8rem;
}
.sidebar-right-card .widget ul li:last-child { border-bottom: none; }
.sidebar-right-card .widget ul li a {
    color: #4a5568;
    text-decoration: none;
    transition: color 0.2s;
}
.sidebar-right-card .widget ul li a:hover { color: #c9a84c; }
.sidebar-right-card .widget .random-btn {
    display: block;
    text-align: center;
    padding: 4px 0;
    background: #f3f4f6;
    border-radius: 30px;
    color: #1a202c;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: background 0.2s;
    border: 1px solid #e5e7eb;
}
.sidebar-right-card .widget .random-btn:hover {
    background: #e5e7eb;
    border-color: #c9a84c;
}

/* ===== 空状态 ===== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px 16px;
    color: #6b7280;
    background: #fafafa;
    border-radius: 8px;
    border: 1px dashed #d1d5db;
    font-size: 0.85rem;
}

/* ===== 详情页定制样式 ===== */
.detail-title {
    color: #1a202c;
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
}
.detail-title .world-id {
    font-size: 1rem;
    font-weight: normal;
    color: #6b7280;
    margin-left: 12px;
}
.detail-title .status-badge {
    background: #f0fdf4;
    color: #166534;
    padding: 2px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-left: 12px;
    border: 1px solid #86efac;
}
.detail-tagline {
    font-size: 1.2rem;
    color: #1a202c;
    background: #f8fafc;
    padding: 14px 20px;
    border-radius: 8px;
    border-left: 5px solid #c9a84c;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    border-left-width: 5px;
    border-left-color: #c9a84c;
}
.detail-description {
    color: #1a202c;
    line-height: 1.9;
    font-size: 1.05rem;
}
.detail-section-title {
    font-size: 1.5rem;
    color: #1a202c;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
    margin-top: 30px;
    margin-bottom: 16px;
}
.detail-timeline {
    list-style: none;
    padding: 0;
}
.detail-timeline li {
    border-left: 3px solid #c9a84c;
    padding-left: 20px;
    margin-bottom: 20px;
}
.detail-timeline .date {
    font-weight: bold;
    color: #c9a84c;
    font-size: 1rem;
}
.detail-timeline .title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1a202c;
    margin: 4px 0;
}
.detail-timeline .desc {
    color: #4a5568;
}
.detail-specificity {
    background: #f8fafc;
    padding: 16px 20px;
    border-radius: 10px;
    color: #1a202c;
    border: 1px solid #e2e8f0;
    font-size: 1rem;
    line-height: 1.6;
}

/* ===== 信息卡 ===== */
.info-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.info-card h3 {
    margin-top: 0;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
    color: #1a202c;
    text-align: center;
    font-weight: 600;
}
.info-item {
    display: flex;
    border-bottom: 1px solid #f3f4f6;
    padding: 10px 0;
    align-items: flex-start;
}
.info-item:last-child { border-bottom: none; }
.info-label {
    font-weight: 600;
    width: 80px;
    color: #4a5568;
    flex-shrink: 0;
    font-size: 0.95rem;
}
.info-value {
    color: #1a202c;
    word-break: break-word;
    font-size: 0.95rem;
    line-height: 1.5;
}
.info-value .tag {
    display: inline-block;
    background: #f3f4f6;
    color: #1a202c;
    padding: 2px 12px;
    border-radius: 20px;
    margin: 2px 4px 2px 0;
    font-size: 0.85rem;
    border: 1px solid #e5e7eb;
}
.info-value strong { color: #1a202c; }
.info-meta {
    margin-top: 12px;
    font-size: 0.85rem;
    color: #6b7280;
    text-align: center;
    border-top: 1px solid #f3f4f6;
    padding-top: 12px;
}

/* ===== 按钮调整 ===== */
.btn-edit {
    background: #c9a84c;
    color: #ffffff;
}
.btn-edit:hover {
    background: #b8943a;
    transform: scale(1.02);
}
.btn-delete {
    background: #dc2626;
    color: #fff;
}
.btn-delete:hover {
    background: #b91c1c;
    transform: scale(1.02);
}

/* ===== 修订历史表格 ===== */
.revision-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}
.revision-table th {
    background: #f8fafc;
    color: #4a5568;
    padding: 8px 12px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
}
.revision-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
    color: #1a202c;
}
.revision-table tr:hover td { background: #f8fafc; }
.revision-table .action-create { color: #16a34a; }
.revision-table .action-update { color: #c9a84c; }
.revision-table .action-delete { color: #dc2626; }

/* ===== 响应式补充 ===== */
@media (max-width: 1024px) {
    .sidebar-left-card { flex: 0 0 160px; }
    .sidebar-right-card { flex: 0 0 140px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
@media (max-width: 820px) {
    .home-layout { flex-direction: column; }
    .sidebar-left-card {
        flex: auto;
        max-height: 160px;
        position: static;
        overflow-y: auto;
    }
    .sidebar-right-card {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    .sidebar-right-card .widget { flex: 1 1 45%; border-bottom: none; padding-bottom: 0; }
    .header-card { flex-direction: column; align-items: stretch; }
    .header-card .actions { flex-direction: column; align-items: stretch; }
    .header-card .search-form input { width: 100%; }
    .detail-layout { grid-template-columns: 1fr !important; }
    .info-card { margin-top: 20px; }
}
@media (max-width: 480px) {
    .card-grid { grid-template-columns: 1fr 1fr; }
    .card-grid .card { padding: 8px 10px; }
    .card-grid .card h3 { font-size: 0.8rem; }
    .sidebar-right-card .widget { flex: 1 1 100%; }
    .header-card h2 { font-size: 1rem; }
}