/* 
Chat Mode Selector and Status Indicator CSS
Enhanced UI for bandwidth awareness and mode selection
*/

.chat-mode-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 20px;
    min-width: 280px;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateX(0);
}

.chat-mode-panel.minimized {
    transform: translateX(calc(100% - 60px));
    opacity: 0.5;
}

.chat-mode-panel.minimized:hover {
    transform: translateX(0);
    opacity: 1;
}

.chat-mode-panel .minimize-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
}

.chat-mode-panel .minimize-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

.chat-mode-panel.dark {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.mode-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.dark .mode-status-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.current-mode-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.mode-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.mode-icon.global-high {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.mode-icon.global-low {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: white;
}

.mode-icon.lan-high {
    background: linear-gradient(135deg, #007bff, #6610f2);
    color: white;
}

.mode-icon.lan-low {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
}

.mode-icon.offline {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
    color: white;
}

.bandwidth-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: #666;
}

.dark .bandwidth-indicator {
    color: #ccc;
}

.bandwidth-bars {
    display: flex;
    gap: 2px;
    align-items: end;
}

.bandwidth-bar {
    width: 3px;
    background: #ddd;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.dark .bandwidth-bar {
    background: #555;
}

.bandwidth-bar.active {
    background: #28a745;
}

.bandwidth-bar:nth-child(1) {
    height: 6px;
}

.bandwidth-bar:nth-child(2) {
    height: 10px;
}

.bandwidth-bar:nth-child(3) {
    height: 14px;
}

.bandwidth-bar:nth-child(4) {
    height: 18px;
}

.bandwidth-high .bandwidth-bar:nth-child(-n+4) {
    background: #28a745;
}

.bandwidth-medium .bandwidth-bar:nth-child(-n+3) {
    background: #ffc107;
}

.bandwidth-low .bandwidth-bar:nth-child(-n+2) {
    background: #dc3545;
}

.mode-selector {
    margin-top: 15px;
}

.mode-selector h4 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #333;
    font-weight: 600;
}

.dark .mode-selector h4 {
    color: #fff;
}

.mode-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mode-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.dark .mode-option {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.mode-option:hover {
    background: #f8f9fa;
    border-color: #007bff;
    transform: translateY(-1px);
}

.dark .mode-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mode-option.selected {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-color: #007bff;
}

.mode-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8f9fa;
}

.dark .mode-option.disabled {
    background: rgba(255, 255, 255, 0.02);
}

.mode-option.disabled:hover {
    transform: none;
    border-color: #e0e0e0;
}

.mode-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.mode-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.mode-description {
    font-size: 0.75rem;
    opacity: 0.8;
    line-height: 1.3;
}

.mode-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    margin-left: 10px;
}

.status-badge {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.recommended {
    background: #e7f5ff;
    color: #0056b3;
}

.dark .status-badge.recommended {
    background: rgba(0, 86, 179, 0.3);
    color: #66b3ff;
}

.status-badge.current {
    background: #d4edda;
    color: #155724;
}

.dark .status-badge.current {
    background: rgba(21, 87, 36, 0.3);
    color: #75b798;
}

.status-badge.auto {
    background: #fff3cd;
    color: #856404;
}

.dark .status-badge.auto {
    background: rgba(133, 100, 4, 0.3);
    color: #ffc107;
}

.auto-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    padding: 10px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.8rem;
}

.dark .auto-mode-toggle {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 20px;
    background: #ccc;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch.active {
    background: #007bff;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch.active::after {
    transform: translateX(20px);
}

.network-details {
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    font-size: 0.8rem;
}

.dark .network-details {
    background: rgba(255, 255, 255, 0.05);
}

.network-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.network-item:last-child {
    margin-bottom: 0;
}

.network-label {
    color: #666;
}

.dark .network-label {
    color: #ccc;
}

.network-value {
    font-weight: 600;
}

.mode-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 15px 20px;
    min-width: 280px;
    z-index: 1001;
    transform: translateX(320px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-left: 4px solid #007bff;
}

.mode-notification.show {
    transform: translateX(0);
}

.mode-notification.success {
    border-left-color: #28a745;
}

.mode-notification.warning {
    border-left-color: #ffc107;
}

.mode-notification.error {
    border-left-color: #dc3545;
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-body {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
}

.notification-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.notification-btn {
    padding: 4px 12px;
    border: 1px solid #007bff;
    background: white;
    color: #007bff;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.notification-btn:hover {
    background: #007bff;
    color: white;
}

.notification-btn.primary {
    background: #007bff;
    color: white;
}

.notification-btn.primary:hover {
    background: #0056b3;
}

/* Compact mode for mobile */
@media (max-width: 768px) {
    .chat-mode-panel {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }

    .mode-notification {
        top: 70px;
        right: 10px;
        left: 10px;
        min-width: auto;
        transform: translateY(-100px);
    }

    .mode-notification.show {
        transform: translateY(0);
    }

    .mode-options {
        max-height: 200px;
        overflow-y: auto;
    }
}

/* Animation for mode changes */
.mode-change-animation {
    animation: modeChange 0.6s ease-in-out;
}

@keyframes modeChange {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        background: #e3f2fd;
    }

    100% {
        transform: scale(1);
    }
}

/* Pulse animation for active mode */
.mode-icon.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 123, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
    }
}

/* Accessibility improvements */
.mode-option:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.toggle-switch:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mode-option {
        border-width: 2px;
    }

    .status-badge {
        border: 1px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .mode-option,
    .toggle-switch,
    .toggle-switch::after,
    .mode-notification {
        transition: none;
    }

    .mode-change-animation,
    .mode-icon.pulse {
        animation: none;
    }
}