/* 友情链接系统 - 主样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #ffffff;
    color: #000000;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #000000;
    text-decoration: none;
}

a:hover {
    color: #0056b3;
}

/* 布局 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 页面头部 */
.page-header {
    padding: 40px 0 20px;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-header p {
    color: #666;
    font-size: 14px;
}

/* 友链区域 */
.links-section {
    margin-bottom: 40px;
}

.links-section h2 {
    font-size: 20px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 2px solid #000;
    margin-bottom: 20px;
}

/* 标题+按钮同一行（放在 .links-section h2 之后以确保覆盖） */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
    padding-bottom: 0;
    border-bottom: none;
    margin-bottom: 0;
    white-space: nowrap;
}

.section-header .apply-btn {
    flex-shrink: 0;
    margin: 0;
    padding: 6px 16px;
    font-size: 13px;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* 友情链接卡片 */
.link-card {
    position: relative;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    transition: all 0.2s ease;
    cursor: pointer;
}

.link-card:hover {
    border-color: #0056b3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.link-card .tag {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #000;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 500;
}

.link-card .card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.link-card .card-header .icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
    border: 1px solid #dee2e6;
    flex-shrink: 0;
}

.link-card .card-header .name {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.link-card .desc {
    font-size: 13px;
    color: #555;
    margin-bottom: 10px;
    line-height: 1.5;
}

.link-card .status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.link-card .status.online {
    color: #28a745;
}

.link-card .status.offline {
    color: #dc3545;
}

.apply-btn {
    display: inline-block;
    padding: 8px 20px;
    background: #ffffff;
    color: #000;
    border: 2px solid #000;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.apply-btn:hover {
    border-color: #0056b3;
    color: #0056b3;
}

.apply-btn:active {
    border-color: #0040a0;
    color: #0040a0;
}

/* 表单 */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 0;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #000;
}

.form-group label .required {
    color: #dc3545;
    margin-left: 2px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    color: #000;
    background: #fff;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #000;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-group .help-text {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.submit-btn {
    display: inline-block;
    padding: 10px 30px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-btn:hover {
    background: #333;
}

.back-btn {
    display: inline-block;
    padding: 8px 20px;
    background: #fff;
    color: #000;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    margin-right: 8px;
    transition: border-color 0.2s;
}

.back-btn:hover {
    border-color: #000;
}

/* 详情页 */
.detail-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 0;
}

.detail-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 30px;
}

.detail-card .site-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.detail-card .site-header .icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: contain;
    border: 1px solid #dee2e6;
}

.detail-card .site-header .name {
    font-size: 24px;
    font-weight: 700;
}

.detail-card .info-row {
    display: flex;
    margin-bottom: 12px;
    font-size: 14px;
}

.detail-card .info-row .label {
    width: 80px;
    flex-shrink: 0;
    color: #888;
    font-weight: 500;
}

.detail-card .info-row .value {
    flex: 1;
    color: #000;
}

.detail-card .info-row .value a {
    color: #0056b3;
}

.detail-card .info-row .value a:hover {
    text-decoration: underline;
}

.detail-card .badges {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.detail-card .badges .badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 6px;
    margin-bottom: 6px;
}

.badge-vip {
    background: #ffd700;
    color: #000;
}

.badge-svip {
    background: #ff4500;
    color: #fff;
}

.badge-admin {
    background: #000;
    color: #fff;
}

.badge-super-admin {
    background: #8b0000;
    color: #fff;
}

.badge-source {
    background: #e9ecef;
    color: #555;
    font-size: 11px;
}

/* 页面底部 */
.page-footer {
    margin-top: auto;
    padding: 30px 0;
    border-top: 1px solid #dee2e6;
    text-align: center;
    font-size: 13px;
    color: #666;
    background: #fafafa;
}

.page-footer .tips {
    margin-bottom: 8px;
    color: #888;
    font-style: italic;
}

.page-footer .icp {
    margin-bottom: 4px;
}

/* 消息提示 */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* 要求页面 */
.requirements-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 0;
}

