/* ==========================================
   软件库前端样式 - 核心样式（已模块化）
   导航样式 → dh/dh.css
   投稿样式 → tg/tg.css
   ========================================== */

/* 全局变量 - 与后台完全一致 */
:root {
    --hero-height: 206px;
    --bg-primary: #f5f6f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef1f5;
    --text-primary: #20242a;
    --text-secondary: #69717d;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --success: #16a34a;
    --error: #dc2626;
    --warning: #d97706;
    --border: #d9dee7;
    --shadow: rgba(15, 23, 42, 0.08);
    --transition: 0.2s ease;
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 滚动条样式 */
::-webkit-scrollbar { 
    width: 5px; 
    height: 5px; 
}

::-webkit-scrollbar-track { 
    background: rgba(15, 23, 42, 0.04); 
    border-radius: 10px; 
}

::-webkit-scrollbar-thumb { 
    background: rgba(15, 23, 42, 0.16); 
    border-radius: 10px; 
}

::-webkit-scrollbar-thumb:hover { 
    background: rgba(15, 23, 42, 0.24); 
}

/* ==========================================
   顶部导航栏
   ========================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--hero-height);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 24px 26px;
    z-index: 100;
    box-shadow: 0 2px 10px var(--shadow);
    gap: 14px;
}

.site-title {
    font-size: 34px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
    letter-spacing: 0;
}

.site-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
    margin-top: 6px;
}

.header-actions {
    position: absolute;
    top: 12px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.hero-search-wrap {
    width: min(760px, calc(100vw - 48px));
}

.header-search {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0;
    height: 48px;
    box-shadow: 0 10px 24px var(--shadow);
    overflow: hidden;
}

.search-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0 18px;
    width: 100%;
    height: 100%;
    font-size: 15px;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-secondary);
    font-size: 14px;
}

.search-btn {
    width: 112px;
    height: 100%;
    background: var(--accent);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all var(--transition);
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}

.admin-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.search-btn:hover {
    background: var(--accent-hover);
}

.admin-btn:hover {
    color: var(--accent);
    background-color: rgba(37, 99, 235, 0.1);
}

.admin-btn {
    width: auto;
    height: 32px;
    border-radius: 6px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 12px;
    line-height: 1;
}

/* ==========================================
   主容器
   ========================================== */
.main-container {
    display: flex;
    margin-top: var(--hero-height);
    height: calc(100vh - var(--hero-height));
}

/* ==========================================
   内容区
   ========================================== */
.content {
    flex: 1;
    margin-left: 170px;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

.content::-webkit-scrollbar {
    width: 6px;
}

.content::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.04);
}

.content::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.16);
    border-radius: 3px;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.loading-placeholder,
.empty-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.seo-content {
    margin-top: 24px;
    padding: 22px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
}

.seo-content h2 {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1.35;
    font-weight: 700;
}

.seo-content p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.8;
}

.seo-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.seo-keywords span {
    padding: 5px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.seo-faq {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.seo-faq h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.4;
}

.seo-faq dt {
    margin-top: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.seo-faq dd {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.7;
}

/* ==========================================
   资源卡片 - 优化后的4行布局
   ========================================== */
.resource-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    transition: all var(--transition);
    position: relative;
    height: 180px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.resource-card:hover {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 6px 18px var(--shadow);
}

/* 第一行：状态+标题+访问按钮 */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 28px;
    flex-shrink: 0;
}

.card-title-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.status-icon {
    font-size: 12px;
    margin-right: 6px;
    flex-shrink: 0;
}

.status-icon.valid {
    color: var(--success);
}

.status-icon.invalid {
    color: var(--error);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* 访问按钮样式 */
.visit-btn {
    padding: 4px 10px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent);
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    transition: all var(--transition);
    white-space: nowrap;
}

.visit-btn:hover {
    background: rgba(37, 99, 235, 0.16);
}

/* 第二行：网盘类型+日期 */
.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    height: 24px;
    flex-shrink: 0;
}

.card-tag {
    background-color: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.card-date {
    opacity: 0.8;
}

/* 第三行：链接展示（单行横向滚动） */
.card-url {
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    font-family: monospace;
    font-size: 13px;
    color: var(--accent);
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    height: 42px;
    line-height: 1.6;
    flex-shrink: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.card-url::-webkit-scrollbar {
    display: none;
}

/* 第四行：投稿人+访问次数 */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-secondary);
    height: 20px;
    flex-shrink: 0;
}

/* ==========================================
   Toast通知 - 与后台一致
   ========================================== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 15px 20px;
    margin-top: 10px;
    min-width: 300px;
    animation: slideInFromBottom 0.3s ease;
    color: var(--text-primary);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==========================================
   悬浮提示
   ========================================== */
.tooltip {
    position: fixed;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px var(--shadow);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    max-width: 300px;
    word-break: break-all;
    white-space: pre-line;
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
}
