/**
 * 🌍 IP Tester 样式表
 * 现代深色主题设计
 */

/* ========== 全局变量 ========== */
:root {
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --success-color: #00d4ff;
  --error-color: #ff6b6b;
  --bg-dark: #0a0e27;
  --bg-card: #1a1a2e;
  --text-primary: #ecf0f1;
  --text-secondary: #95a5a6;
  --border-color: #34495e;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ========== 基础样式 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ========== 导航栏 ========== */
.navbar {
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo h1 {
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.nav-links a:hover {
  background: rgba(102, 126, 234, 0.2);
}

/* ========== 主容器 ========== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* ========== 加载状态 ========== */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

.loading-text {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* ========== 错误提示 ========== */
.error-container {
  display: flex;
  justify-content: center;
  padding: 2rem;
}

.error-card {
  background: var(--bg-card);
  border: 1px solid var(--error-color);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  max-width: 500px;
  box-shadow: var(--shadow);
}

.error-card h3 {
  color: var(--error-color);
  margin-bottom: 1rem;
}

.btn-retry {
  margin-top: 1rem;
  padding: 0.75rem 2rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.2s ease;
}

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

/* ========== 卡片样式 ========== */
.card {
  background: var(--bg-card);
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: transform 0.3s ease;
}

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

.card-header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  font-size: 1.5rem;
}

.card-body {
  padding: 2rem;
}

.card-primary .card-header {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.card-security .card-header {
  background: linear-gradient(135deg, #f093fb, #f5576c);
}

.card-secondary .card-header {

/* ========== 信息网格 ========== */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.info-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  transition: all 0.3s ease;
}

.info-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.info-label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  display: block;
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.info-desc {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.unit {
  font-size: 0.9rem;
  color: var(--success-color);
}

/* ========== 地图卡片 ========== */
.map-info {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  text-align: center;
}

.map-info p {
  margin: 0.5rem 0;
}

/* ========== 详细信息卡片 ========== */
.card-details .card-header {
  background: linear-gradient(135deg, #a8edea, #fed6e3);
}

.json-output {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  max-height: 600px;
  overflow-y: auto;
}

.btn-toggle {
  padding: 0.5rem 1.5rem;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ========== 页脚信息 ========== */
.footer-info {
  text-align: center;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  margin-bottom: 2rem;
}

.footer-info p {
  margin: 0.5rem 0;
  color: var(--text-secondary);
}

.footer-info p:first-child {
  color: var(--success-color);
  font-weight: bold;
}

.footer-desc {
  font-size: 0.9rem;
}

/* ========== 页脚 ========== */
.footer {
  background: rgba(26, 26, 46, 0.95);
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
}

/* ========== 按钮样式 ========== */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-block;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ========== 响应式设计 ========== */
@media (max-width: 1200px) {
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .navbar-content {
    padding: 1rem;
  }

  .logo h1 {
    font-size: 1.2rem;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .card-header h2 {
    font-size: 1.2rem;
  }

  .info-value {
    font-size: 1.1rem;
  }
}

/* ========== 动画效果 ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content {
  animation: fadeIn 0.5s ease;
}

/* ========== IP 分析卡片样式 ========== */
.analysis-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.analysis-section:last-child {
  border-bottom: none;
}

.analysis-section h3 {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  color: var(--success-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.summary-box {
  background: rgba(255, 255, 255, 0.05);
  padding: 2rem;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
}

.summary-text {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.recommendations, .use-cases {
  margin-top: 1.5rem;
}

.recommendations h4, .use-cases h4 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--success-color);
}

.recommendations ul, .use-cases ul {
  list-style: none;
  padding-left: 0;
}

.recommendations li, .use-cases li {
  padding: 0.75rem 0;
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.6;
  color: var(--text-secondary);
}

.recommendations li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
  font-size: 1.2rem;
}

.use-cases ul:first-of-type li::before {
  content: "✅";
  font-size: 1rem;
}

.use-cases ul:last-of-type li::before {
  content: "❌";
  font-size: 1rem;
}

/* ========== 安全检测样式 ========== */
.security-rating {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.15), rgba(245, 87, 108, 0.15));
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.rating-title {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.rating-content {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.rating-percent {
  font-size: 2.5rem;
  font-weight: bold;
  min-width: 120px;
}

.rating-level {
  font-size: 1.1rem;
  font-weight: bold;
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  border: 2px solid;
}

.rating-level.risk-safe {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border-color: #22c55e;
}

.rating-level.risk-low {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border-color: #3b82f6;
}

.rating-level.risk-medium {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: #f59e0b;
}

.rating-level.risk-high {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: #ef4444;
}

.rating-level.risk-critical {
  background: rgba(239, 68, 68, 0.25);
  color: #dc2626;
  border-color: #dc2626;
  animation: pulse 2s infinite;
}

.rating-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
}

.rating-bar {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.security-item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  padding: 1.2rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.security-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #ec4899, #f5576c);
}

.security-item:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(236, 72, 153, 0.2);
  border-color: rgba(236, 72, 153, 0.3);
}

.security-icon {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 0.3rem;
}

.security-info {
  text-align: center;
}

.security-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.security-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 600;
  display: block;
}

/* 徽章样式 */
.badge-safe,
.badge-yes,
.badge-no,
.badge-datacenter,
.badge-residential,
.badge-warning,
.badge-abuse {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid;
}

.badge-safe {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border-color: #22c55e;
}

.badge-yes {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border-color: #22c55e;
}

.badge-no {
  background: rgba(71, 85, 105, 0.2);
  color: #94a3b8;
  border-color: #475569;
}

.badge-datacenter {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: #f59e0b;
}

.badge-residential {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border-color: #3b82f6;
}

.badge-warning {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: #ef4444;
}

.badge-abuse {
  background: rgba(220, 38, 38, 0.25);
  color: #dc2626;
  border-color: #dc2626;
  animation: pulse 2s infinite;
}

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

/* 旧的安全检测样式保留（用于完整数据展开） */