.requirements-container ol {
    padding-left: 20px;
    font-size: 14px;
    line-height: 2;
}

.requirements-container ol li {
    margin-bottom: 4px;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #888;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-state p {
    font-size: 14px;
}

/* 搜索框 */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: #000;
}

/* 响应式 */
@media (max-width: 768px) {
    .links-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 12px;
    }
    
    .detail-card .site-header .icon {
        width: 48px;
        height: 48px;
    }
    
    .detail-card .site-header .name {
        font-size: 20px;
    }
}

/* 联系方式 */
.contacts-section {
    margin-top: 0;
}

.contacts-grid {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.contacts-grid .contact-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    text-decoration: none;
    color: #333;
    font-size: 12px;
    line-height: 1.4;
    transition: all 0.2s ease;
    background: #fff;
    white-space: nowrap;
}

.contacts-grid .contact-item:hover {
    border-color: #0056b3;
    color: #0056b3;
}

.contacts-grid .contact-item img {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    object-fit: contain;
    flex-shrink: 0;
}

/* 后台管理样式 */
.admin-header {
    background: #000;
    color: #fff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header a {
    color: #fff;
    font-size: 14px;
}

.admin-body {
    display: flex;
    min-height: calc(100vh - 50px);
}

.admin-sidebar {
    width: 220px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    flex-shrink: 0;
    transition: width 0.3s;
}

.admin-sidebar.collapsed {
    width: 50px;
}

.admin-sidebar.collapsed .sidebar-text {
    display: none;
}

.admin-sidebar .sidebar-toggle {
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border-bottom: 1px solid #dee2e6;
    font-size: 18px;
    user-select: none;
}

.admin-sidebar .sidebar-toggle:hover {
    background: #e9ecef;
}

.admin-sidebar .sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-sidebar .sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    gap: 8px;
}

.admin-sidebar .sidebar-nav li a:hover,
.admin-sidebar .sidebar-nav li a.active {
    background: #e9ecef;
    color: #000;
}

.admin-main {
    flex: 1;
    padding: 24px;
    overflow-x: auto;
}

.admin-main h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* 后台表格 */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    background: #f8f9fa;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    white-space: nowrap;
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: #f8f9fa;
}

/* 后台按钮 */
.btn {
    display: inline-block;
    padding: 6px 16px;
    font-size: 13px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: #000;
}

.btn:hover {
    border-color: #000;
}

.btn-primary {
    background: #000;
    color: #fff;
    border-color: #000;
}

.btn-primary:hover {
    background: #333;
}

.btn-success {
    background: #28a745;
    color: #fff;
    border-color: #28a745;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #000;
    border-color: #ffc107;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* 后台卡片 */
.admin-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.admin-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}

/* 后台统计 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #fff;
}

.stat-card .stat-number {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #888;
}

/* 模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* 标签 */
.tag-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    background: #000;
    color: #fff;
}

/* 分页 */
.pagination {
    margin-top: 20px;
    display: flex;
    gap: 4px;
    justify-content: center;
}

.pagination a {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
}

.pagination a.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

.pagination a:hover:not(.active) {
    border-color: #000;
}

/* 登录页 */
.login-container {
    max-width: 360px;
    margin: 100px auto;
    padding: 30px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 20px;
}

/* 操作日志样式 */
.log-entry {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.log-entry .log-time {
    color: #888;
    margin-right: 12px;
    white-space: nowrap;
}

.log-entry .log-type {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin-right: 8px;
}

.log-type-admin {
    background: #e9ecef;
    color: #495057;
}

.log-type-user {
    background: #d4edda;
    color: #155724;
}

.log-type-ai {
    background: #cce5ff;
    color: #004085;
}

/* 折叠面板 */
.collapsible {
    cursor: pointer;
}

.collapsible .collapse-icon {
    transition: transform 0.3s;
}

.collapsible.open .collapse-icon {
    transform: rotate(90deg);
}

.collapse-content {
    display: none;
}

.collapse-content.show {
    display: block;
}