/* 
 * Performance Optimizations CSS
 * Styles for lazy loading, low bandwidth mode, and other performance optimizations
 */

/* Lazy Loading Images */
.lazy-loading {
    filter: blur(5px);
    transition: filter 0.5s ease-in-out;
}

.lazy-loaded {
    filter: blur(0);
    transition: filter 0.5s ease-in-out;
}

/* Low Bandwidth Mode */
.low-bandwidth-mode {
    /* Reduce visual effects */
    --reduced-animation: 1;
}

/* In low bandwidth mode, disable animations */
.low-bandwidth-mode .animated,
.low-bandwidth-mode .fade-in,
.low-bandwidth-mode .float-animation,
.low-bandwidth-mode [class*="animate-"] {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
}

/* In low bandwidth mode, reduce shadows and effects */
.low-bandwidth-mode .card,
.low-bandwidth-mode .btn,
.low-bandwidth-mode .guru-response,
.low-bandwidth-mode [class*="shadow"] {
    box-shadow: none !important;
    text-shadow: none !important;
}

/* In low bandwidth mode, simplify backgrounds */
.low-bandwidth-mode .cosmic-background,
.low-bandwidth-mode [class*="gradient"],
.low-bandwidth-mode [id*="particle"],
.low-bandwidth-mode .star-background,
.low-bandwidth-mode body::before,
.low-bandwidth-mode body::after,
.low-bandwidth-mode .card::before,
.low-bandwidth-mode .card::after {
    opacity: 0 !important;
    background: none !important;
    display: none !important;
}

/* In low bandwidth mode, use solid colors over gradients */
.low-bandwidth-mode {
    background-color: #0a0e2a !important;
}

.low-bandwidth-mode .footer {
    background-color: rgba(5, 56, 107, 0.9) !important;
    border-top: 1px solid rgba(92, 219, 149, 0.3) !important;
}

.low-bandwidth-mode .card {
    background-color: #121b4a !important;
}

/* Low Bandwidth Mode Toggle Switch */
.low-bandwidth-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    margin-bottom: 10px;
    color: var(--text-light);
    font-size: 0.8rem;
}

.low-bandwidth-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 22px;
    margin-right: 8px;
}

.low-bandwidth-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.low-bandwidth-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .4s;
    border-radius: 22px;
}

.low-bandwidth-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .low-bandwidth-slider {
    background-color: var(--accent-color);
}

input:focus + .low-bandwidth-slider {
    box-shadow: 0 0 1px var(--accent-color);
}

input:checked + .low-bandwidth-slider:before {
    transform: translateX(22px);
}

.low-bandwidth-text {
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .low-bandwidth-toggle-container {
        flex-direction: row;
        align-items: center;
    }
}

/* High-contrast mode for very low bandwidth */
.low-bandwidth-mode.high-contrast {
    --text-color: #ffffff;
    --bg-color: #000000;
    --highlight-color: #ffcc00;
}

.low-bandwidth-mode.high-contrast .card,
.low-bandwidth-mode.high-contrast .navbar,
.low-bandwidth-mode.high-contrast .footer {
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
}

.low-bandwidth-mode.high-contrast .btn-primary,
.low-bandwidth-mode.high-contrast .btn-accent {
    background-color: var(--highlight-color) !important;
    color: var(--bg-color) !important;
    border: none !important;
}