/* Manga Image Server Switcher - Frontend Styles */

/* Main Container */
.manga-server-switcher {
    background: #16151d;
    border: 1px solid #2f2f2f;
    border-radius: 8px;
    padding: 15px 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    z-index: 100;
}

.manga-server-switcher.floating {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 300px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Switcher Container */
.switcher-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Switcher Label */
.switcher-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #b8b8b8;
    font-size: 14px;
    font-weight: 500;
    min-width: 120px;
}

.switcher-label i {
    color: #366ad3;
    font-size: 16px;
}

/* Toggle Switch */
.switcher-toggle {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.toggle-input {
    display: none;
}

.toggle-label {
    display: block;
    position: relative;
    width: 200px;
    height: 40px;
    background: #2f2f2f;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #366ad3;
    overflow: hidden;
}

.toggle-label:hover {
    box-shadow: 0 0 10px rgba(54, 106, 211, 0.3);
}

/* Toggle Slider */
.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 96px;
    height: 32px;
    background: linear-gradient(135deg, #366ad3, #4a7bd6);
    border-radius: 16px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.toggle-input:checked + .toggle-label .toggle-slider {
    transform: translateX(96px);
}

/* Toggle Text */
.toggle-text-left,
.toggle-text-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #b8b8b8;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1;
    width: 96px;
    justify-content: center;
}

.toggle-text-left {
    left: 4px;
}

.toggle-text-right {
    right: 4px;
}

.toggle-input:not(:checked) + .toggle-label .toggle-text-left {
    color: #ffffff;
    z-index: 3;
}

.toggle-input:checked + .toggle-label .toggle-text-right {
    color: #ffffff;
    z-index: 3;
}

/* Status Indicator */
.switcher-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #b8b8b8;
    font-size: 13px;
    min-width: 140px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    transition: all 0.3s ease;
}

.status-indicator.connected {
    background: #46b450;
    box-shadow: 0 0 6px rgba(70, 180, 80, 0.5);
}

.status-indicator.connecting {
    background: #ffb900;
    animation: pulse 1.5s infinite;
}

.status-indicator.error {
    background: #dc3232;
    box-shadow: 0 0 6px rgba(220, 50, 50, 0.5);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-weight: 500;
}

/* Toast Notifications */
.manga-switcher-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #16151d;
    color: #b8b8b8;
    padding: 12px 20px;
    border-radius: 6px;
    border-left: 4px solid #366ad3;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    max-width: 300px;
}

.manga-switcher-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.manga-switcher-toast.success {
    border-left-color: #46b450;
}

.manga-switcher-toast.error {
    border-left-color: #dc3232;
}

.manga-switcher-toast.warning {
    border-left-color: #ffb900;
}

/* Responsive Design */
@media (max-width: 768px) {
    .manga-server-switcher {
        padding: 12px 15px;
        margin: 15px 0;
    }
    
    .switcher-container {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .switcher-label {
        justify-content: center;
        min-width: auto;
    }
    
    .switcher-toggle {
        min-width: auto;
    }
    
    .toggle-label {
        width: 100%;
        max-width: 250px;
        margin: 0 auto;
    }
    
    .switcher-status {
        justify-content: center;
        min-width: auto;
    }
    
    .manga-server-switcher.floating {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
        margin: 0;
    }
}

@media (max-width: 480px) {
    .toggle-label {
        width: 180px;
        height: 36px;
    }
    
    .toggle-slider {
        width: 86px;
        height: 28px;
    }
    
    .toggle-input:checked + .toggle-label .toggle-slider {
        transform: translateX(86px);
    }
    
    .toggle-text-left,
    .toggle-text-right {
        width: 86px;
        font-size: 11px;
    }
    
    .switcher-label,
    .status-text {
        font-size: 13px;
    }
}

/* Dark Theme Integration */
body.dark-theme .manga-server-switcher,
.dark .manga-server-switcher {
    background: #1a1a1a;
    border-color: #333;
}

body.dark-theme .toggle-label,
.dark .toggle-label {
    background: #333;
}

/* Light Theme Integration */
body.light-theme .manga-server-switcher,
.light .manga-server-switcher {
    background: #ffffff;
    border-color: #e0e0e0;
    color: #333;
}

body.light-theme .switcher-label,
body.light-theme .status-text,
.light .switcher-label,
.light .status-text {
    color: #555;
}

body.light-theme .toggle-label,
.light .toggle-label {
    background: #f5f5f5;
    border-color: #366ad3;
}

body.light-theme .toggle-text-left,
body.light-theme .toggle-text-right,
.light .toggle-text-left,
.light .toggle-text-right {
    color: #666;
}

/* Animation Enhancements */
.manga-server-switcher {
    animation: slideInFromTop 0.5s ease-out;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State */
.manga-server-switcher.loading {
    opacity: 0.7;
    pointer-events: none;
}

.manga-server-switcher.loading .toggle-label {
    cursor: not-allowed;
}

/* Focus States for Accessibility */
.toggle-input:focus + .toggle-label {
    outline: 2px solid #366ad3;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .manga-server-switcher {
        border-width: 2px;
    }
    
    .toggle-label {
        border-width: 3px;
    }
    
    .status-indicator.connected {
        background: #00ff00;
    }
    
    .status-indicator.error {
        background: #ff0000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .toggle-slider,
    .toggle-text-left,
    .toggle-text-right,
    .status-indicator,
    .manga-switcher-toast {
        transition: none;
    }
    
    .status-indicator.connecting {
        animation: none;
    }
    
    .manga-server-switcher {
        animation: none;
    }
}