/* W3.5 Activity 8: Caching System Styling */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Cache Controls */
.cache-controls {
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.control-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.cache-settings {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.cache-settings label {
    font-weight: 600;
    color: #555;
}

.cache-settings input {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    width: 80px;
    text-align: center;
    font-size: 14px;
}

.cache-settings input:focus {
    outline: none;
    border-color: #4CAF50;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-secondary {
    background: #2196F3;
    color: white;
}

.btn-accent {
    background: #FF9800;
    color: white;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    background: #666;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-small:hover {
    background: #555;
}

/* Status Dashboard */
.status-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.status-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.status-card h3 {
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.status-item .label {
    font-weight: 600;
    color: #666;
}

.status-item .value {
    font-weight: bold;
    color: #333;
    font-size: 1.1rem;
}

.performance-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.metric-label {
    font-weight: 600;
    color: #666;
}

.metric-value {
    font-weight: bold;
    color: #333;
}

/* Data Sections */
.data-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.data-section {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.data-section:hover {
    transform: translateY(-3px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.section-header h3 {
    margin: 0;
    color: #333;
}

.cache-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: #fff3cd;
    border-bottom: 1px solid #ffeaa7;
    font-size: 12px;
}

.cache-indicator.fresh {
    background: #d4edda;
    border-bottom-color: #c3e6cb;
}

.cache-indicator.cached {
    background: #cce7ff;
    border-bottom-color: #b3d9ff;
}

.cache-indicator.expired {
    background: #f8d7da;
    border-bottom-color: #f5c6cb;
}

.cache-status {
    font-weight: 600;
}

.cache-timestamp {
    font-style: italic;
    color: #666;
}

.data-content {
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.data-content .placeholder {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px 20px;
}

.data-grid {
    display: grid;
    gap: 10px;
}

.data-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
}

.data-item h4 {
    margin-bottom: 5px;
    color: #333;
}

.data-item p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Cache Visualization */
.cache-visualization {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.cache-visualization h3 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.cache-visualization h4 {
    margin-bottom: 10px;
    color: #555;
}

.keys-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    min-height: 40px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    align-items: center;
}

.cache-key {
    padding: 6px 12px;
    background: #4CAF50;
    color: white;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.cache-key:hover {
    background: #45a049;
}

.cache-key.expired {
    background: #f44336;
}

.cache-details pre {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.4;
    color: #555;
    max-height: 250px;
    overflow-y: auto;
}

/* Learning Notes */
.learning-notes {
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.learning-notes h3 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.note-card {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.note-card h4 {
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.note-card p {
    margin: 0;
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.9);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    color: #666;
    z-index: 10;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.data-item {
    animation: slideIn 0.3s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .control-group {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 200px;
    }

    .cache-settings {
        flex-direction: column;
        text-align: center;
    }

    .status-dashboard {
        grid-template-columns: 1fr;
    }

    .data-sections {
        grid-template-columns: 1fr;
    }

    .notes-grid {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cache-indicator {
        border-width: 2px;
    }

    .btn {
        border: 2px solid transparent;
    }

    .btn:focus {
        border-color: currentColor;
    }
}