/* Custom styles for Medical Devices Directory */

/* ========== CSS 变量 - 现代配色方案 ========== */
:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  --card-shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.15);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-lg: 16px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(255, 255, 255, 0.18);
}

/* ========== 基础布局 ========== */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

main {
  flex: 1;
}

/* 跳转到主内容链接 - 无障碍优化 */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 8px 0;
}

.skip-to-content:focus {
  top: 0;
}

/* ========== 公司卡片样式 ========== */
.company-card {
  transition: var(--transition-smooth);
  border-radius: var(--border-radius-md) !important;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  overflow: hidden;
  position: relative;
}

.company-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.company-card:hover::before {
  transform: scaleX(1);
}

.company-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--card-shadow-hover) !important;
  border-color: rgba(102, 126, 234, 0.2);
}

/* 卡片内容动画 */
.company-card .card-body {
  position: relative;
  z-index: 1;
}

.company-card .btn {
  transition: var(--transition-smooth);
}

.company-card:hover .btn {
  transform: translateX(4px);
}

/* Logo 样式 */
.company-logo {
  max-width: 100px;
  max-height: 60px;
  object-fit: contain;
  transition: var(--transition-smooth);
  filter: grayscale(0%);
}

.company-card:hover .company-logo {
  transform: scale(1.05);
  filter: grayscale(0%) brightness(1.1);
}

.company-logo-large {
  max-width: 150px;
  max-height: 150px;
  object-fit: contain;
  transition: var(--transition-smooth);
}

.company-logo-small {
  max-height: 50px;
  object-fit: contain;
  transition: var(--transition-smooth);
}

.placeholder-logo {
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: var(--border-radius-md);
  margin: 0 auto;
  transition: var(--transition-smooth);
}

.placeholder-logo:hover {
  transform: rotate(5deg) scale(1.05);
}

/* 公司描述 - 保留换行 */
.company-description {
  white-space: pre-line;
}

/* 询盘 banner */
.equipment-provider-banner {
  border-radius: var(--border-radius-md);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: var(--transition-smooth);
}

.equipment-provider-banner:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.equipment-provider-banner img {
  aspect-ratio: 20 / 7;
  display: block;
  object-fit: cover;
  object-position: center;
}

/* 小卡片标题 */
.small-card-title {
  font-size: 0.9rem;
}

/* 相关公司小卡片 */
.related-company-card {
  transition: var(--transition-smooth);
  border-radius: var(--border-radius-md) !important;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: white;
}

.related-company-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover) !important;
  border-color: rgba(102, 126, 234, 0.3);
}

.related-company-card .stretched-link {
  color: inherit;
  transition: color 0.3s ease;
}

.related-company-card:hover .stretched-link {
  color: #667eea;
}

/* 功能卡片 */
.feature-card {
  transition: var(--transition-smooth);
  border-radius: var(--border-radius-md) !important;
  border: none;
  background: white;
  position: relative;
  overflow: hidden;
}

.feature-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.feature-card:hover::after {
  opacity: 0.05;
}

.feature-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--card-shadow-hover) !important;
}

.feature-card .card-body {
  position: relative;
  z-index: 1;
}

.feature-card i {
  transition: var(--transition-smooth);
}

.feature-card:hover i {
  transform: scale(1.1) rotate(5deg);
}

/* ========== 文本样式 ========== */
.text-truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ========== Hero 区域 ========== */
.hero-section {
  background: var(--primary-gradient);
  color: white !important;
  border-radius: var(--border-radius-lg) !important;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-10%, -10%) scale(1.1); }
}

.hero-section h1,
.hero-section p {
  color: white !important;
  position: relative;
  z-index: 1;
}

