/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}
a {
    text-decoration: none;
    color: #888888;
}
a:hover {
    color: #007BFF;
    font-weight: bold;
}
body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #f1f1f1;
    min-height: 100vh;
    padding: 20px;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ========== 头部 ========== */
header {
    text-align: center;
    padding: 30px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.logo {
    font-size: 2.8rem;
    margin-bottom: 15px;
    background: linear-gradient(45deg, #4cc9f0, #4361ee);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
    align-items: center;
    gap: 12px;
}
.logo i {
    /* 图标同样应用渐变文字 */
    background: linear-gradient(45deg, #4cc9f0, #4361ee);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 2.8rem;
}
.subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ========== 状态/更新信息条 ========== */
.update-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}
.update-time {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.status-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}
.status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.status-dot.online      { background: #10b981; box-shadow: 0 0 8px rgba(16,185,129,0.5); }
.status-dot.maintenance { background: #f59e0b; box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.status-dot.offline     { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.5); }

/* ========== 分类 Tab（适配深色主题的补充样式） ========== */
.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    justify-content: center;
}
.cat-tab {
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.05);
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255,255,255,0.08);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}
.cat-tab:hover {
    background: rgba(74,144,226,0.15);
    color: #4a90e2;
    border-color: rgba(74,144,226,0.3);
}
.cat-tab.active {
    background: linear-gradient(135deg,#4a90e2,#5d6afb);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(74,144,226,0.3);
}

/* ========== 网站卡片网格 ========== */
.websites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}
.website-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 25px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}
.website-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(74, 144, 226, 0.3);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
.website-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #4a90e2, #5d6afb);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}
.website-name {
    font-size: 1.35rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 图标 */
.website-icon {
    font-size: 1.6rem;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}

/* 新 CSS 定义的 6 种语义色 */
.icon-ecommerce { background: rgba(76, 175, 80, 0.15);  color: #4CAF50; }
.icon-social    { background: rgba(33, 150, 243, 0.15); color: #2196F3; }
.icon-tech      { background: rgba(156, 39, 176, 0.15); color: #9C27B0; }
.icon-content   { background: rgba(255, 152, 0, 0.15);  color: #FF9800; }
.icon-download  { background: rgba(244, 67, 54, 0.15);  color: #F44336; }
.icon-education { background: rgba(0, 150, 136, 0.15);  color: #009688; }

/* ===== 旧版渐变类名兼容映射：如果数据库里存的是老数据的 bg-xxx，自动映射到最接近的 icon-xxx ===== */
.bg-blue   { background: rgba(33,150,243,0.15);  color: #2196F3; }  /* → icon-social */
.bg-purple { background: rgba(156,39,176,0.15);  color: #9C27B0; }  /* → icon-tech */
.bg-green  { background: rgba(76,175,80,0.15);   color: #4CAF50; }  /* → icon-ecommerce */
.bg-orange { background: rgba(255,152,0,0.15);   color: #FF9800; }  /* → icon-content */
.bg-red    { background: rgba(244,67,54,0.15);   color: #F44336; }  /* → icon-download */
.bg-teal   { background: rgba(0,150,136,0.15);   color: #009688; }  /* → icon-education */

/* 分类徽章 */
.website-category {
    background: rgba(74, 144, 226, 0.2);
    color: #4a90e2;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.website-description {
    color: #aaa;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* 地址区 */
.address-section {
    margin-bottom: 15px;
}
.address-label {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 8px;
}
.address-container {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}
.address-text {
    padding: 12px 15px;
    flex-grow: 1;
    font-family: 'Consolas', 'Monaco', monospace;
    word-break: break-all;
    font-size: 0.95rem;
    color: #d0d6e0;
    min-width: 0;
}
.copy-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 0 18px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.copy-btn:hover { background: #3a7bc8; }

/* 卡片底部 */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    gap: 10px;
    flex-wrap: wrap;
}
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.status-online      { background: rgba(76, 175, 80, 0.2);  color: #4CAF50; }
.status-maintenance { background: rgba(255, 152, 0, 0.2); color: #FF9800; }
.status-offline     { background: rgba(244, 67, 54, 0.2);  color: #F44336; }
.visit-btn {
    background: linear-gradient(135deg,#667eea,#764ba2);
    color: #fff;
    padding: 8px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.visit-btn:hover {
    color: #fff;
    opacity: 0.9;
    transform: translateY(-1px);
    font-weight: 500; /* 覆盖全局 a:hover bold，避免字号抖动 */
}
.visit-btn[disabled], .visit-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ========== 使用说明 ========== */
.instructions {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 25px;
    margin-top: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #4a90e2;
}
.instructions h3 {
    margin-bottom: 15px;
    color: #4a90e2;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}
.instructions ul {
    padding-left: 22px;
    line-height: 1.8;
    color: #ccc;
}
.instructions li { margin-bottom: 8px; }

/* ========== 底部 Footer ========== */
footer {
    text-align: center;
    padding: 24px 0 30px;
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #888;
    font-size: 0.9rem;
    line-height: 1.8;
}
footer a { color: #888; text-decoration: none; }
footer a:hover { text-decoration: underline; font-weight: normal; }

/* ========== 回到顶部 ========== */
#backToTopBtn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg,#667eea,#764ba2);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    z-index: 99;
}
#backToTopBtn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#backToTopBtn:hover { transform: translateY(-3px); }

/* ========== 通知 Toast ========== */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    transition: transform 0.3s;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    opacity: 0;
}
.notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ========== 左下角 管理后台 悬浮入口 ========== */
.admin-entry {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 99;
}
.admin-entry a {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.95);
    color: #555;
    padding: 8px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}
.admin-entry a:hover {
    color: #667eea;
    box-shadow: 0 4px 18px rgba(0,0,0,0.35);
    transform: translateY(-2px);
    font-weight: 500;
}

/* ========== 加载中 / 空状态 ========== */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 1rem;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    border: 1px dashed rgba(255,255,255,0.1);
}
.loading i { margin-right: 8px; color: #4a90e2; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    body { padding: 12px; }
    .websites-grid { grid-template-columns: 1fr; gap: 18px; }
    .logo { font-size: 1.8rem; }
    .logo i { font-size: 1.6rem; }
    .subtitle { font-size: 1rem; }
    .update-info { flex-direction: column; text-align: center; gap: 12px; }
    .status-indicator { justify-content: center; }
    .website-name { font-size: 1.2rem; }
    .admin-entry, #backToTopBtn { bottom: 15px; }
    .admin-entry { left: 15px; }
    #backToTopBtn { right: 15px; }
    .admin-entry a { padding: 7px 12px; font-size: 11px; }
}
