/* ═══════════════════════════════════════════════════
   工具总站 - 全局样式 + 三套主题
   ═══════════════════════════════════════════════════ */

/* ── 主题变量 ──────────────────────────────────────── */

/* 暗黑主题（默认） */
body[data-theme="dark"] {
    --bg:          #0f0f0f;
    --bg-card:    #1a1a2e;
    --bg-elev:    #16213e;
    --text:       #e0e0e0;
    --text-dim:   #888;
    --accent:     #e94560;
    --accent-2:   #0f3460;
    --border:     #2a2a4a;
    --shadow:     rgba(0,0,0,.5);
    --header-bg:  rgba(15,15,15,.85);
    --card-hover: #1e1e3a;
    --like-color: #e94560;
    --nav-bg:     rgba(22,33,62,.9);
}

/* 白色主题 */
body[data-theme="light"] {
    --bg:          #f5f5f5;
    --bg-card:    #ffffff;
    --bg-elev:    #e8eaf6;
    --text:       #1a1a2e;
    --text-dim:   #666;
    --accent:     #3f51b5;
    --accent-2:   #5c6bc0;
    --border:     #ddd;
    --shadow:     rgba(0,0,0,.1);
    --header-bg:  rgba(255,255,255,.9);
    --card-hover: #f0f0ff;
    --like-color: #e91e63;
    --nav-bg:     rgba(255,255,255,.95);
}

/* 黄蓝主题 */
body[data-theme="yellow-blue"] {
    --bg:          #1a1a2e;
    --bg-card:    #16213e;
    --bg-elev:    #0f3460;
    --text:       #ffd700;
    --text-dim:   #8b8b00;
    --accent:     #ffd700;
    --accent-2:   #00b4d8;
    --border:     #1a3a5c;
    --shadow:     rgba(0,0,0,.5);
    --header-bg:  rgba(15,15,30,.9);
    --card-hover: #1a2a4e;
    --like-color: #ffd700;
    --nav-bg:     rgba(15,52,96,.9);
}

/* ── 全局 ──────────────────────────────────────────── */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background .3s, color .3s;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ── 头部 ──────────────────────────────────────────── */

.header {
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 24px; height: 60px;
}

.logo {
    font-size: 22px; font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-right: auto; cursor: pointer;
}

.header-right {
    display: flex; align-items: center; gap: 16px;
}

/* 访客计数 */
.visitor-badge {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text-dim);
    background: var(--bg-elev); padding: 5px 12px;
    border-radius: 20px;
}
.visitor-badge .num {
    color: var(--accent); font-weight: 700; font-size: 15px;
}

/* 主题切换 */
.theme-switch {
    display: flex; gap: 6px;
}
.theme-btn {
    width: 28px; height: 28px; border-radius: 50%;
    border: 2px solid var(--border); cursor: pointer;
    transition: transform .2s, border-color .2s;
}
.theme-btn:hover { transform: scale(1.15); }
.theme-btn.active { border-color: var(--accent); transform: scale(1.1); }
.theme-btn.dark     { background: #0f0f0f; }
.theme-btn.light    { background: #f5f5f5; }
.theme-btn.yb       { background: linear-gradient(135deg, #ffd700, #00b4d8); }

/* 管理入口 */
.admin-link {
    font-size: 18px; color: var(--text-dim);
    transition: color .2s; cursor: pointer;
}
.admin-link:hover { color: var(--accent); }

/* ── 轮播图 ────────────────────────────────────────── */

.carousel {
    width: 100%; max-width: 1200px;
    margin: 20px auto; height: 320px;
    border-radius: 16px; overflow: hidden;
    position: relative; box-shadow: 0 8px 30px var(--shadow);
}
.carousel-track {
    display: flex; width: 100%; height: 100%;
    transition: transform .5s ease;
}
.carousel-slide {
    min-width: 100%; height: 100%;
    position: relative;
    background-size: cover; background-position: center;
}
.carousel-slide .slide-title {
    position: absolute; bottom: 30px; left: 30px;
    font-size: 26px; font-weight: 700;
    color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.carousel-slide::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(transparent 50%, rgba(0,0,0,.4));
    pointer-events: none;
}
.carousel-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(0,0,0,.4); color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 20px; z-index: 2;
    transition: background .2s; border: none;
}
.carousel-arrow:hover { background: rgba(0,0,0,.7); }
.carousel-arrow.prev { left: 12px; }
.carousel-arrow.next { right: 12px; }
.carousel-dots {
    position: absolute; bottom: 12px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 8px; z-index: 2;
}
.carousel-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255,255,255,.4); cursor: pointer;
    transition: background .2s, width .2s;
}
.carousel-dot.active {
    background: #fff; width: 24px; border-radius: 4px;
}

/* ── 板块区域 ──────────────────────────────────────── */

.section {
    max-width: 1200px; margin: 0 auto 40px;
    padding: 0 20px;
}
.section-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 22px; font-weight: 700;
    margin-bottom: 20px; padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}
