.cache-demo {
max-width: 1400px;
margin: 0 auto;
padding: 20px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
}
.demo-header {
text-align: center;
margin-bottom: 30px;
padding: 20px;
background: white;
border-radius: 12px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
.demo-header h1 {
color: #2c3e50;
margin: 0 0 10px 0;
font-size: 2.5rem;
}
.demo-description {
color: #7f8c8d;
font-size: 1.1rem;
margin: 0 0 20px 0;
}
.cache-times-info {
display: flex;
justify-content: center;
gap: 15px;
flex-wrap: wrap;
}
.cache-badge {
padding: 8px 16px;
border-radius: 20px;
font-size: 0.9rem;
font-weight: 600;
color: white;
}
.cache-badge.quick {
background: #e74c3c;
}
.cache-badge.medium {
background: #f39c12;
}
.cache-badge.long {
background: #27ae60;
}
.cache-badge.user {
background: #9b59b6;
}
.demo-controls {
background: white;
padding: 20px;
border-radius: 12px;
margin-bottom: 20px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.demo-controls h3 {
margin: 0 0 15px 0;
color: #2c3e50;
}
.control-group {
display: flex;
gap: 10px;
margin-bottom: 15px;
flex-wrap: wrap;
}
.invalidate-btn {
padding: 10px 20px;
border: none;
border-radius: 8px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
font-size: 0.95rem;
color: white;
}
.invalidate-btn.quick {
background: #e74c3c;
}
.invalidate-btn.quick:hover {
background: #c0392b;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}
.invalidate-btn.medium {
background: #f39c12;
}
.invalidate-btn.medium:hover {
background: #d68910;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}
.invalidate-btn.long {
background: #27ae60;
}
.invalidate-btn.long:hover {
background: #229954;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}
.invalidate-btn.user {
background: #9b59b6;
}
.invalidate-btn.user:hover {
background: #8e44ad;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
}
.user-selector {
display: flex;
align-items: center;
gap: 10px;
}
.user-selector label {
font-weight: 600;
color: #2c3e50;
}
.user-selector input {
padding: 8px 12px;
border: 2px solid #bdc3c7;
border-radius: 6px;
font-size: 1rem;
width: 80px;
}
.user-selector input:focus {
outline: none;
border-color: #9b59b6;
}
.cache-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
gap: 20px;
margin-bottom: 20px;
}
.cache-card {
background: white;
border-radius: 12px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
overflow: hidden;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.cache-card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}
.cache-card.quick {
border-top: 4px solid #e74c3c;
}
.cache-card.medium {
border-top: 4px solid #f39c12;
}
.cache-card.long {
border-top: 4px solid #27ae60;
}
.cache-card.user {
border-top: 4px solid #9b59b6;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px 20px;
background: #f8f9fa;
border-bottom: 1px solid #ecf0f1;
}
.card-header h3 {
margin: 0;
color: #2c3e50;
font-size: 1.1rem;
}
.cache-status {
padding: 4px 12px;
border-radius: 20px;
font-size: 0.8rem;
font-weight: 600;
}
.cache-status.cache-hit {
background: #2ecc71;
color: white;
}
.cache-status.cache-miss {
background: #f39c12;
color: white;
animation: pulse 1.5s infinite;
}
.cache-status.cache-error {
background: #e74c3c;
color: white;
}
@keyframes pulse {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.7;
}
}
.card-content {
padding: 20px;
}
.data-content h4 {
margin: 0 0 15px 0;
color: #2c3e50;
}
.details-list {
margin: 10px 0;
padding-left: 20px;
}
.details-list li {
margin: 5px 0;
color: #7f8c8d;
}
.metadata {
background: #f8f9fa;
padding: 10px;
border-radius: 6px;
margin: 10px 0;
}
.metadata p {
margin: 5px 0;
color: #7f8c8d;
font-size: 0.9rem;
}
.user-preferences {
background: #f8f9fa;
padding: 10px;
border-radius: 6px;
margin: 10px 0;
}
.user-preferences h5 {
margin: 0 0 8px 0;
color: #2c3e50;
}
.user-preferences p {
margin: 3px 0;
color: #7f8c8d;
font-size: 0.9rem;
}
.activity {
color: #7f8c8d;
font-style: italic;
margin: 10px 0;
}
.last-login {
color: #95a5a6;
font-size: 0.9rem;
margin: 5px 0;
}
.cache-timing {
background: #ecf0f1;
padding: 10px;
border-radius: 6px;
margin-top: 15px;
}
.cache-timing p {
margin: 3px 0;
font-size: 0.85rem;
}
.fetched-time {
color: #7f8c8d;
}
.cache-age {
color: #3498db;
}
.expires-in {
color: #27ae60;
font-weight: 600;
}
.expired {
color: #e74c3c;
font-weight: 600;
animation: blink 1s infinite;
}
@keyframes blink {
0%,
50% {
opacity: 1;
}
51%,
100% {
opacity: 0.5;
}
}
.loading-container {
display: flex;
align-items: center;
gap: 10px;
padding: 20px;
justify-content: center;
}
.loading-spinner {
width: 20px;
height: 20px;
border: 2px solid #ecf0f1;
border-top: 2px solid #f39c12;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.error-container {
display: flex;
align-items: center;
gap: 10px;
padding: 15px;
background: #fdf2f2;
border: 1px solid #fecaca;
border-radius: 8px;
color: #dc2626;
}
.error-icon {
font-size: 1.2rem;
}
.behavior-explanation {
background: white;
padding: 20px;
border-radius: 12px;
margin-bottom: 20px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.behavior-explanation h3 {
margin: 0 0 20px 0;
color: #2c3e50;
text-align: center;
}
.comparison-table {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 1px;
background: #bdc3c7;
border-radius: 8px;
overflow: hidden;
}
.comparison-row {
display: contents;
}
.comparison-row>div {
background: white;
padding: 12px;
text-align: center;
}
.comparison-row.header>div {
background: #34495e;
color: white;
font-weight: 600;
}
.comparison-row:not(.header)>div:first-child {
background: #ecf0f1;
font-weight: 600;
color: #2c3e50;
}
.demo-footer {
background: white;
padding: 15px;
border-radius: 12px;
text-align: center;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.instructions {
margin: 0;
color: #7f8c8d;
font-style: italic;
}
@media (max-width: 768px) {
.cache-grid {
grid-template-columns: 1fr;
}
.control-group {
flex-direction: column;
}
.cache-times-info {
flex-direction: column;
align-items: center;
}
.comparison-table {
font-size: 0.9rem;
}
}