:root {
    --primary: #6366f1; /* Indigo 500 - 稍微亮一点，更有活力 */
    --primary-hover: #4f46e5; /* Indigo 600 */
    --primary-soft: #e0e7ff; /* Indigo 100 */
    
    --secondary: #64748b; /* Slate 500 */
    
    --success: #10b981; /* Emerald 500 */
    --success-soft: #d1fae5; /* Emerald 100 */
    --success-text: #065f46; /* Emerald 800 */
    
    --danger: #f43f5e; /* Rose 500 */
    --danger-soft: #ffe4e6; /* Rose 100 */
    --danger-text: #881337; /* Rose 900 */
    
    --warning: #f59e0b; /* Amber 500 */
    --warning-soft: #fef3c7; /* Amber 100 */
    --warning-text: #92400e; /* Amber 800 */
    
    --bg-page: #f8fafc; /* Slate 50 */
    --bg-card: #ffffff;
    --bg-input: #f1f5f9; /* Slate 100 */
    
    --text-main: #1e293b; /* Slate 800 - 更深一点 */
    --text-muted: #64748b; /* Slate 500 */
    
    --border-color: #e2e8f0; /* Slate 200 */
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05); /* 阴影更淡 */
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    
    --radius-md: 0.5rem;
    --radius-lg: 1rem; /* 更圆润 */
    --radius-xl: 1.5rem;
}

/* 页面整体布局 */
body {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.coze-plugins-section {
    padding-bottom: 4rem;
    padding-top: 7rem; /* 增加顶部间距 */
}

/* 通用工具类 */
.text-dark { color: var(--text-main) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

/* 导航容器占位 */
#navigation-container {
    margin-bottom: 0;
}

/* Tabs 导航 - 更加极简 */
.tabs {
    display: flex;
    background: transparent; /* 去掉背景 */
    padding: 0;
    margin-bottom: 1rem;
    border: none;
    gap: 1rem;
    box-shadow: none;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color); /* 底部线条 */
    padding-bottom: 1px;
}

.tab {
    padding: 0.75rem 1rem;
    border-radius: 0; /* 去掉圆角 */
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px; /* 盖住底线 */
}

.tab:hover {
    color: var(--primary);
    background: transparent;
}

.tab.active {
    background: transparent;
    color: var(--primary);
    box-shadow: none;
    border-bottom-color: var(--primary);
}

/* 内容区域 */
.tab-content {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Section Header */
.section-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: center; /* 垂直居中 */
    justify-content: flex-start; /* 改为左对齐，消除突兀感 */
    gap: 1.25rem;
    text-align: left; /* 内容保持左对齐 */
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--border-color); /* 增加分割线，增加层次感 */
    flex-wrap: wrap; /* 允许换行，适配移动端 */
}

/* 移动端适配：Header Actions */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .header-actions {
        width: 100%;
        margin-left: 0 !important; /* 覆盖 ms-auto */
        display: flex;
    }
    
    .header-actions .btn {
        width: 100%;
    }
}

.header-icon-box {
    width: 3.5rem;
    height: 3.5rem;
    background: white;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary); /* 使用主色调，更协调 */
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.header-text-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 0.25rem;
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 600px;
    margin: 0;
    line-height: 1.5;
}

/* Overview Section Cards */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* 恢复较小宽度，确保3个卡片能一行显示 */
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem; /* 稍微减小内边距，腾出更多空间 */
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center; /* 改为垂直居中，让所有元素在一条线上 */
    gap: 1rem; /* 稍微减小间距 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: visible; /* 允许阴影溢出 */
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-soft);
}

.stat-card.primary-card {
    background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
    border-color: var(--primary-soft);
}

.stat-icon-wrapper {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem; /* 更加圆润 */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.stat-card:hover .stat-icon-wrapper {
    transform: scale(1.1) rotate(5deg);
}

.icon-bg-blue { background: #eff6ff; color: #3b82f6; }
.icon-bg-purple { background: #f5f3ff; color: #8b5cf6; }
.icon-bg-green { background: #ecfdf5; color: #10b981; }
.icon-bg-teal { background: #f0fdfa; color: #14b8a6; }

.stat-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 3.5rem; /* Match icon height */
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 0.25rem;
    letter-spacing: -0.03em;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap; /* 防止文字换行 */
}

.card-action {
    /* 移除绝对定位，使用 Flex 布局防止遮挡 */
    position: relative;
    margin-left: auto; /* 将按钮推到最右侧 */
    flex-shrink: 0; /* 防止按钮被压缩 */
}

.btn-recharge-pill {
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%); /* 橙色渐变 */
    color: white;
    padding: 0.6rem 1.4rem; /* 稍微加大一点 */
    border-radius: 2rem;
    font-size: 0.95rem;
    font-weight: 700; /* 加粗 */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3); /* 橙色阴影 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    white-space: nowrap; /* 防止文字换行 */
    animation: pulse-glow 2s infinite; /* 呼吸动画 */
}

.btn-recharge-pill:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f97316 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(234, 88, 12, 0.5);
    color: white;
}

/* 呼吸光晕动画 */
@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(234, 88, 12, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(234, 88, 12, 0);
    }
}

