@keyframes scaleIn {
  from {
    transform: scale(0.94);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(244, 248, 246, 0.52);
  backdrop-filter: blur(8px);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}

.overlay.active {
  display: flex;
  animation: fadeIn 0.3s ease-out;
}

.teacher-profile-card {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(420px, calc(100vw - 24px));
  max-height: min(88vh, 760px);
  transform: translate(-50%, -50%);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98),
    rgba(247, 244, 239, 0.98)
  );
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.26);
  z-index: 3001;
  border: 1px solid rgba(215, 198, 171, 0.42);
}

.teacher-profile-card.active {
  display: block;
  animation: scaleIn 0.26s ease-out;
}

.teacher-card-content {
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  height: 100%;
  padding: 16px;
  background:
    radial-gradient(
      circle at top right,
      rgba(228, 198, 155, 0.12),
      transparent 30%
    ),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.86),
      rgba(247, 241, 233, 0.92)
    );
}

.card-header {
  padding: 16px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(171, 144, 103, 0.14);
  position: relative;
}

.teacher-card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(218, 191, 154, 0.48);
  box-shadow: 0 10px 24px rgba(44, 35, 24, 0.12);
}

.teacher-info {
  flex: 1;
  padding-right: 32px;
}

.teacher-name {
  margin: 0 0 8px;
  font-size: 1.4em;
  color: #2f2a25;
  margin-bottom: 15px;
}

.teacher-intro {
  font-size: 15px !important;
  color: #7a6958;
  margin: 4px 0 0;
  line-height: 1.5;
}

.card-middle {
  padding: 16px;
  background: transparent;
  overflow-y: auto;
  max-height: calc(80vh - 180px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-code-container {
  width: 180px;
  height: 180px;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid rgba(206, 180, 144, 0.42);
  border-radius: 18px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.92),
    rgba(247, 242, 235, 0.94)
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 12px 30px rgba(35, 28, 19, 0.08);
}

.wechat-qr {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.contact-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.contact-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(164, 138, 102, 0.1);
  background: rgba(255, 252, 248, 0.56);
  border-radius: 16px;
  margin-bottom: 8px;
  backdrop-filter: blur(8px);
}

.contact-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.contact-item .label {
  color: #8c6e4b;
  font-size: 15px;
  width: 60px;
  font-weight: 700;
}

.contact-item .value {
  flex: 1;
  color: #332c26;
  font-size: 14px;
  margin-left: 8px;
}

.contact-item .value a {
  color: #b7864b;
  text-decoration: none;
}

.contact-item .value a:hover {
  text-decoration: underline;
}

.card-footer {
  background: transparent;
  padding: 16px;
  position: relative;
  border-radius: 18px;
  margin-bottom: 0;
}

.action-buttons {
  display: flex;
  gap: 12px;
  padding: 0 4px;
}

.action-btn {
  flex: 1;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  color: white;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(31, 26, 20, 0.12);
}

.chat-btn {
  background: linear-gradient(135deg, #d9b17c, #b9874d);
}

.homepage-btn {
  background: linear-gradient(135deg, #516272, #2f3c49);
}

.btn-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  fill: currentColor;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(120, 98, 72, 0.08);
  border: 1px solid rgba(171, 144, 103, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #866847;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(171, 144, 103, 0.14);
}

.teacher-avatar-container {
  display: inline-block;
  position: relative;
}

.teacher-avatar-main {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
}

.teacher-avatar-main:hover {
  transform: scale(1.05);
}

.card-middle::-webkit-scrollbar {
  width: 4px;
}

.card-middle::-webkit-scrollbar-track {
  background: transparent;
}

.card-middle::-webkit-scrollbar-thumb {
  background: rgba(120, 98, 72, 0.18);
  border-radius: 999px;
}

body.theme-dark .overlay {
  background: rgba(17, 20, 24, 0.68);
  backdrop-filter: blur(18px) saturate(120%);
}

body.theme-dark .teacher-profile-card {
  background: linear-gradient(
    180deg,
    rgba(31, 35, 41, 0.98),
    rgba(24, 28, 33, 0.99)
  );
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.theme-dark .teacher-card-content {
  background:
    radial-gradient(
      circle at top right,
      rgba(201, 167, 118, 0.08),
      transparent 28%
    ),
    linear-gradient(180deg, rgba(35, 40, 46, 0.98), rgba(24, 28, 33, 0.99));
}

body.theme-dark .card-header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

body.theme-dark .teacher-card-avatar {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

body.theme-dark .teacher-name {
  color: #e7c9a0;
}

body.theme-dark .teacher-intro {
  color: rgba(255, 255, 255, 0.78);
}

body.theme-dark .qr-code-container {
  background: linear-gradient(
    180deg,
    rgba(255, 250, 243, 0.96),
    rgba(241, 229, 213, 0.96)
  );
  border-color: rgba(240, 204, 157, 0.22);
}

body.theme-dark .contact-item {
  background: linear-gradient(
    180deg,
    rgba(44, 50, 58, 0.92),
    rgba(35, 40, 46, 0.92)
  );
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom-color: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

body.theme-dark .contact-item .label {
  color: rgba(255, 255, 255, 0.48);
}

body.theme-dark .contact-item .value {
  color: rgba(255, 255, 255, 0.92);
}

body.theme-dark .contact-item .value a {
  color: #e7c9a0;
}

body.theme-dark .close-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
}

body.theme-dark .close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 480px) {
  .teacher-profile-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 24px);
    border-radius: 22px;
  }

  .card-middle {
    padding: 16px 0;
    margin: 0 20px 15px 20px;
  }

  .qr-code-container {
    width: 160px;
    height: 160px;
  }

  .action-buttons {
    flex-direction: row;
  }

  .action-btn {
    width: calc(50% - 6px);
  }
}

@media (min-width: 800px) {
  .teacher-avatar-container {
    display: none !important;
  }
}
