/* ============================================
   爱盘搜索 - 后台管理样式
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}
a { color: #2932E1; text-decoration: none; }

/* ===== 登录页 ===== */
.login-body {
    background: linear-gradient(135deg, #2932E1 0%, #667eea 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 35px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
}
.login-logo { font-size: 50px; margin-bottom: 10px; }
.login-title { font-size: 24px; color: #222; margin-bottom: 5px; }
.login-subtitle { color: #999; font-size: 14px; margin-bottom: 25px; }
.login-error {
    background: #fff2f0;
    color: #ff4d4f;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 13px;
}
.login-form { text-align: left; }
.login-form .form-group { margin-bottom: 18px; }
.login-form label {
    display: block;
    margin-bottom: 6px;
    color: #555;
    font-size: 13px;
    font-weight: 500;
}
.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.login-form input:focus { border-color: #2932E1; }
.login-btn {
    width: 100%;
    padding: 13px;
    background: #2932E1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 5px;
    transition: background 0.2s;
}
.login-btn:hover { background: #1a23c0; }
.login-tip { margin-top: 20px; font-size: 12px; color: #bbb; }
.login-back { margin-top: 10px; font-size: 13px; }

/* ===== 后台布局 ===== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}
.admin-sidebar {
    width: 220px;
    background: #001529;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}
.admin-logo {
    padding: 20px;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-nav {
    flex: 1;
    padding: 15px 0;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    transition: all 0.2s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active {
    background: #2932E1;
    color: #fff;
    border-right: 3px solid #fff;
}
.nav-icon { font-size: 16px; }
.admin-user {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logout-btn {
    color: #ff7875;
    font-size: 12px;
}
.admin-main {
    flex: 1;
    margin-left: 220px;
    padding: 25px;
}
.admin-content { max-width: 100%; }

/* ===== 页面头部 ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.btn-danger {
    background: #ff4d4f;
    color: #fff;
    border: 1px solid #ff4d4f;
}
.btn-danger:hover { background: #ff7875; }
.btn-danger:disabled {
    background: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: #222;
}
.count-badge {
    font-size: 13px;
    background: #e6f7ff;
    color: #1890ff;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: normal;
    margin-left: 8px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-align: center;
}
.btn-primary { background: #2932E1; color: #fff; }
.btn-primary:hover { background: #1a23c0; }
.btn-default { background: #fff; color: #555; border: 1px solid #ddd; }
.btn-default:hover { border-color: #2932E1; color: #2932E1; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-edit { background: #e6f7ff; color: #1890ff; }
.btn-edit:hover { background: #1890ff; color: #fff; }
.btn-delete { background: #fff2f0; color: #ff4d4f; }
.btn-delete:hover { background: #ff4d4f; color: #fff; }
.btn-lg { padding: 12px 30px; font-size: 15px; }

/* ===== 提示框 ===== */
.alert {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}
.alert-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.alert-error { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }

/* ===== 筛选栏 ===== */
.filter-bar {
    background: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
}
.filter-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-input, .filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
    outline: none;
}
.filter-input { width: 220px; }
.filter-input:focus, .filter-select:focus { border-color: #2932E1; }

/* ===== 表格 ===== */
.table-wrap {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th {
    background: #fafafa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #555;
    font-size: 13px;
    border-bottom: 2px solid #f0f0f0;
}
.admin-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
    color: #444;
}
.admin-table tr:hover { background: #fafbfc; }
.admin-table tr:last-child td { border-bottom: none; }
.title-cell { max-width: 300px; }
.resource-title-link { color: #333; font-weight: 500; }
.resource-title-link:hover { color: #2932E1; }
.time-cell { color: #999; font-size: 12px; }
.action-cell { white-space: nowrap; }
.action-cell .btn { margin-right: 5px; }
.empty-cell { text-align: center; padding: 40px; color: #999; }

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
}
.status-on { background: #f6ffed; color: #52c41a; }
.status-off { background: #fff2f0; color: #ff4d4f; }

/* ===== 表单卡片 ===== */
.form-card {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.form-card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #222;
}
.resource-form .form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.resource-form .form-group {
    flex: 1;
    min-width: 200px;
}
.resource-form .form-group.col-full { flex: 100%; }
.resource-form .form-group.col-2 { flex: 2; }
.resource-form label {
    display: block;
    margin-bottom: 6px;
    color: #555;
    font-size: 13px;
    font-weight: 500;
}
.resource-form .required { color: #ff4d4f; }
.resource-form input[type="text"],
.resource-form input[type="url"],
.resource-form input[type="number"],
.resource-form input[type="password"],
.resource-form select,
.resource-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.resource-form input:focus,
.resource-form select:focus,
.resource-form textarea:focus {
    border-color: #2932E1;
}
.resource-form textarea { resize: vertical; }
.checkbox-group {
    display: flex;
    gap: 30px;
    padding-top: 8px;
}
.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal !important;
    margin-bottom: 0 !important;
}
.checkbox-label input { width: auto !important; }
.form-actions {
    padding-top: 10px;
    border-top: 1px solid #f5f5f5;
    margin-top: 10px;
    display: flex;
    gap: 12px;
}

/* ===== 统计卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.stat-icon { font-size: 36px; }
.stat-number {
    font-size: 26px;
    font-weight: 700;
    color: #222;
    line-height: 1.2;
}
.stat-label { font-size: 13px; color: #999; }

/* ===== 弹窗 ===== */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: #fff;
    border-radius: 10px;
    padding: 25px;
    width: 90%;
    max-width: 450px;
}
.modal-content h3 {
    margin-bottom: 20px;
    font-size: 18px;
}

/* ===== 分页（后台复用前台样式） ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}
.page-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #555;
    background: #fff;
}
.page-btn.active { background: #2932E1; color: #fff; border-color: #2932E1; }
.page-dots { padding: 6px 4px; color: #999; }

/* ===== 网盘链接输入组 ===== */
.pan-input-group { margin-bottom: 18px; }
.pan-input-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: #fafbfc;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 3px solid #ddd;
}
.pan-input-row.pan-baidu { border-left-color: #2932E1; }
.pan-input-row.pan-quark { border-left-color: #FF6B00; }
.pan-input-row.pan-xunlei { border-left-color: #00A0E9; }
.pan-input-row.pan-aliyun { border-left-color: #FF6A00; }
.pan-input-label {
    width: 90px;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 13px;
    color: #444;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pan-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.pan-input-fields {
    flex: 1;
    display: flex;
    gap: 10px;
}
.pan-input-fields input {
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
    height: 44px;
}
.pan-input-fields input[type="url"] { flex: 1; min-width: 0; }
.pan-input-fields .code-input { width: 90px; flex-shrink: 0; text-align: center; }
.pan-input-fields input:focus { border-color: #2932E1; }

/* ===== 封面图预览 ===== */
.cover-preview {
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}
.cover-thumb {
    width: 100px;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eee;
}
.file-input {
    padding: 8px;
    border: 1px dashed #ddd;
    border-radius: 5px;
    width: 100%;
    background: #fafafa;
    cursor: pointer;
}
.file-input:hover { border-color: #2932E1; }
.form-tip {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* ===== 表格封面缩略图 ===== */
.table-cover {
    width: 45px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
}
.table-cover-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    font-size: 20px;
}
.pan-mini {
    font-size: 16px;
    margin-right: 3px;
    cursor: help;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .admin-sidebar { width: 60px; }
    .admin-logo span:last-child, .nav-item span:last-child, .admin-user span { display: none; }
    .admin-main { margin-left: 60px; padding: 15px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-input { width: 100%; }

    /* 表单 */
    .form-row { flex-direction: column; gap: 12px; }
    .form-group.col-2, .form-group { width: 100%; }
    .form-group input, .form-group select, .form-group textarea {
        height: 44px; font-size: 15px; padding: 10px 14px;
    }
    .form-group textarea { height: auto; min-height: 80px; }

    /* 网盘输入：垂直布局 */
    .pan-input-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px;
    }
    .pan-input-label {
        width: 100%;
        font-size: 14px;
    }
    .pan-input-fields {
        flex-direction: column;
        gap: 8px;
    }
    .pan-input-fields input {
        width: 100% !important;
        height: 44px;
        font-size: 15px;
    }

    /* 按钮 */
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; }

    /* 表格 */
    .table-wrap { overflow-x: auto; }
    .data-table { min-width: 600px; }

    /* 页面标题 */
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .page-title { font-size: 18px; }
}

@media (max-width: 480px) {
    .admin-main { padding: 10px; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-card { padding: 15px; }
    .form-card-title { font-size: 15px; }
    .btn { padding: 10px 16px; font-size: 14px; }
}

/* ===== 海报自动获取 ===== */
.title-with-poster {
    display: flex; gap: 8px;
}
.title-with-poster input { flex: 1; }
.poster-fetch-btn {
    flex-shrink: 0; padding: 0 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; border: none; border-radius: 6px;
    font-size: 13px; cursor: pointer; white-space: nowrap;
}
.poster-fetch-btn:hover { opacity: 0.9; }
.poster-fetch-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.poster-preview {
    position: relative; margin-top: 10px;
    width: 120px;
}
.poster-preview img {
    width: 100%; border-radius: 6px;
    border: 1px solid #eee; display: block;
}
.poster-remove-btn {
    position: absolute; top: -8px; right: -8px;
    width: 24px; height: 24px; border-radius: 50%;
    background: #ff4d4f; color: #fff; border: none;
    font-size: 16px; cursor: pointer; line-height: 20px;
}
.poster-options {
    margin-top: 12px; padding: 12px;
    background: #fafbfc; border-radius: 8px;
}
.poster-options-title {
    font-size: 13px; color: #666; margin-bottom: 10px;
}
.poster-options-grid {
    display: flex; gap: 10px; flex-wrap: wrap;
}
.poster-option-item {
    width: 80px; cursor: pointer;
    border: 2px solid transparent; border-radius: 6px;
    overflow: hidden; transition: all 0.2s;
}
.poster-option-item:hover { border-color: #667eea; }
.poster-option-item.selected { border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,0.3); }
.poster-option-item img { width: 100%; display: block; }

/* 开关样式 */
.switch-label {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; font-size: 14px; color: #555;
}
.switch-label input[type="checkbox"] {
    width: 18px; height: 18px; cursor: pointer;
    accent-color: #667eea;
}

/* 上传行 */
.upload-row {
    display: flex; gap: 8px; align-items: center;
}
.upload-row input[type="text"] { flex: 1; }
.qrcode-preview {
    margin-top: 10px; width: 140px;
    border: 1px solid #eee; border-radius: 6px;
    padding: 6px; background: #fff;
}
.qrcode-preview img { width: 100%; display: block; border-radius: 4px; }

/* 批量导入页面 */
.import-tips {
    background: #f8f9fa; border-radius: 8px;
    padding: 16px 20px; font-size: 14px;
    color: #555; line-height: 1.8;
}
.import-tips p { margin: 4px 0; }
.import-example {
    margin: 8px 0; border-collapse: collapse;
    background: #fff; border: 1px solid #e0e0e0;
}
.import-example td {
    padding: 6px 14px; border: 1px solid #e0e0e0;
    font-size: 13px; color: #666;
}
.tip-note { color: #999; font-size: 12px; margin-top: 8px; }
.file-input {
    padding: 10px; border: 1px dashed #ccc;
    border-radius: 6px; width: 100%;
    background: #fafafa; cursor: pointer;
}
.file-input:hover { border-color: #667eea; }
.import-details {
    max-height: 400px; overflow-y: auto;
}
.import-detail-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.import-detail-item.ok { color: #52c41a; }
.import-detail-item.skip { color: #999; }
.import-status { font-weight: bold; width: 20px; flex-shrink: 0; }
.import-title { flex: 1; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-pan { flex-shrink: 0; color: #667eea; font-size: 12px; }
.import-msg { flex-shrink: 0; color: #ff4d4f; font-size: 12px; }
