mcq-test / frontend /src /index.css
trung.le
feat: Add UserDashboard page and foundational global styling with theme support.
7959e3a
Raw
History Blame Contribute Delete
13.6 kB
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
:root {
/* Glass Effects */
--glass-bg: rgba(255, 255, 255, 0.85);
--glass-border: rgba(255, 255, 255, 0.3);
--glass-blur: blur(20px);
/* Colors */
--primary: #6366f1;
--primary-light: #818cf8;
--primary-dark: #4f46e5;
--secondary: #ec4899;
--accent: #06b6d4;
/* Text */
--text: #1e293b;
--text-secondary: #64748b;
--text-muted: #94a3b8;
/* Backgrounds */
--bg-base: #f1f5f9;
--bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
--card-bg: rgba(255, 255, 255, 0.9);
/* Shadows */
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
/* Spacing */
--radius-sm: 8px;
--radius-md: 12px;
--radius-lg: 16px;
--radius-xl: 24px;
}
[data-theme='dark'] {
--glass-bg: rgba(30, 41, 59, 0.9);
--glass-border: rgba(255, 255, 255, 0.1);
--text: #f1f5f9;
--text-secondary: #cbd5e1;
--text-muted: #94a3b8;
--bg-base: #0f172a;
--bg-gradient: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
--card-bg: rgba(30, 41, 59, 0.95);
}
[data-palette='pastel-blue'] {
--primary: #3b82f6;
--primary-light: #60a5fa;
--primary-dark: #2563eb;
--bg-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
}
[data-palette='pastel-green'] {
--primary: #10b981;
--primary-light: #34d399;
--primary-dark: #059669;
--bg-gradient: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
}
[data-palette='pastel-purple'] {
--primary: #8b5cf6;
--primary-light: #a78bfa;
--primary-dark: #7c3aed;
--bg-gradient: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
}
/* Reset & Base */
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 16px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
min-height: 100vh;
background: var(--bg-gradient);
background-attachment: fixed;
color: var(--text);
line-height: 1.6;
}
/* Typography */
h1 {
font-size: 2rem;
font-weight: 800;
letter-spacing: -0.025em;
}
h2 {
font-size: 1.5rem;
font-weight: 700;
letter-spacing: -0.02em;
}
h3 {
font-size: 1.25rem;
font-weight: 600;
}
h4 {
font-size: 1rem;
font-weight: 600;
}
/* Glass Container */
.glass-container {
background: var(--glass-bg);
backdrop-filter: var(--glass-blur);
-webkit-backdrop-filter: var(--glass-blur);
border: 1px solid var(--glass-border);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-lg);
}
/* Cards */
.card {
background: var(--card-bg);
backdrop-filter: var(--glass-blur);
-webkit-backdrop-filter: var(--glass-blur);
border: 1px solid var(--glass-border);
padding: 1.5rem;
border-radius: var(--radius-lg);
box-shadow: var(--shadow-md);
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
box-shadow: var(--shadow-xl);
}
/* Buttons */
button {
cursor: pointer;
border: none;
border-radius: var(--radius-md);
padding: 0.75rem 1.5rem;
font-family: inherit;
font-size: 0.875rem;
font-weight: 600;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
background: transparent;
color: var(--text);
}
button.primary {
background: var(--primary);
color: white;
box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}
button.primary:hover {
background: var(--primary-dark);
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}
button.secondary {
background: var(--glass-bg);
border: 1px solid var(--glass-border);
}
button.secondary:hover {
background: rgba(99, 102, 241, 0.1);
}
button.danger {
color: #ef4444;
}
button.danger:hover {
background: rgba(239, 68, 68, 0.1);
}
/* Inputs */
input,
select,
textarea {
width: 100%;
padding: 0.875rem 1rem;
font-family: inherit;
font-size: 0.9375rem;
background: var(--glass-bg);
border: 2px solid transparent;
border-radius: var(--radius-md);
color: var(--text);
transition: all 0.2s ease;
outline: none;
}
input:focus,
select:focus,
textarea:focus {
border-color: var(--primary);
box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
input::placeholder {
color: var(--text-muted);
}
input[type="file"] {
padding: 0.5rem;
}
input[type="radio"] {
width: auto;
margin: 0;
accent-color: var(--primary);
cursor: pointer;
}
/* Layout Utilities */
.flex {
display: flex;
}
.flex-col {
flex-direction: column;
}
.flex-wrap {
flex-wrap: wrap;
}
.items-center {
align-items: center;
}
.items-start {
align-items: flex-start;
}
.justify-center {
justify-content: center;
}
.justify-between {
justify-content: space-between;
}
.justify-end {
justify-content: flex-end;
}
.gap-1 {
gap: 0.25rem;
}
.gap-2 {
gap: 0.5rem;
}
.gap-3 {
gap: 0.75rem;
}
.gap-4 {
gap: 1rem;
}
.gap-6 {
gap: 1.5rem;
}
.gap-8 {
gap: 2rem;
}
.p-2 {
padding: 0.5rem;
}
.p-3 {
padding: 0.75rem;
}
.p-4 {
padding: 1rem;
}
.p-6 {
padding: 1.5rem;
}
.p-8 {
padding: 2rem;
}
.m-0 {
margin: 0;
}
.mt-2 {
margin-top: 0.5rem;
}
.mt-4 {
margin-top: 1rem;
}
.mt-6 {
margin-top: 1.5rem;
}
.mb-2 {
margin-bottom: 0.5rem;
}
.mb-4 {
margin-bottom: 1rem;
}
.mb-6 {
margin-bottom: 1.5rem;
}
.w-full {
width: 100%;
}
.max-w-md {
max-width: 28rem;
}
.max-w-lg {
max-width: 32rem;
}
.max-w-xl {
max-width: 36rem;
}
.max-w-2xl {
max-width: 42rem;
}
.max-w-4xl {
max-width: 56rem;
}
.mx-auto {
margin-left: auto;
margin-right: auto;
}
.text-center {
text-align: center;
}
.text-sm {
font-size: 0.875rem;
}
.text-xs {
font-size: 0.75rem;
}
.text-muted {
color: var(--text-muted);
}
.text-secondary {
color: var(--text-secondary);
}
.font-medium {
font-weight: 500;
}
.font-semibold {
font-weight: 600;
}
.font-bold {
font-weight: 700;
}
/* Header */
.app-header {
position: sticky;
top: 0;
z-index: 100;
margin: 1rem;
padding: 0.875rem 1.5rem;
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
}
.header-brand {
display: flex;
align-items: center;
gap: 0.75rem;
}
.header-logo {
width: 40px;
height: 40px;
background: var(--primary);
border-radius: var(--radius-md);
display: flex;
align-items: center;
justify-content: center;
color: white;
}
.header-title {
font-size: 1.25rem;
font-weight: 700;
background: var(--bg-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.header-nav {
display: flex;
align-items: center;
gap: 0.5rem;
}
.header-actions {
display: flex;
align-items: center;
gap: 1rem;
}
/* Navigation Links */
.nav-link {
text-decoration: none;
color: var(--text-secondary);
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.625rem 1rem;
border-radius: var(--radius-md);
font-weight: 500;
font-size: 0.9375rem;
transition: all 0.2s ease;
}
.nav-link:hover {
color: var(--text);
background: rgba(99, 102, 241, 0.1);
}
.nav-link.active {
background: var(--primary);
color: white;
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
/* Main Content */
.main-content {
padding: 1rem 1.5rem 2rem;
max-width: 1200px;
margin: 0 auto;
}
/* Page Container */
.page-container {
padding: 1.5rem;
}
/* Question Card */
.question-card {
background: var(--card-bg);
border-radius: var(--radius-lg);
padding: 1.5rem;
margin-bottom: 1rem;
border: 1px solid var(--glass-border);
box-shadow: var(--shadow-sm);
}
.question-number {
display: inline-flex;
align-items: center;
justify-content: center;
width: 2rem;
min-width: 2rem;
height: 2rem;
background: var(--primary);
color: white;
font-weight: 700;
font-size: 0.875rem;
border-radius: 50%;
margin-right: 0.75rem;
flex-shrink: 0;
}
.question-text {
font-weight: 600;
font-size: 1.0625rem;
color: var(--text);
margin-bottom: 1rem;
display: flex;
align-items: flex-start;
}
/* Options */
.options-list {
display: flex;
flex-direction: column;
gap: 0.625rem;
}
.option-item {
display: flex;
align-items: center;
gap: 0.875rem;
padding: 0.875rem 1rem;
background: rgba(255, 255, 255, 0.5);
border: 2px solid transparent;
border-radius: var(--radius-md);
cursor: pointer;
transition: all 0.2s ease;
}
[data-theme='dark'] .option-item {
background: rgba(255, 255, 255, 0.05);
}
.option-item:hover {
background: rgba(99, 102, 241, 0.1);
border-color: var(--primary-light);
}
.option-item.selected {
background: rgba(99, 102, 241, 0.15);
border-color: var(--primary);
}
.option-item input[type="radio"] {
width: 1.125rem;
height: 1.125rem;
flex-shrink: 0;
}
.option-label {
font-size: 0.9375rem;
color: var(--text);
flex: 1;
}
/* Test Card Grid */
.test-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 1.5rem;
}
.test-card {
display: flex;
flex-direction: column;
height: 100%;
}
.test-card-icon {
width: 3.5rem;
height: 3.5rem;
background: linear-gradient(135deg, var(--primary-light), var(--primary));
border-radius: var(--radius-md);
display: flex;
align-items: center;
justify-content: center;
color: white;
margin-bottom: 1rem;
}
.test-card-content {
flex: 1;
}
.test-card h3 {
margin-bottom: 0.5rem;
}
.test-card p {
color: var(--text-secondary);
font-size: 0.9375rem;
}
/* Result Card */
.result-card {
text-align: center;
padding: 3rem 2rem;
}
.result-icon {
width: 5rem;
height: 5rem;
background: linear-gradient(135deg, var(--primary-light), var(--primary));
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
margin: 0 auto 1.5rem;
}
.result-score {
font-size: 3rem;
font-weight: 800;
background: var(--bg-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin: 1rem 0;
}
/* Tables */
.data-table {
width: 100%;
border-collapse: collapse;
text-align: left;
}
.data-table th {
padding: 1rem;
font-weight: 600;
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-muted);
border-bottom: 2px solid var(--glass-border);
}
.data-table td {
padding: 1rem;
border-bottom: 1px solid var(--glass-border);
font-size: 0.9375rem;
}
.data-table tr:last-child td {
border-bottom: none;
}
.data-table tr:hover td {
background: rgba(99, 102, 241, 0.05);
}
/* Badge */
.badge {
display: inline-flex;
align-items: center;
padding: 0.25rem 0.75rem;
font-size: 0.75rem;
font-weight: 600;
border-radius: 9999px;
}
.badge-admin {
background: rgba(99, 102, 241, 0.15);
color: var(--primary);
}
.badge-user {
background: rgba(16, 185, 129, 0.15);
color: #10b981;
}
/* Theme Settings Dropdown */
.theme-dropdown {
position: relative;
}
.theme-toggle-btn {
width: 2.5rem;
height: 2.5rem;
padding: 0;
border-radius: 50%;
background: var(--glass-bg);
border: 1px solid var(--glass-border);
}
.theme-menu {
position: absolute;
top: calc(100% + 0.5rem);
right: 0;
min-width: 200px;
padding: 0.75rem;
background: var(--card-bg);
border: 1px solid var(--glass-border);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-xl);
z-index: 50;
}
.theme-menu-section {
padding: 0.5rem 0;
}
.theme-menu-section+.theme-menu-section {
border-top: 1px solid var(--glass-border);
}
.theme-menu-label {
font-size: 0.6875rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-muted);
margin-bottom: 0.5rem;
}
.color-swatches {
display: flex;
gap: 0.5rem;
}
.color-swatch {
width: 1.75rem;
height: 1.75rem;
border-radius: 50%;
cursor: pointer;
border: 3px solid transparent;
transition: all 0.2s ease;
}
.color-swatch:hover {
transform: scale(1.1);
}
.color-swatch.active {
border-color: var(--text);
box-shadow: 0 0 0 2px var(--card-bg);
}
/* User Info */
.user-info {
display: flex;
align-items: center;
gap: 1rem;
}
.user-avatar {
width: 2.25rem;
height: 2.25rem;
background: var(--primary);
color: white;
font-weight: 700;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.875rem;
}
.user-name {
font-weight: 600;
font-size: 0.9375rem;
}
/* Loading */
.loading-container {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
}
.loading-spinner {
width: 3rem;
height: 3rem;
border: 3px solid var(--glass-border);
border-top-color: var(--primary);
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
/* Empty State */
.empty-state {
text-align: center;
padding: 4rem 2rem;
color: var(--text-muted);
}
.empty-state-icon {
width: 4rem;
height: 4rem;
margin: 0 auto 1rem;
opacity: 0.5;
}
/* Responsive */
@media (max-width: 768px) {
.app-header {
flex-wrap: wrap;
padding: 1rem;
}
.header-nav {
order: 3;
width: 100%;
justify-content: center;
margin-top: 0.5rem;
}
.test-grid {
grid-template-columns: 1fr;
}
.main-content {
padding: 1rem;
}
}