/* 联系模态框样式 */
.contact-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.contact-modal {
  background-color: #fff;
  border-radius: 10px;
  padding: 20px;
  width: 90%;
  max-width: 800px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.dark-mode .contact-modal {
  background-color: #2d3033;
  color: #f0f0f0;
}

.contact-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.dark-mode .contact-modal-header {
  border-bottom: 1px solid #3f4246;
}

.contact-modal-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 0;
}

.contact-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}

.dark-mode .contact-modal-close {
  color: #ccc;
}

.contact-modal-close:hover {
  color: #f00;
}

/* 使用grid布局替代flex布局，便于更精确控制位置 */
.contact-modal-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.contact-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: auto;
  margin-bottom: 10px;
}

.contact-qrcode {
  width: 100%;
  max-width: 160px;
  height: auto;
  margin-bottom: 5px;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
  cursor: pointer;
}

/* 二维码放大遮罩层 */
.qrcode-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
}

.qrcode-overlay.active {
  display: flex;
}

.contact-qrcode.enlarged {
  position: relative;
  max-width: 80%;
  max-height: 80%;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
  z-index: 10001;
  transform: none;
  transition: none;
  cursor: zoom-out;
}

.contact-qrcode:hover {
  transform: scale(1.05);
}

.contact-name {
  font-size: 1.1rem;
  font-weight: bold;
  margin: 5px 0;
  color: #0078e7;
  text-decoration: none;
}

.dark-mode .contact-name {
  color: #58a6ff;
}

.contact-phone {
  margin-top: 20px;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.contact-phone a {
  display: inline-block;
  padding: 5px;
  color: #0078e7;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.dark-mode .contact-phone a {
  color: #58a6ff;
}

.contact-phone a:hover {
  color: #005bb5;
  text-decoration: underline;
}

.contact-phone a i {
  margin-right: 8px;
}

/* 特殊情况：当只有1个元素时与上一行左边对齐 */
.contact-phone a:only-child {
  grid-column: 1;
  text-align: left;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .contact-modal {
    padding: 15px;
  }
  
  .contact-qrcode {
    max-width: 120px;
  }
  
  .contact-phone a {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .contact-modal {
    padding: 10px;
  }
  
  .contact-qrcode {
    max-width: 80px;
  }
  
  .contact-name {
    font-size: 0.9rem;
  }
  
  .contact-modal-title {
    font-size: 1.2rem;
  }
  
  .contact-phone a {
    font-size: 0.8rem;
    padding: 3px;
  }
}