/* ============================================
   销冠宝AI 管理端通用样式
   参考 script_knowledge.html 设计风格
   ============================================ */

* {
    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: linear-gradient(135deg, #f0f4ff 0%, #e8ecf8 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ============================================
   顶部导航栏
   ============================================ */
.navbar {
    background: #fff;
    border-radius: 16px;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(67, 97, 238, 0.06);
}

.navbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #4361ee, #2ec4b6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}

.navbar-user {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 2px solid #e8ecf8;
    background: #f8f9fc;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #444;
    transition: all 0.2s;
}

.user-btn:hover {
    border-color: #4361ee;
    background: #f0f4ff;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #4361ee, #3a56d4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    min-width: 160px;
    padding: 6px;
    display: none;
    z-index: 500;
}

.user-dropdown.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #444;
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: #f0f4ff;
    color: #4361ee;
}

.dropdown-divider {
    height: 1px;
    background: #f0f4ff;
    margin: 4px 0;
}

.dropdown-item-danger {
    color: #e63946;
}

.dropdown-item-danger:hover {
    background: #ffebee;
    color: #e63946;
}

/* ============================================
   顶部统计卡片（参考 knowledge-tabs 风格）
   ============================================ */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 20px rgba(67, 97, 238, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(67, 97, 238, 0.15);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon-blue {
    background: linear-gradient(135deg, #4361ee, #3a56d4);
    color: #fff;
}

.stat-icon-green {
    background: linear-gradient(135deg, #2ec4b6, #26a69a);
    color: #fff;
}

.stat-icon-orange {
    background: linear-gradient(135deg, #f57c00, #e65100);
    color: #fff;
}

.stat-icon-red {
    background: linear-gradient(135deg, #e63946, #d32f2f);
    color: #fff;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: #888;
    margin-top: 2px;
}

/* ============================================
   主面板
   ============================================ */
.knowledge-panel {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(67, 97, 238, 0.06);
    padding: 28px;
    border: 1px solid rgba(67, 97, 238, 0.05);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 2px solid #f0f4ff;
}

.panel-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, #4361ee, #2ec4b6);
    border-radius: 2px;
}

.panel-actions {
    display: flex;
    gap: 10px;
}

/* ============================================
   搜索栏
   ============================================ */
.search-bar {
    margin-bottom: 20px;
    position: relative;
}

.search-input {
    width: 100%;
    max-width: 360px;
    padding: 12px 16px 12px 42px;
    border: 2px solid #e8ecf8;
    border-radius: 12px;
    font-size: 14px;
    background: #f8f9fc;
    transition: all 0.25s ease;
}

.search-input:focus {
    outline: none;
    border-color: #4361ee;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

.search-input::placeholder {
    color: #aaa;
}

.search-bar::before {
    content: '\1F50D';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none;
}

/* ============================================
   按钮样式
   ============================================ */
.btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: linear-gradient(135deg, #4361ee, #3a56d4);
    color: #fff;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(67, 97, 238, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #2ec4b6, #26a69a);
    color: #fff;
    box-shadow: 0 4px 12px rgba(46, 196, 182, 0.3);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(46, 196, 182, 0.4);
}

.btn-outline {
    background: #fff;
    color: #4361ee;
    border-color: #4361ee;
}

.btn-outline:hover {
    background: #f0f4ff;
}

.btn-danger {
    background: linear-gradient(135deg, #e63946, #d32f2f);
    color: #fff;
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(230, 57, 70, 0.4);
}

/* ============================================
   表格样式
   ============================================ */
.table-container {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e8ecf8;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: linear-gradient(180deg, #f0f4ff, #e8ecf8);
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e5f5;
    white-space: nowrap;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f4ff;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: #fafbff;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* 版本标签 */
.version-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.version-basic {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1976d2;
}

.version-pro {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    color: #f57c00;
}

/* 有效期标签 */
.expire-valid {
    color: #2ec4b6;
    font-weight: 600;
}

.expire-warning {
    color: #f57c00;
    font-weight: 600;
}

.expire-expired {
    color: #e63946;
    font-weight: 600;
}

.expire-none {
    color: #bbb;
}

/* 操作按钮 */
.action-btns {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.action-edit {
    background: #e3f2fd;
    color: #1976d2;
}

.action-edit:hover {
    background: #bbdefb;
    transform: translateY(-1px);
}

.action-delete {
    background: #ffebee;
    color: #e63946;
}

.action-delete:hover {
    background: #ffcdd2;
    transform: translateY(-1px);
}

/* ============================================
   分页
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
    gap: 6px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #e0e5f5;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover:not(.disabled):not(.active) {
    border-color: #4361ee;
    color: #4361ee;
    background: #f0f4ff;
}

.page-btn.active {
    background: linear-gradient(135deg, #4361ee, #3a56d4);
    color: #fff;
    border-color: #4361ee;
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}

.page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 13px;
    color: #888;
    margin: 0 10px;
}

/* ============================================
   模态框
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #fff;
    border-radius: 20px;
    padding: 28px;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-sm {
    max-width: 380px;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: #f0f4ff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #888;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #ffebee;
    color: #e63946;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    padding-right: 36px;
    color: #1a1a2e;
}

/* ============================================
   表单样式
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #444;
}

.required {
    color: #e63946;
    margin-left: 2px;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #e8ecf8;
    border-radius: 10px;
    font-size: 14px;
    background: #f8f9fc;
    transition: all 0.25s;
}

.form-input:focus {
    outline: none;
    border-color: #4361ee;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

.form-input::placeholder {
    color: #bbb;
}

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* 公钥容器 */
.public-key-container {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.public-key-textarea {
    flex: 1;
    min-height: 80px;
    max-height: 120px;
    resize: vertical;
    font-family: "Courier New", Courier, monospace;
    font-size: 12px;
    line-height: 1.4;
    word-break: break-all;
}

.generate-key-btn {
    white-space: nowrap;
    flex-shrink: 0;
    height: 42px;
}

.copy-key-btn {
    white-space: nowrap;
    flex-shrink: 0;
    height: 42px;
    width: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
    padding-top: 18px;
    border-top: 2px solid #f0f4ff;
}

/* 删除确认文本 */
.delete-confirm-text {
    color: #666;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* ============================================
   Toast 提示
   ============================================ */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-item {
    padding: 14px 22px;
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: toastIn 0.4s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-success {
    background: linear-gradient(135deg, #2ec4b6, #26a69a);
}

.toast-error {
    background: linear-gradient(135deg, #e63946, #d32f2f);
}

.toast-warning {
    background: linear-gradient(135deg, #f57c00, #e65100);
}

.toast-info {
    background: linear-gradient(135deg, #4361ee, #3a56d4);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.empty-state-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state-text {
    font-size: 16px;
    font-weight: 500;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 16px 12px;
    }

    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .stat-value {
        font-size: 22px;
    }

    .knowledge-panel {
        padding: 18px;
        border-radius: 16px;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .modal {
        width: 95%;
        padding: 20px;
        border-radius: 16px;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }
}
