/* 
 * A2A 协议网站样式文件
 * 
 * 设计风格：科技感与现代感
 * 主色调：科技蓝（创新）和中性灰（专业）
 * 强调色：橙色和绿色，用于高亮重要元素
 */

:root {
  /* 浅色模式变量 */
  --primary-blue: #2563eb;
  --primary-blue-dark: #1d4ed8;
  --primary-blue-light: #60a5fa;
  --neutral-gray: #4b5563;
  --neutral-gray-light: #9ca3af;
  --accent-orange: #f97316;
  --accent-green: #10b981;
  --bg-color: #ffffff;
  --text-color: #1f2937;
  --card-bg: #f9fafb;
  --border-color: #e5e7eb;
  --code-bg: #f1f5f9;
  --link-color: #2563eb;
  --link-hover: #1d4ed8;
}

/* 暗色模式变量 */
[data-theme="dark"] {
  --primary-blue: #60a5fa;
  --primary-blue-dark: #3b82f6;
  --primary-blue-light: #93c5fd;
  --neutral-gray: #9ca3af;
  --neutral-gray-light: #6b7280;
  --accent-orange: #fb923c;
  --accent-green: #34d399;
  --bg-color: #111827;
  --text-color: #f3f4f6;
  --card-bg: #1f2937;
  --border-color: #374151;
  --code-bg: #1e293b;
  --link-color: #60a5fa;
  --link-hover: #93c5fd;
}

/* 全局样式 */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease;
  scroll-behavior: smooth;
}

