prompt-analyser/frontend/styles.css

695 lines
16 KiB
CSS

/* ── Design System ──────────────────────────────────────────── */
:root {
--bg-primary: #0a0e1a;
--bg-secondary: #111827;
--bg-card: #1a2235;
--bg-card-hover: #1e2840;
--bg-input: #0f1629;
--border: #2a3452;
--border-hover: #3b4a70;
--text-primary: #f1f5f9;
--text-secondary:#8899b4;
--text-muted: #5a6a85;
--accent-blue: #3b82f6;
--accent-purple: #8b5cf6;
--accent-green: #10b981;
--accent-red: #ef4444;
--accent-amber: #f59e0b;
--accent-cyan: #06b6d4;
--font-sans: 'Inter', -apple-system, sans-serif;
--font-mono: 'JetBrains Mono', monospace;
--radius-sm: 6px;
--radius-md: 10px;
--radius-lg: 16px;
--radius-xl: 20px;
--shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
--shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
}
/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: var(--font-sans);
background: var(--bg-primary);
color: var(--text-primary);
min-height: 100vh;
-webkit-font-smoothing: antialiased;
line-height: 1.6;
}
/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
/* ── Header ────────────────────────────────────────────────── */
.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 32px;
border-bottom: 1px solid var(--border);
background: var(--bg-secondary);
position: sticky;
top: 0;
z-index: 50;
backdrop-filter: blur(12px);
}
.header-brand {
display: flex;
align-items: center;
gap: 12px;
}
.brand-icon {
width: 40px;
height: 40px;
border-radius: var(--radius-md);
background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
display: flex;
align-items: center;
justify-content: center;
color: white;
}
.brand-title {
font-size: 18px;
font-weight: 700;
letter-spacing: 0.5px;
}
.brand-version {
font-size: 11px;
color: var(--text-muted);
font-weight: 500;
}
.header-actions {
display: flex;
gap: 8px;
}
/* ── Main Content ──────────────────────────────────────────── */
.main-content {
max-width: 1100px;
margin: 0 auto;
padding: 32px 24px 64px;
}
/* ── Cards ─────────────────────────────────────────────────── */
.input-card, .mistakes-card, .rewrite-card, .loading-card, .error-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 28px;
box-shadow: var(--shadow-card);
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;
}
.card-header h2 {
display: flex;
align-items: center;
gap: 10px;
font-size: 18px;
font-weight: 600;
}
.card-header h2 .material-symbols-outlined {
font-size: 22px;
color: var(--accent-blue);
}
/* ── Input Section ─────────────────────────────────────────── */
.input-fields {
display: flex;
flex-direction: column;
gap: 16px;
}
.field-group {
display: flex;
flex-direction: column;
gap: 6px;
}
.field-group label {
font-size: 13px;
font-weight: 600;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.optional {
font-weight: 400;
text-transform: none;
color: var(--text-muted);
}
.field-row {
display: flex;
gap: 16px;
}
.flex-1 { flex: 1; }
textarea, input[type="text"] {
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: 14px 16px;
font-family: var(--font-mono);
font-size: 14px;
color: var(--text-primary);
resize: vertical;
transition: border-color 0.2s, box-shadow 0.2s;
outline: none;
width: 100%;
}
textarea:focus, input[type="text"]:focus {
border-color: var(--accent-blue);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
textarea::placeholder, input::placeholder {
color: var(--text-muted);
}
.field-footer {
display: flex;
justify-content: flex-end;
}
.char-count {
font-size: 12px;
color: var(--text-muted);
font-family: var(--font-mono);
}
/* ── Buttons ───────────────────────────────────────────────── */
.btn {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 20px;
font-size: 14px;
font-weight: 600;
font-family: var(--font-sans);
border-radius: var(--radius-md);
border: none;
cursor: pointer;
transition: all 0.2s;
text-decoration: none;
}
.btn .material-symbols-outlined { font-size: 18px; }
.btn-primary {
background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
color: white;
box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
transform: translateY(-1px);
box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}
.btn-primary:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none;
}
.btn-lg {
padding: 14px 28px;
font-size: 15px;
}
.btn-success {
background: var(--accent-green);
color: white;
}
.btn-success:hover {
background: #0d9668;
transform: translateY(-1px);
}
.btn-outline {
background: transparent;
color: var(--text-secondary);
border: 1px solid var(--border);
}
.btn-outline:hover {
border-color: var(--text-secondary);
color: var(--text-primary);
}
.btn-ghost {
background: transparent;
color: var(--text-secondary);
padding: 8px 16px;
}
.btn-ghost:hover {
background: var(--bg-card);
color: var(--text-primary);
}
/* ── Badges ────────────────────────────────────────────────── */
.badge {
font-size: 12px;
font-weight: 600;
padding: 4px 10px;
border-radius: 999px;
}
.badge-info {
background: rgba(59, 130, 246, 0.15);
color: var(--accent-blue);
}
.badge-error {
background: rgba(239, 68, 68, 0.15);
color: var(--accent-red);
}
.badge-success {
background: rgba(16, 185, 129, 0.15);
color: var(--accent-green);
}
/* ── Loading ───────────────────────────────────────────────── */
.loading-section { margin-top: 32px; }
.loading-card {
text-align: center;
padding: 48px;
}
.spinner {
width: 48px;
height: 48px;
border: 3px solid var(--border);
border-top-color: var(--accent-blue);
border-radius: 50%;
margin: 0 auto 20px;
animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-sub {
font-size: 13px;
color: var(--text-muted);
margin-top: 6px;
}
/* ── Overall Score ─────────────────────────────────────────── */
.overall-score-card {
display: flex;
align-items: center;
gap: 24px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 28px 32px;
margin-top: 32px;
box-shadow: var(--shadow-card);
}
.overall-score-ring {
position: relative;
width: 100px;
height: 100px;
flex-shrink: 0;
}
.overall-score-ring svg {
width: 100%;
height: 100%;
transform: rotate(-90deg);
}
.score-ring-bg {
fill: none;
stroke: var(--border);
stroke-width: 8;
}
.score-ring-fill {
fill: none;
stroke: var(--accent-blue);
stroke-width: 8;
stroke-linecap: round;
stroke-dasharray: 327;
stroke-dashoffset: 327;
transition: stroke-dashoffset 1.5s ease-out, stroke 0.5s;
}
.overall-score-value {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 28px;
font-weight: 800;
}
.overall-score-info h2 {
font-size: 20px;
font-weight: 700;
}
.score-label {
font-size: 14px;
color: var(--text-secondary);
margin-top: 4px;
}
/* Score colors */
.score-excellent .score-ring-fill { stroke: var(--accent-green); }
.score-good .score-ring-fill { stroke: var(--accent-blue); }
.score-fair .score-ring-fill { stroke: var(--accent-amber); }
.score-poor .score-ring-fill { stroke: var(--accent-red); }
.score-excellent .overall-score-value { color: var(--accent-green); }
.score-good .overall-score-value { color: var(--accent-blue); }
.score-fair .overall-score-value { color: var(--accent-amber); }
.score-poor .overall-score-value { color: var(--accent-red); }
/* ── Score Cards Grid ──────────────────────────────────────── */
.scores-grid {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 16px;
margin-top: 24px;
}
.score-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 20px;
transition: border-color 0.2s, transform 0.2s;
box-shadow: var(--shadow-card);
}
.score-card:hover {
border-color: var(--accent-blue);
transform: translateY(-2px);
}
.score-card-header {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 12px;
}
.score-card-header .material-symbols-outlined {
font-size: 20px;
color: var(--accent-blue);
}
.score-card-header h3 {
font-size: 13px;
font-weight: 600;
color: var(--text-secondary);
}
.score-value-wrap {
display: flex;
align-items: baseline;
gap: 2px;
margin-bottom: 10px;
}
.score-num {
font-size: 32px;
font-weight: 800;
line-height: 1;
}
.score-max {
font-size: 14px;
color: var(--text-muted);
font-weight: 500;
}
.score-reasoning {
font-size: 12px;
color: var(--text-secondary);
line-height: 1.5;
}
/* ── Mistakes ──────────────────────────────────────────────── */
.mistakes-card { margin-top: 24px; }
.mistakes-list {
display: flex;
flex-direction: column;
gap: 12px;
}
.mistake-item {
display: flex;
gap: 14px;
padding: 16px;
background: var(--bg-input);
border-radius: var(--radius-md);
border-left: 3px solid var(--accent-red);
}
.mistake-icon {
flex-shrink: 0;
width: 32px;
height: 32px;
border-radius: var(--radius-sm);
background: rgba(239, 68, 68, 0.1);
display: flex;
align-items: center;
justify-content: center;
}
.mistake-icon .material-symbols-outlined {
font-size: 18px;
color: var(--accent-red);
}
.mistake-content { flex: 1; }
.mistake-type {
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
color: var(--accent-red);
margin-bottom: 4px;
}
.mistake-text {
font-size: 13px;
color: var(--text-primary);
font-family: var(--font-mono);
background: rgba(239, 68, 68, 0.08);
padding: 4px 8px;
border-radius: 4px;
display: inline-block;
margin-bottom: 6px;
}
.mistake-suggestion {
font-size: 13px;
color: var(--accent-green);
}
.mistake-suggestion::before {
content: "💡 ";
}
/* ── Rewrite Comparison ────────────────────────────────────── */
.rewrite-card { margin-top: 24px; }
.token-savings {
display: flex;
align-items: center;
gap: 6px;
font-size: 14px;
font-weight: 600;
color: var(--accent-green);
}
.token-savings .material-symbols-outlined { font-size: 18px; }
.comparison-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
margin-bottom: 20px;
}
.comparison-label {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
font-weight: 600;
color: var(--text-secondary);
margin-bottom: 10px;
}
.dot {
width: 8px;
height: 8px;
border-radius: 50%;
}
.dot-red { background: var(--accent-red); }
.dot-green { background: var(--accent-green); }
.token-badge {
font-size: 11px;
font-weight: 500;
background: var(--bg-input);
padding: 2px 8px;
border-radius: 999px;
color: var(--text-muted);
margin-left: auto;
}
.comparison-text {
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: 16px;
font-family: var(--font-mono);
font-size: 13px;
line-height: 1.7;
white-space: pre-wrap;
word-break: break-word;
max-height: 300px;
overflow-y: auto;
color: var(--text-primary);
}
.rewrite-actions {
display: flex;
gap: 12px;
}
/* ── Error ─────────────────────────────────────────────────── */
.error-section { margin-top: 32px; }
.error-card {
text-align: center;
padding: 40px;
}
.error-card .material-symbols-outlined {
font-size: 48px;
color: var(--accent-red);
margin-bottom: 12px;
}
.error-card h3 {
font-size: 18px;
margin-bottom: 8px;
}
.error-card p {
color: var(--text-secondary);
font-size: 14px;
margin-bottom: 20px;
}
/* ── Toast ─────────────────────────────────────────────────── */
.toast {
position: fixed;
bottom: 32px;
right: 32px;
display: flex;
align-items: center;
gap: 10px;
padding: 14px 20px;
background: var(--bg-card);
border: 1px solid var(--accent-green);
border-radius: var(--radius-md);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
font-size: 14px;
font-weight: 500;
z-index: 100;
animation: toastIn 0.3s ease-out;
}
.toast .material-symbols-outlined {
color: var(--accent-green);
}
@keyframes toastIn {
from { transform: translateY(20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
/* ── Utilities ─────────────────────────────────────────────── */
.hidden { display: none !important; }
.results-section { animation: fadeIn 0.4s ease-out; }
@keyframes fadeIn {
from { opacity: 0; transform: translateY(12px); }
to { opacity: 1; transform: translateY(0); }
}
/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
.scores-grid {
grid-template-columns: repeat(3, 1fr);
}
}
@media (max-width: 680px) {
.header { padding: 12px 16px; }
.main-content { padding: 16px 12px 48px; }
.scores-grid { grid-template-columns: repeat(2, 1fr); }
.comparison-grid { grid-template-columns: 1fr; }
.field-row { flex-direction: column; }
.overall-score-card { flex-direction: column; text-align: center; }
.rewrite-actions { flex-direction: column; }
}