.section-title .icon { font-size: 26px; }
.section-title .badge {
    font-size: 12px; font-weight: 400; color: var(--text-dim);
    margin-left: 8px;
}

/* ── 工具卡片 ──────────────────────────────────────── */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s, background .2s;
    display: flex; flex-direction: column; gap: 8px;
}
.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px var(--shadow);
    background: var(--card-hover);
}
.tool-card .card-icon {
    font-size: 36px; line-height: 1;
}
.tool-card .card-name {
    font-size: 16px; font-weight: 600;
}
.tool-card .card-desc {
    font-size: 13px; color: var(--text-dim); line-height: 1.5;
}
.tool-card .card-arrow {
    margin-top: auto; align-self: flex-end;
    color: var(--accent); font-size: 18px;
    opacity: 0; transition: opacity .2s;
}
.tool-card:hover .card-arrow { opacity: 1; }

/* ── 站长寄语 ──────────────────────────────────────── */

.message-section {
    max-width: 800px; margin: 0 auto 60px;
    padding: 0 20px;
}
.message-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px; padding: 30px;
    text-align: center; position: relative;
}
.message-card .quote-mark {
    font-size: 48px; color: var(--accent);
    opacity: .3; line-height: 1;
    position: absolute; top: 10px; left: 20px;
}
.message-content {
    font-size: 17px; line-height: 1.8;
    color: var(--text); margin: 10px 0 20px;
}
.message-time {
    font-size: 12px; color: var(--text-dim);
    margin-bottom: 16px;
}
.message-actions {
    display: flex; justify-content: center; gap: 20px;
}
.reaction-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 18px; border-radius: 25px;
    border: 2px solid var(--border);
    background: transparent; color: var(--text);
    cursor: pointer; font-size: 14px;
    transition: all .2s;
}
.reaction-btn:hover {
    border-color: var(--accent); transform: scale(1.05);
}
.reaction-btn.active-like {
    border-color: var(--like-color);
    background: var(--like-color); color: #fff;
}
.reaction-btn.active-dislike {
    border-color: var(--text-dim);
    background: var(--text-dim); color: var(--bg);
}
.reaction-btn .count { font-weight: 700; }

/* ── 悬浮AI角色 ────────────────────────────────────── */

.float-character {
    position: fixed; right: 20px; bottom: 20px;
    z-index: 90;
    display: flex; flex-direction: column; align-items: center;
}
.char-avatar {
    width: 80px; height: 80px; border-radius: 50%;
    border: 3px solid var(--accent);
    overflow: hidden; cursor: pointer;
    box-shadow: 0 4px 15px var(--shadow);
    animation: float-bounce 3s ease-in-out infinite;
    background: var(--bg-elev);
}
.char-avatar img {
    width: 100%; height: 100%; object-fit: cover;
}
.char-bubble {
    position: absolute; bottom: 90px; right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px 12px 12px 4px;
    padding: 10px 14px; max-width: 200px;
    font-size: 13px; color: var(--text);
    box-shadow: 0 4px 15px var(--shadow);
    display: none;
    line-height: 1.5;
}
.char-bubble.show { display: block; animation: bubble-in .3s; }
.char-name {
    font-size: 11px; color: var(--text-dim);
    margin-top: 4px; text-align: center;
}

