/* ============================================
   AI创意工坊 - 后台管理样式
   ============================================ */

/* ============================================
   登录页
   ============================================ */
.admin-login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-header p {
    font-size: 14px;
    color: #8E8E93;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #48484A;
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #E8E8ED;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: #0066FF;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #FFEBEE;
    color: #C62828;
    border: 1px solid #FFCDD2;
}

/* ============================================
   后台布局
   ============================================ */
.admin-page {
    background: #F5F5F7;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.admin-sidebar {
    width: 240px;
    min-width: 240px;
    background: #1D1D1F;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.admin-sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-logo {
    font-size: 18px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.admin-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.admin-nav-item.active {
    background: #0066FF;
    color: white;
}

.admin-sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 主内容区 */
.admin-main {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
}

.admin-header {
    background: white;
    padding: 20px 32px;
    border-bottom: 1px solid #E8E8ED;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-user {
    font-size: 14px;
    color: #636366;
}

.admin-content {
    padding: 24px 32px;
}

/* ============================================
   统计卡片
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border: 1px solid #E8E8ED;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--stat-accent, #0066FF);
    opacity: 0;
    transition: opacity 0.25s;
}

.stat-card-link {
    cursor: pointer;
}

.stat-card-link:hover {
    box-shadow: 0 8px 24px rgba(0, 102, 255, 0.12);
    transform: translateY(-3px);
    border-color: rgba(0, 102, 255, 0.3);
}

.stat-card-link:hover::before {
    opacity: 1;
}

.stat-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 36px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    flex-shrink: 0;
    background: var(--stat-bg, #E8F0FE);
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: #1D1D1F;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.stat-label {
    font-size: 13px;
    color: #8E8E93;
    margin-top: 4px;
    font-weight: 500;
}

/* ============================================
   管理区块
   ============================================ */
.admin-section {
    background: white;
    border: 1px solid #E8E8ED;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s;
}

.admin-section:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.admin-section h2 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1D1D1F;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-section h2::before {
    content: '';
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, #0066FF, #00C6FF);
    border-radius: 2px;
}

/* 子类型统计 */
.subtype-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.subtype-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #F8FAFC, #F5F5F7);
    border: 1px solid #E8E8ED;
    border-radius: 12px;
    font-size: 14px;
    text-decoration: none;
    color: inherit;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.subtype-link:hover {
    background: linear-gradient(135deg, #E8F0FE, #F0F5FF);
    color: #0066FF;
    border-color: rgba(0, 102, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 102, 255, 0.1);
}

.badge {
    background: #0066FF;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* 最近日志 */
.recent-logs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.log-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #FAFAFA, #F8FAFC);
    border: 1px solid #F0F0F0;
    border-radius: 10px;
    font-size: 13px;
    transition: all 0.2s;
}

.log-item:hover {
    background: #F5F7FA;
    border-color: #E8E8ED;
    transform: translateX(2px);
}

.log-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.log-badge.image { background: #FFF3E0; color: #E65100; }
.log-badge.video { background: #E8EAF6; color: #283593; }
.log-badge.chat { background: #E8F5E9; color: #2E7D32; }

.log-prompt {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #636366;
}

.log-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.log-status.success { background: #E8F5E9; color: #2E7D32; }
.log-status.failed { background: #FFEBEE; color: #C62828; }
.log-status.processing { background: #FFF3E0; color: #E65100; }

.log-time {
    font-size: 12px;
    color: #AEAEB2;
    white-space: nowrap;
}

/* ============================================
   筛选栏
   ============================================ */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px 18px;
    background: white;
    border: 1px solid #E8E8ED;
    border-radius: 12px;
}

.filter-bar select,
.filter-bar input {
    padding: 9px 14px;
    border: 1px solid #E8E8ED;
    border-radius: 8px;
    font-size: 13px;
    background: #FAFAFA;
    transition: all 0.2s;
}

.filter-bar select:focus,
.filter-bar input:focus {
    outline: none;
    border-color: #0066FF;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.08);
    background: white;
}

.filter-bar input[type="text"] {
    min-width: 180px;
}

.filter-bar input[type="date"] {
    min-width: 140px;
}

/* ============================================
   数据表格
   ============================================ */
.table-container {
    overflow-x: auto;
    border: 1px solid #E8E8ED;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: linear-gradient(180deg, #F8FAFC, #F5F5F7);
    padding: 13px 16px;
    text-align: left;
    font-weight: 600;
    color: #48484A;
    white-space: nowrap;
    border-bottom: 2px solid #E8E8ED;
    font-size: 12px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #F5F5F7;
    color: #48484A;
    transition: background 0.15s;
}

.data-table tr:hover td {
    background: #FBFEFF;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.prompt-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.path-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'SF Mono', monospace;
    font-size: 12px;
}

.data-table a {
    color: #0066FF;
    font-size: 12px;
}

.data-table tr.row-hidden {
    opacity: 0.5;
    background: #FFF9F0;
}

.data-table tr.row-hidden:hover td {
    background: #FFF3E0;
}

.link-preview {
    white-space: nowrap;
}

.action-cell {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}

.time-cell {
    font-size: 12px;
    color: #AEAEB2;
    white-space: nowrap;
}

.log-badge.sub {
    background: #F0F0F5;
    color: #636366;
    font-size: 10px;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#selectedCount {
    font-size: 13px;
    color: #0066FF;
    font-weight: 600;
}

.admin-page .btn-warning {
    background: #FF9500;
    color: white;
}

.admin-page .btn-warning:hover {
    background: #E68600;
}

.admin-page .btn-xs {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 4px;
}

.section-hint {
    font-size: 12px;
    font-weight: 400;
    color: #AEAEB2;
    margin-left: 8px;
}

/* ============================================
   分页
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}

.pagination .page-btn {
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #E8E8ED;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.pagination .page-btn:hover {
    border-color: #0066FF;
    color: #0066FF;
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.12);
}

.pagination .page-btn.active {
    background: linear-gradient(135deg, #0066FF, #0052CC);
    color: white;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(0, 102, 255, 0.25);
}

/* ============================================
   配置表单
   ============================================ */
.config-form {
    max-width: 600px;
}

.config-form .form-group {
    margin-bottom: 20px;
}

.config-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1D1D1F;
    margin-bottom: 6px;
}

.config-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #E8E8ED;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'SF Mono', monospace;
    transition: border-color 0.2s;
}

.config-input:focus {
    outline: none;
    border-color: #0066FF;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.config-desc {
    display: block;
    font-size: 12px;
    color: #AEAEB2;
    margin-top: 4px;
}

.input-with-toggle {
    display: flex;
    gap: 8px;
}

.input-with-toggle .config-input {
    flex: 1;
}

.config-msg {
    display: inline-block;
    margin-left: 12px;
    font-size: 14px;
}

.config-msg.success { color: #34C759; }
.config-msg.error { color: #FF3B30; }

/* ============================================
   API文档
   ============================================ */
.api-doc h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #F0F0F0;
    font-size: 13px;
}

.info-table td:first-child {
    font-weight: 600;
    color: #636366;
    width: 120px;
}

.info-table code {
    background: #F5F5F7;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'SF Mono', monospace;
    font-size: 12px;
}

/* ============================================
   后台对话
   ============================================ */
.admin-chat-container {
    background: white;
    border: 1px solid #E8E8ED;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    overflow: hidden;
}

.admin-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-chat-input {
    padding: 16px 24px;
    border-top: 1px solid #E8E8ED;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.admin-chat-input textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #E8E8ED;
    border-radius: 12px;
    font-size: 14px;
    font-family: -apple-system, sans-serif;
    resize: none;
    line-height: 1.5;
}

.admin-chat-input textarea:focus {
    outline: none;
    border-color: #0066FF;
}

.chat-bubble {
    display: flex;
    max-width: 80%;
}

.chat-bubble.user {
    align-self: flex-end;
}

.chat-bubble.assistant {
    align-self: flex-start;
}

.bubble-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-bubble.user .bubble-content {
    background: #0066FF;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-bubble.assistant .bubble-content {
    background: #F5F5F7;
    color: #1D1D1F;
    border-bottom-left-radius: 4px;
}

.chat-bubble.error .bubble-content {
    background: #FFEBEE;
    color: #C62828;
}

.chat-welcome h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.chat-welcome p {
    color: #8E8E93;
    font-size: 14px;
}

/* ============================================
   通用按钮样式（后台）
   ============================================ */
.admin-page .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, sans-serif;
    letter-spacing: 0.2px;
}

.admin-page .btn-primary {
    background: linear-gradient(135deg, #0066FF, #0052CC);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.2);
}

.admin-page .btn-primary:hover {
    background: linear-gradient(135deg, #0052CC, #0041AA);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 102, 255, 0.3);
}

.admin-page .btn-outline {
    background: white;
    border: 1px solid #E8E8ED;
    color: #48484A;
}

.admin-page .btn-outline:hover {
    border-color: #0066FF;
    color: #0066FF;
    background: #F8FAFF;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.1);
}

.admin-page .btn-danger {
    background: linear-gradient(135deg, #FF3B30, #D63029);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.2);
}

.admin-page .btn-danger:hover {
    background: linear-gradient(135deg, #D63029, #B02520);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255, 59, 48, 0.3);
}

.admin-page .btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.admin-page .btn-block {
    width: 100%;
}

/* ============================================
   响应式 - 后台
   ============================================ */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-bar {
        flex-direction: column;
    }

    .data-table {
        font-size: 12px;
    }
}
