/* Reset mặc định */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Màu nền và font chữ chính */
body {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Gradient màu hồng tím lãng mạn */
  background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
  font-family: "Nunito", sans-serif;
  overflow: hidden; /* Ẩn thanh cuộn */
}

/* Lớp phủ mờ để làm nổi bật nội dung */
.bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at center,
    transparent,
    rgba(0, 0, 0, 0.2)
  );
  z-index: -1;
}

/* Container chính chứa 3 phần */
.main-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 50px; /* Khoảng cách giữa các phần */
  padding: 20px;
}

/* --- Phần Khung Ảnh --- */
.photo-card {
  text-align: center;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
  /* Hiệu ứng xuất hiện từ 2 bên */
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 1s forwards 0.5s;
}

/* Khung tròn chứa ảnh */
.img-frame {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 5px solid #fff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  overflow: hidden; /* Cắt ảnh thừa ra ngoài hình tròn */
  margin-bottom: 15px;
  transition: transform 0.3s ease;
}

/* Hiệu ứng khi di chuột vào ảnh */
.img-frame:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 30px rgba(255, 105, 135, 0.4);
}

/* Đảm bảo ảnh luôn lấp đầy khung tròn */
.img-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-card h2 {
  font-family: "Dancing Script", cursive;
  font-size: 2rem;
}

/* --- Phần Trái Tim Trung Tâm --- */
.heart-container {
  position: relative;
  width: 250px;
  height: 250px;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Hiệu ứng xuất hiện */
  opacity: 0;
  transform: scale(0.8);
  animation: popIn 1s forwards;
}

/* Vẽ trái tim bằng CSS thuần (sử dụng 2 hình tròn và 1 hình vuông xoay) */
.heart {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #ff4757;
  transform: rotate(-45deg);
  box-shadow: -10px 10px 90px #ff4757;
  /* Hiệu ứng đập */
  animation: heartbeat 1.5s infinite;
}

.heart::before,
.heart::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #ff4757;
  border-radius: 50%;
}

.heart::before {
  top: -50%;
  left: 0;
}
.heart::after {
  top: 0;
  right: -50%;
}

/* Chữ bên trong trái tim */
.counter-text {
  position: absolute;
  z-index: 10;
  text-align: center;
  color: white;
  transform: rotate(0deg); /* Giữ chữ thẳng */
}

.counter-text p {
  font-size: 1.1rem;
  margin: 5px 0;
  font-weight: 700;
}

.counter-text h1 {
  font-size: 4.5rem;
  margin: 0;
  font-weight: 800;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* --- Các hiệu ứng chuyển động (Animations) --- */
@keyframes heartbeat {
  0% {
    transform: rotate(-45deg) scale(1);
  }
  15% {
    transform: rotate(-45deg) scale(1.1);
  }
  30% {
    transform: rotate(-45deg) scale(1);
  }
  45% {
    transform: rotate(-45deg) scale(1.1);
  }
  100% {
    transform: rotate(-45deg) scale(1);
  }
}

@keyframes popIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Responsive trên điện thoại --- */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column; /* Xếp chồng dọc trên màn hình nhỏ */
    gap: 30px;
  }
  /* Đổi thứ tự: Ảnh trên -> Tim giữa -> Ảnh dưới */
  .photo-card.left {
    order: 1;
  }
  .heart-container {
    order: 2;
    transform: scale(0.8);
  }
  .photo-card.right {
    order: 3;
  }

  .img-frame {
    width: 120px;
    height: 120px;
  }
  .heart-container {
    width: 200px;
    height: 200px;
  }
  .counter-text h1 {
    font-size: 3.5rem;
  }
}