/* Hero 区域按钮样式 */
.btn-hero-primary {
  background-color: white !important;
  color: #667eea !important;
  border: 2px solid white !important;
  padding: 14px 32px;
  font-weight: 600;
  transition: var(--transition-smooth);
  border-radius: var(--border-radius-sm);
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.btn-hero-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(102, 126, 234, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-hero-primary:hover::before {
  width: 300px;
  height: 300px;
}

.btn-hero-primary:hover {
  background-color: rgba(255, 255, 255, 0.95) !important;
  color: #5568d3 !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.btn-hero-secondary {
  background-color: transparent !important;
  color: white !important;
  border: 2px solid white !important;
  padding: 14px 32px;
  font-weight: 600;
  transition: var(--transition-smooth);
  border-radius: var(--border-radius-sm);
  position: relative;
  z-index: 1;
}

.btn-hero-secondary:hover {
  background-color: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  border-color: white !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* ========== 卡片效果 ========== */
.card {
  transition: var(--transition-smooth);
  border-radius: var(--border-radius-md) !important;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: var(--card-shadow);
}

.card:hover {
  box-shadow: var(--card-shadow-hover);
}

/* ========== 社交媒体链接 ========== */
.social-links a {
  transition: transform 0.2s;
}

.social-links a:hover {
  transform: translateY(-2px);
}

/* ========== 徽章 ========== */
.badge {
  font-weight: 500;
  padding: 6px 12px;
}

/* ========== 表单控件 ========== */
.form-label {
  font-weight: 600;
  color: #495057;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.form-control,
.form-select {
  border-radius: var(--border-radius-sm);
  border: 2px solid #e9ecef;
  transition: var(--transition-smooth);
  padding: 0.625rem 0.875rem;
}

.form-control:focus,
.form-select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
  transform: translateY(-1px);
}

/* Input Group 样式统一 */
.input-group {
  transition: var(--transition-smooth);
}

.input-group:focus-within {
  transform: translateY(-1px);
}

.input-group .input-group-text {
  border: 2px solid #e9ecef;
  border-right: none;
  transition: var(--transition-smooth);
  background-color: white;
}

.input-group:focus-within .input-group-text {
  border-color: #667eea;
  background-color: white;
}

.input-group .form-control {
  border-left: none;
}

.input-group .form-control:focus {
  border-left: none;
  box-shadow: none;
  transform: none;
}

.input-group:focus-within .form-control {
  border-color: #667eea;
}

/* 搜索和筛选卡片 */
.search-filter-card {
  background: white;
  border-radius: var(--border-radius-lg) !important;
  border: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: var(--transition-smooth);
}

.search-filter-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* ========== 导航栏 ========== */
.navbar {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.3rem;
  transition: var(--transition-smooth);
}

.navbar-brand:hover {
  transform: scale(1.05);
}

.navbar .nav-link {
  position: relative;
  transition: var(--transition-smooth);
  padding: 0.5rem 1rem;
}

.navbar .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: white;
  transition: var(--transition-smooth);
  transform: translateX(-50%);
}

.navbar .nav-link:hover::after,
.navbar .nav-link.active::after {
  width: 80%;
}

.navbar .nav-link.active {
  font-weight: 600;
}

/* ========== 分页 ========== */
.pagination .page-link {
  color: #667eea;
}

.pagination .page-item.active .page-link {
  background-color: #667eea;
  border-color: #667eea;
  color: #ffffff;
}

/* ========== 淡入动画 ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.company-item {
  animation: fadeInUp 0.5s ease-out;
  animation-fill-mode: both;
}

.company-item:nth-child(1) { animation-delay: 0.05s; }
.company-item:nth-child(2) { animation-delay: 0.1s; }
.company-item:nth-child(3) { animation-delay: 0.15s; }
.company-item:nth-child(4) { animation-delay: 0.2s; }
.company-item:nth-child(5) { animation-delay: 0.25s; }
.company-item:nth-child(6) { animation-delay: 0.3s; }

/* ========== 滚动到顶部按钮 ========== */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-smooth);
  z-index: 1000;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
  .hero-section h1 {
    font-size: 2rem;
  }

  .company-logo-large {
    max-width: 100px;
    max-height: 100px;
  }

  .skip-to-content {
    font-size: 0.9rem;
  }

  .view-toggle {
    width: 100%;
    justify-content: center;
  }

  .results-info {
    text-align: center;
  }

  .navbar-brand span {
    font-size: 1rem;
  }

  .equipment-provider-banner img {
    min-height: 220px;
    object-position: left center;
  }
}

/* ========== 视图切换按钮 ========== */
.view-toggle {
  display: inline-flex;
  background: white;
  border-radius: var(--border-radius-sm);
  padding: 4px;
  box-shadow: var(--card-shadow);
}

.view-toggle .btn {
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  transition: var(--transition-smooth);
  border-radius: var(--border-radius-sm);
}

.view-toggle .btn.active {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.view-toggle .btn:hover:not(.active) {
  background: rgba(102, 126, 234, 0.1);
}

/* ========== 列表视图样式 ========== */
.list-view .company-card {
  display: flex;
  flex-direction: row;
}

.list-view .company-card .card-body {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.list-view .company-logo {
  max-width: 80px;
  max-height: 50px;
}

/* ========== 加载动画 ========== */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: var(--border-radius-sm);
}

/* ========== 徽章增强 ========== */
.badge {
  font-weight: 500;
  padding: 0.5rem 0.875rem;
  border-radius: var(--border-radius-sm);
  transition: var(--transition-smooth);
}

.badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ========== 按钮增强 ========== */
.btn {
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--primary-gradient);
  border: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-outline-primary {
  border: 2px solid #667eea;
  color: #667eea;
}

.btn-outline-primary:hover {
  background: var(--primary-gradient);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}

/* ========== 页脚增强 ========== */
footer {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  position: relative;
  overflow: hidden;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

footer a {
  transition: var(--transition-smooth);
}

footer a:hover {
  transform: translateX(4px);
  color: #667eea !important;
}

/* ========== 结果计数样式 ========== */
.results-info {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius-md);
  border-left: 4px solid #667eea;
}

/* ========== 打印样式 ========== */
@media print {
  .navbar,
  .skip-to-content,
  footer,
  .btn,
  .pagination {
    display: none !important;
  }

  .company-card,
  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}