@keyframes float-bounce {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-10px); }
}
@keyframes bubble-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── 页脚 ──────────────────────────────────────────── */

.footer {
    text-align: center; padding: 30px 20px;
    font-size: 13px; color: var(--text-dim);
    border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════
   管理后台
   ═══════════════════════════════════════════════════ */

.login-page, .admin-page {
    min-height: 100vh; display: flex; flex-direction: column;
}

.login-box {
    max-width: 360px; margin: 80px auto;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; padding: 40px;
    text-align: center;
}
.login-box h2 { margin-bottom: 20px; font-size: 20px; }
.login-box input {
    width: 100%; padding: 12px 16px; margin-bottom: 16px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg); color: var(--text); font-size: 15px;
}
.login-box button, .btn {
    padding: 12px 24px; border: none; border-radius: 10px;
    background: var(--accent); color: #fff;
    cursor: pointer; font-size: 15px; font-weight: 600;
    transition: opacity .2s, transform .1s;
}
.login-box button:hover, .btn:hover { opacity: .85; }
.login-box button:active, .btn:active { transform: scale(.97); }
.login-error {
    color: var(--accent); font-size: 13px; margin-bottom: 12px;
    display: none;
}

/* 管理后台布局 */
.admin-header {
    display: flex; align-items: center; gap: 16px;
    padding: 0 24px; height: 60px;
    background: var(--header-bg); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.admin-header .back-link {
    color: var(--text-dim); font-size: 14px; cursor: pointer;
}
.admin-header .back-link:hover { color: var(--accent); }

.admin-tabs {
    display: flex; gap: 4px; max-width: 1000px; margin: 20px auto;
    padding: 0 20px; border-bottom: 2px solid var(--border);
}
.admin-tab {
    padding: 10px 20px; cursor: pointer;
    font-size: 14px; color: var(--text-dim);
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color .2s, border-color .2s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--accent); border-color: var(--accent); }

.admin-panel {
    max-width: 1000px; margin: 0 auto; padding: 20px;
}
.admin-panel .tab-content { display: none; }
.admin-panel .tab-content.active { display: block; }

/* 表单行 */
.form-row {
    display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.form-row input, .form-row select, .form-row textarea {
    flex: 1; min-width: 120px;
    padding: 10px 14px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--bg-card); color: var(--text);
    font-size: 14px;
}
.form-row textarea { min-height: 60px; resize: vertical; }
.form-row .btn-sm {
    padding: 10px 16px; font-size: 13px;
}

/* 管理列表 */
.admin-list {
    margin-top: 20px;
}
.admin-list-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 8px; font-size: 14px;
}
.admin-list-item .item-icon { font-size: 20px; }
.admin-list-item .item-name { font-weight: 600; flex: 1; }
.admin-list-item .item-cat {
    font-size: 12px; color: var(--text-dim);
    background: var(--bg-elev); padding: 3px 10px; border-radius: 12px;
}
.admin-list-item .item-desc { color: var(--text-dim); font-size: 12px; flex: 1; }
.btn-danger {
    background: #e94560; color: #fff; border: none;
    padding: 6px 14px; border-radius: 8px; cursor: pointer;
    font-size: 13px;
}
.btn-danger:hover { opacity: .85; }

/* ── 响应式 ────────────────────────────────────────── */

@media (max-width: 768px) {
    .header { padding: 0 12px; }
    .logo { font-size: 18px; }
    .carousel { height: 200px; margin: 12px; border-radius: 12px; }
    .carousel-slide .slide-title { font-size: 18px; bottom: 16px; left: 16px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .tool-card { padding: 14px; }
    .tool-card .card-icon { font-size: 28px; }
    .float-character { right: 10px; bottom: 10px; }
    .char-avatar { width: 56px; height: 56px; }
    .section-title { font-size: 18px; }
    .visitor-badge { font-size: 11px; padding: 4px 8px; }
}