/* 网格图案背景 */
.pattern-grid {
  background-image: 
    linear-gradient(var(--border-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* 动画效果 */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.animate-pulse {
  animation: pulse 2s infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

/* 过渡效果 */
.transition-all {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms;
}

/* 卡片样式 */
.card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  transition: all 0.3s ease;
}

/* 链接样式 */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--link-hover);
}

/* 代码块样式 */
code {
  font-family: 'Fira Code', 'Cascadia Code', Consolas, Monaco, 'Andale Mono', monospace;
  background-color: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.9em;
  color: var(--text-color);
}

pre {
  background-color: var(--code-bg);
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

pre code {
  padding: 0;
  border-radius: 0;
}

/* 强制代码块样式 - 修复显示问题 */
.code-block {
  background-color: #1f2937 !important;
  color: #10b981 !important;
  padding: 1rem !important;
  border-radius: 0.5rem !important;
  font-family: 'Courier New', Consolas, Monaco, monospace !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  overflow-x: auto !important;
  border: none !important;
}

.code-block code {
  background-color: transparent !important;
  color: inherit !important;
  padding: 0 !important;
}

/* 卡片悬停效果 */
.card-hover {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.dark .card-hover:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* A2A 通信流程动画相关样式 */
.animation-container {
  position: relative;
  height: 300px;
}

.agent {
  transition: all 0.5s ease-in-out;
}

.message {
  position: absolute;
  background-color: #fff;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  max-width: 200px;
  transition: all 0.5s ease-in-out;
  opacity: 0;
}

.dark .message {
  background-color: #2d3748;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* 响应式调整 */
@media (max-width: 768px) {
  .animation-container {
    height: 200px;
  }
  
  .agent {
    width: 60px !important;
    height: 60px !important;
    font-size: 0.8rem;
  }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.dark ::-webkit-scrollbar-track {
  background: #1e293b;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #4b5563;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* 特殊文本样式 */
.highlight-text {
  background: linear-gradient(to right, var(--primary-blue), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

/* 按钮样式增强 */
.btn-primary {
  background-color: var(--primary-blue);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background-color: var(--primary-blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-outline {
  border: 2px solid var(--primary-blue);
  color: var(--primary-blue);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-outline:hover {
  background-color: var(--primary-blue);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 导航栏样式 */
.navbar {
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
}

.nav-item {
  color: var(--text-color);
  transition: color 0.3s ease;
}

.nav-item:hover {
  color: var(--primary-blue);
}

.nav-item-active {
  color: var(--primary-blue);
  border-bottom: 2px solid var(--primary-blue);
}

.dark .nav-item-active {
  color: var(--primary-blue-light);
  border-bottom: 2px solid var(--primary-blue-light);
}

/* 搜索框样式 */
.search-container {
  position: relative;
  margin: 1rem 0;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--card-bg);
  color: var(--text-color);
  transition: all 0.3s ease;
  @apply px-4 py-2 w-64 bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:text-gray-200;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* 响应式调整 */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
  
  .card {
    padding: 1rem;
  }
}

/* General styles */
body {
    scroll-behavior: smooth;
}

/* Search input styles */
.search-input {
    @apply px-4 py-2 w-64 bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:text-gray-200;
}

/* Navigation styles */
.nav-item-active {
    @apply text-blue-600 dark:text-blue-400 relative;
}

.nav-item-active::after {
    content: '';
    @apply absolute bottom-0 left-0 w-full h-0.5 bg-current transform scale-x-100;
}

/* Card hover effect */
.card-hover {
    transition: transform 0.2s ease-in-out;
}

.card-hover:hover {
    transform: translateY(-4px);
}

/* Code block styles */
.code-block {
    @apply bg-gray-900 rounded-lg overflow-hidden my-6;
}

.code-block-title {
    @apply bg-gray-800 px-4 py-2 text-gray-400 text-sm font-mono border-b border-gray-700;
}

.code-block pre {
    @apply m-0 p-4 overflow-x-auto;
}

.code-block code {
    @apply font-mono text-sm;
}

/* Dark mode transitions */
.dark .transition-colors {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

/* Language dropdown animation */
#language-dropdown {
    transform-origin: top right;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

#language-dropdown.hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

/* Mobile menu animation */
#mobile-menu {
    transition: max-height 0.3s ease-in-out;
    max-height: 0;
    overflow: hidden;
}

#mobile-menu:not(.hidden) {
    max-height: 500px;
}

/* Button hover effects */
.hover-lift {
    transition: transform 0.2s ease-in-out;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

/* Search results container */
#search-results,
#mobile-search-results {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}

#search-results::-webkit-scrollbar,
#mobile-search-results::-webkit-scrollbar {
    width: 6px;
}

#search-results::-webkit-scrollbar-track,
#mobile-search-results::-webkit-scrollbar-track {
    background: transparent;
}

#search-results::-webkit-scrollbar-thumb,
#mobile-search-results::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

/* Feature card hover effects */
.feature-card {
    transition: all 0.3s ease-in-out;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Newsletter input focus effect */
.newsletter-input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* Custom selection color */
::selection {
    background-color: rgba(59, 130, 246, 0.2);
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

/* Responsive font sizes */
@media (max-width: 640px) {
    h1 {
        font-size: 2.25rem;
    }
    h2 {
        font-size: 1.875rem;
    }
    h3 {
        font-size: 1.5rem;
    }
}

/* Loading spinner */
.loading-spinner {
    border: 3px solid rgba(156, 163, 175, 0.3);
    border-radius: 50%;
    border-top: 3px solid #3b82f6;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Focus styles */
.focus-ring {
    @apply focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900;
}

/* Custom scrollbar for the entire page */
body::-webkit-scrollbar {
    width: 12px;
}

body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

body::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 6px;
    border: 3px solid #f1f1f1;
}

body::-webkit-scrollbar-thumb:hover {
    background-color: #666;
}

/* Dark mode scrollbar */
.dark body::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.dark body::-webkit-scrollbar-thumb {
    background-color: #666;
    border: 3px solid #1a1a1a;
}

.dark body::-webkit-scrollbar-thumb:hover {
    background-color: #888;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        color: #000;
        background: #fff;
    }
    
    a {
        text-decoration: underline;
    }
    
    pre, code {
        border: 1px solid #ddd;
    }
    
    .code-block {
        background-color: #1f2937 !important;
        color: #10b981 !important;
        border: none !important;
    }
}

/* A2A Protocol Animation Styles */
.protocol-animation {
    position: relative;
    width: 100%;
    height: 400px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
}

.agent {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

.agent[data-status='ready'] {
    border: 2px solid #28a745;
}

.agent[data-status='sending'] {
    animation: pulse 1s infinite;
    border: 2px solid #007bff;
}

.agent[data-status='receiving'] {
    animation: glow 1s infinite;
    border: 2px solid #17a2b8;
}

.agent[data-status='processing'] {
    animation: rotate 2s infinite linear;
    border: 2px solid #ffc107;
}

.agent[data-status='complete'] {
    border: 2px solid #28a745;
    transform: scale(1.05);
}

.agent[data-status='waiting'] {
    border: 2px solid #6c757d;
    opacity: 0.8;
}

.data-packet {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #007bff;
    border-radius: 50%;
    top: 50%;
    left: 30%;
    transform: translateY(-50%);
    transition: all 0.5s ease;
}

.data-packet.transmitting {
    animation: transmit 2s ease-in-out;
}

#status-message {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    transition: opacity 0.3s ease;
}

#status-message.active {
    animation: fadeInOut 0.3s ease;
}

.control-panel {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.control-panel button {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: #007bff;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-panel button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.control-panel button:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-2px);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(23, 162, 184, 0.5); }
    50% { box-shadow: 0 0 20px rgba(23, 162, 184, 0.8); }
    100% { box-shadow: 0 0 5px rgba(23, 162, 184, 0.5); }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes transmit {
    0% { left: 30%; opacity: 1; }
    100% { left: 70%; opacity: 0.8; }
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .protocol-animation {
        height: 300px;
    }
    
    .agent-container {
        padding: 0 50px;
    }
    
    .agent {
        width: 80px;
        height: 80px;
    }
    
    .status-message {
        width: 80%;
        font-size: 12px;
    }
}
