dp / static /styles.css
caidaohz's picture
feat: add static file serving and enhance stats dashboard
7d69ad4
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1400px;
margin: 0 auto;
}
.header {
text-align: center;
color: white;
margin-bottom: 40px;
}
.header h1 {
font-size: 2.5rem;
margin-bottom: 10px;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.header p {
font-size: 1.1rem;
opacity: 0.9;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin-bottom: 40px;
}
.chart-section {
background: rgba(255, 255, 255, 0.95);
border-radius: 16px;
padding: 24px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
margin-bottom: 40px;
}
.chart-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
flex-wrap: wrap;
gap: 16px;
}
.chart-title {
font-size: 1.5rem;
color: #333;
font-weight: 600;
}
.time-tabs {
display: flex;
gap: 8px;
background: #f1f5f9;
padding: 4px;
border-radius: 12px;
}
.time-tab {
padding: 8px 16px;
border: none;
background: transparent;
border-radius: 8px;
cursor: pointer;
font-size: 0.9rem;
font-weight: 500;
color: #64748b;
transition: all 0.3s ease;
}
.time-tab.active {
background: #6366f1;
color: white;
box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.time-tab:hover:not(.active) {
background: #e2e8f0;
color: #334155;
}
.chart-container {
position: relative;
height: 400px;
margin-bottom: 20px;
}
.chart-grid {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 20px;
margin-bottom: 20px;
}
.stat-card {
background: rgba(255, 255, 255, 0.95);
border-radius: 16px;
padding: 24px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover {
transform: translateY(-5px);
box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
}
.stat-card h3 {
font-size: 1.2rem;
color: #333;
margin-bottom: 16px;
display: flex;
align-items: center;
gap: 8px;
}
.api-icon {
width: 24px;
height: 24px;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-weight: bold;
color: white;
}
.openai-icon {
background: #10a37f;
}
.gemini-icon {
background: #4285f4;
}
.claude-icon {
background: #d97706;
}
.xai-icon {
background: #000000;
}
.total-icon {
background: #6366f1;
}
.stat-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 0;
border-bottom: 1px solid #eee;
}
.stat-row:last-child {
border-bottom: none;
}
.stat-label {
color: #666;
font-size: 0.9rem;
}
.stat-value {
font-size: 1.1rem;
font-weight: 600;
color: #333;
}
.usage-guide {
background: rgba(255, 255, 255, 0.95);
border-radius: 16px;
padding: 32px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.usage-guide h2 {
color: #333;
margin-bottom: 20px;
font-size: 1.5rem;
}
.endpoint-list {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 12px;
margin: 20px 0;
}
.endpoint-item {
background: #f8f9fa;
padding: 16px;
border-radius: 8px;
border-left: 4px solid #6366f1;
transition: all 0.3s ease;
cursor: pointer;
}
.endpoint-item:hover {
background: #f1f5f9;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.endpoint-path {
font-weight: bold;
color: #6366f1;
margin-bottom: 4px;
font-family: 'Courier New', monospace;
}
.endpoint-url {
font-size: 0.8rem;
color: #666;
word-break: break-all;
font-family: 'Courier New', monospace;
}
.example-section {
margin-top: 24px;
padding-top: 24px;
border-top: 1px solid #eee;
}
.example-section h3 {
color: #333;
margin-bottom: 12px;
}
.code-block {
background: #1a1a1a;
color: #f8f8f2;
padding: 16px;
border-radius: 8px;
font-family: 'Courier New', monospace;
font-size: 0.9rem;
overflow-x: auto;
margin: 12px 0;
white-space: pre-wrap;
word-wrap: break-word;
line-height: 1.4;
}
.refresh-btn {
position: fixed;
bottom: 30px;
right: 30px;
background: #6366f1;
color: white;
border: none;
border-radius: 50px;
padding: 12px 24px;
font-size: 1rem;
cursor: pointer;
box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
transition: all 0.3s ease;
z-index: 1000;
}
.refresh-btn:hover {
background: #5855eb;
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}
.toast {
position: fixed;
top: 20px;
right: 20px;
background: #10b981;
color: white;
padding: 12px 20px;
border-radius: 8px;
font-size: 14px;
z-index: 1001;
opacity: 0;
transform: translateX(100%);
transition: all 0.3s ease;
}
.toast.show {
opacity: 1;
transform: translateX(0);
}
.chart-legend {
display: flex;
flex-direction: column;
gap: 10px;
margin-top: 16px;
padding-top: 16px;
border-top: 1px solid #e2e8f0;
}
.legend-item {
display: flex;
align-items: center;
gap: 8px;
font-size: 0.9rem;
}
.legend-color {
width: 12px;
height: 12px;
border-radius: 2px;
}
.legend-line {
width: 16px;
height: 3px;
border-radius: 2px;
}
.no-data {
text-align: center;
color: #64748b;
font-style: italic;
padding: 40px 0;
}
.chart-info {
background: #f8fafc;
padding: 12px 16px;
border-radius: 8px;
margin-bottom: 16px;
border-left: 4px solid #6366f1;
}
.chart-info p {
color: #64748b;
font-size: 0.9rem;
margin: 0;
}
@media (max-width: 768px) {
.stats-grid {
grid-template-columns: 1fr;
}
.endpoint-list {
grid-template-columns: 1fr;
}
.header h1 {
font-size: 2rem;
}
.chart-grid {
grid-template-columns: 1fr;
}
.chart-header {
flex-direction: column;
align-items: stretch;
}
.time-tabs {
justify-self: stretch;
}
}