/* ================================================================
   代理系统 - Proxy System
   包含：代理控制面板、代理状态、导航代理、代理结果标识
   ================================================================ */

/* ============= 代理状态横幅 ============= */
.proxy-status-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #3b82f6;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transition: all 0.3s ease;
}

.proxy-status-banner.disabled {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.proxy-status-banner .proxy-indicator {
  font-size: 1.5rem;
}

.proxy-status-banner .proxy-indicator.active {
  animation: pulse 2s infinite;
}

.proxy-status-banner span:not(.proxy-indicator) {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
  color: #1e40af;
}

.proxy-status-banner.disabled span:not(.proxy-indicator) {
  color: #64748b;
}

.proxy-status-banner button {
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.proxy-status-banner .btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.proxy-status-banner .btn-primary:hover {
  background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

/* ============= 代理控制面板 ============= */
.proxy-controls-panel {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.proxy-controls-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #1e40af);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.proxy-controls-panel.proxy-enabled::before {
  transform: scaleX(1);
}

.proxy-controls-panel.proxy-enabled {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.proxy-controls-panel.proxy-unhealthy {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

/* ============= 代理切换区域 ============= */
.proxy-toggle-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.proxy-toggle-btn {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.proxy-toggle-btn:hover {
  background: linear-gradient(135deg, #3730a3 0%, #312e81 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

.proxy-toggle-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.proxy-enabled .proxy-toggle-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.proxy-enabled .proxy-toggle-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.toggle-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  transition: all 0.3s ease;
}

.toggle-indicator.enabled {
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
  animation: pulse 2s infinite;
}

/* ============= 代理信息按钮 ============= */
.proxy-info-btn {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 6px;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.proxy-info-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  transform: scale(1.05);
}

/* ============= 代理帮助文本 ============= */
.proxy-help-text {
  flex: 1;
  min-width: 200px;
  color: #64748b;
  font-style: italic;
}

.proxy-enabled .proxy-help-text {
  color: #1e40af;
}

/* ============= 代理状态详情 ============= */
.proxy-status-details {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  color: #64748b;
  font-size: 0.85rem;
}

.proxy-enabled .proxy-status-details {
  border-top-color: rgba(59, 130, 246, 0.2);
  color: #1e40af;
}

/* ============= 代理健康警告 ============= */
.proxy-health-warning {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 6px;
  color: #92400e;
  font-size: 0.85rem;
}

.proxy-health-warning .warning-icon {
  font-size: 1rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% { transform: translateY(0); }
  40%, 43% { transform: translateY(-8px); }
  70% { transform: translateY(-4px); }
}

/* ============= 搜索结果代理样式 ============= */
.result-item.result-proxied {
  border-left: 4px solid #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}

.result-item.result-proxied .result-content::before {
  content: '🔒';
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  font-size: 0.8rem;
  opacity: 0.6;
}

/* ============= URL显示区域 ============= */
.result-urls {
  margin: 0.5rem 0;
}

.result-url {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0.25rem 0;
  word-break: break-all;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.result-url .url-label {
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.result-url.proxy-url {
  color: #3b82f6;
  font-weight: 500;
}

.result-url.proxy-url .url-label {
  color: #1e40af;
}

.result-url.original-url {
  color: #6b7280;
  font-size: 0.8rem;
}

/* ============= 访问按钮组 ============= */
.visit-buttons-group {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.visit-buttons-group .visit-btn.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
  color: white;
  font-weight: 600;
  min-width: 80px;
}

.visit-buttons-group .visit-btn.primary:hover {
  background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.visit-buttons-group .visit-btn.secondary {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
  border: 1px solid rgba(107, 114, 128, 0.2);
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  min-width: auto;
}

.visit-buttons-group .visit-btn.secondary:hover {
  background: rgba(107, 114, 128, 0.2);
  color: #374151;
}

/* ============= 状态标识 ============= */
.proxy-badge {
  background: #3b82f6;
  color: white;
  font-size: 0.7rem;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  margin-left: 0.25rem;
  font-weight: 600;
}

/* ============= 站点导航代理样式 ============= */
.site-item[href*="omnibox.pp.ua"] {
  border-left: 4px solid #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
}

.site-item[href*="omnibox.pp.ua"]::after {
  content: '🔒';
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.9rem;
  opacity: 0.6;
}

/* ============= 健康警告横幅 ============= */
.proxy-health-warning-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideInRight 0.3s ease-out;
  max-width: 300px;
}

.warning-content {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #92400e;
  font-size: 0.9rem;
}

.close-warning {
  background: none;
  border: none;
  color: #92400e;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.close-warning:hover {
  background: rgba(146, 64, 14, 0.1);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ============= 响应式设计 ============= */
@media (max-width: 768px) {
  .proxy-controls-panel,
  .proxy-status-banner {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
  }
  
  .proxy-toggle-section,
  .proxy-status-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  
  .proxy-toggle-btn,
  .proxy-status-banner button {
    justify-content: center;
    width: 100%;
  }
  
  .proxy-help-text {
    min-width: auto;
    text-align: center;
  }
  
  .visit-buttons-group {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .visit-buttons-group .visit-btn {
    width: 100%;
    justify-content: center;
  }
  
  .result-urls .result-url {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
  }
  
  .proxy-health-warning-toast {
    top: auto;
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .proxy-controls-panel,
  .proxy-status-banner {
    padding: 0.5rem 0.75rem;
  }
  
  .proxy-toggle-btn,
  .proxy-status-banner button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
  
  .proxy-status-details {
    font-size: 0.8rem;
  }
  
  .result-url {
    font-size: 0.8rem;
  }
}

/* ============= 深色主题适配 ============= */
[data-theme="dark"] .proxy-controls-panel {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #334155;
}

[data-theme="dark"] .proxy-controls-panel.proxy-enabled {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  border-color: #3b82f6;
}

[data-theme="dark"] .proxy-controls-panel.proxy-unhealthy {
  background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
  border-color: #f59e0b;
}

[data-theme="dark"] .proxy-status-banner {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  border-color: #3b82f6;
  color: #dbeafe;
}

[data-theme="dark"] .proxy-status-banner.disabled {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #334155;
}

[data-theme="dark"] .proxy-help-text {
  color: #94a3b8;
}

[data-theme="dark"] .proxy-enabled .proxy-help-text {
  color: #dbeafe;
}

[data-theme="dark"] .result-item.result-proxied {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 100%);
  border-left-color: #60a5fa;
}

[data-theme="dark"] .result-url {
  color: #94a3b8;
}

[data-theme="dark"] .result-url.proxy-url {
  color: #60a5fa;
}

[data-theme="dark"] .site-item[href*="omnibox.pp.ua"] {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 100%);
  border-left-color: #60a5fa;
}