/* 扫光动画效果（可选，增加动态感） */
.btn-recharge-pill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: 0.5s;
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    20% { left: 100%; }
    100% { left: 100%; }
}

.btn-recharge-pill i {
    font-size: 0.9em;
}

/* 废弃 .btn-mini-add 样式，但保留以防其他地方使用（如果是唯一使用处则可删除，这里先保留） */
.btn-mini-add {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.btn-mini-add:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
}

/* Secondary Info Bar - 简化版 */
.secondary-info-bar {
    background: transparent;
    padding: 0;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    box-shadow: none;
    margin-bottom: 3rem;
}

.info-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    background: white;
    padding: 0.4rem 0.85rem;
    border-radius: 2rem;
    border: 1px solid transparent; /* 去掉边框 */
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

.info-item i {
    color: var(--secondary); /* 灰色图标 */
    font-size: 0.9rem;
}

.info-item strong {
    color: var(--text-main);
    font-weight: 600;
}

.btn-refresh {
    background: white;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-refresh:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Content Cards (Common Style) */
.content-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 0; /* Padding handled by children */
    border: 1px solid var(--border-color);
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.content-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

.card-gradient-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, #a855f7 100%);
    opacity: 0.8;
}

.card-gradient-line.gray {
    background: linear-gradient(90deg, #cbd5e1 0%, #e2e8f0 100%);
}

.card-header-simple {
    padding: 2rem 2.5rem 1.5rem;
}

.card-header-flex {
    padding: 2rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--bg-page);
}

.card-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-subtitle {
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.icon-primary { color: var(--primary); }
.icon-gray { color: var(--text-muted); }

.badge-warning {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--warning-soft);
    color: var(--warning-text);
    padding: 2px 10px;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.75rem;
}

.link-primary {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.2s;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

.link-primary:hover {
    background: var(--primary-soft);
    color: var(--primary-hover);
    text-decoration: none;
}

/* API Key Section Specifics */
.apikey-input-container {
    padding: 1.5rem 2.5rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.apikey-input-container .input-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    z-index: 2;
    pointer-events: none;
}

.form-input {
    flex: 1;
    border: 1px solid var(--border-color);
    background: var(--bg-page);
    padding: 1rem 1rem 1rem 3rem; /* Left padding for icon */
    font-size: 1.1rem;
    color: var(--text-main);
    border-radius: var(--radius-lg);
    transition: all 0.2s;
    width: 100%;
    letter-spacing: 0.05em;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
    background: white;
}

.code-font {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Soft Button Styles */
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.2);
}
.btn-primary:hover { 
    background: var(--primary-hover); 
    transform: translateY(-1px);
    box-shadow: 0 6px 10px -1px rgba(99, 102, 241, 0.3);
}

.btn-success {
    background: var(--success-soft);
    color: var(--success-text);
    border: 1px solid transparent;
}
.btn-success:hover { 
    background: #a7f3d0; 
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger-text);
    border: 1px solid transparent;
}
.btn-danger:hover { 
    background: #fecdd3; 
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-page);
    color: var(--text-main);
}

.btn-disabled {
    background: var(--bg-input);
    color: #94a3b8;
    cursor: not-allowed;
}

/* Chart Container */
.chart-container {
    width: 100%;
    height: 400px; /* 增加高度 */
    padding: 1rem 2rem 2rem;
}

/* Config Section Specifics */
.config-container {
    padding: 0 2.5rem 2.5rem;
    background: transparent;
}

.config-input-group {
    margin-bottom: 1.5rem;
}

.config-input-group .form-label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.input-wrapper-simple {
    display: flex;
    align-items: center;
    position: relative;
}

.input-wrapper-simple .form-input {
    padding-left: 1rem; /* Reset padding */
    background: white;
}

.input-status {
    position: absolute;
    right: 1rem;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.config-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* 响应式适配 */
@media (min-width: 768px) {
    .apikey-input-container {
        flex-direction: row;
        align-items: center;
    }
    
    .apikey-input-container .input-wrapper {
        flex: 1;
    }
    
    .config-container {
        display: flex;
        align-items: flex-end;
        gap: 2rem;
    }
    
    .config-input-group {
        flex: 1;
        margin-bottom: 0;
    }
    
    .config-actions {
        padding-bottom: 0; /* Align with input */
    }
}

@media (max-width: 768px) {
    .page-title {
        font-size: 2rem;
    }
    
    .tabs {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        flex-wrap: nowrap; /* Scrollable on mobile */
    }
    
    .tab {
        flex: none;
        text-align: center;
    }
    
    .card-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .stat-card {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    
    .stat-content {
        height: auto;
    }
    
    .card-action {
        position: relative;
        top: 0;
        right: 0;
        transform: none;
        margin-top: 1rem;
        align-self: flex-start; /* 左对齐 */
        width: 100%; /* 满宽按钮 */
    }
    
    .btn-recharge-pill {
        justify-content: center;
        width: 100%;
    }
    
    .info-item, .btn-refresh {
        width: 100%;
        justify-content: center;
    }
}
