/* ===========================
   PREMIUM TOPICS SECTION
   =========================== */
:root {
  --card-radius: 24px;
  --transition-smooth: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.topics-section {
  padding: 100px 0;
  background: #f8fafc; /* Subtle off-white for contrast */
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px;
  padding: 20px;
}

.topic-card {
  position: relative;
  height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 40px;
  text-decoration: none;
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.1);
  background-size: cover;
  background-position: center;
  transition: var(--transition-smooth);
  z-index: 1;
}

/* Glassmorphism Overlay */
.topic-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.4) 40%,
    rgba(0, 0, 0, 0.9) 100%
  );
  z-index: 2;
  transition: var(--transition-smooth);
}

/* Hover Zoom Effect for Background Image */
.topic-card:hover {
  transform: translateY(-12px);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.25);
  border-color: rgba(0, 123, 255, 0.3);
}

/* Content Styling */
.topic-icon {
  position: relative;
  z-index: 3;
  width: 54px;
  height: 54px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  margin-bottom: 20px;
  font-size: 1.5rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition-smooth);
}

.topic-title {
  position: relative;
  z-index: 3;
  font-family: 'Montserrat', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.topic-description {
  position: relative;
  z-index: 3;
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0;
  max-width: 90%;
  transform: translateY(10px);
  opacity: 0.8;
  transition: var(--transition-smooth);
}

/* Floating Arrow */
.topic-arrow {
  position: absolute;
  right: 30px;
  bottom: 30px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateX(-20px);
  transition: var(--transition-smooth);
}

/* Hover States for Internal Elements */
.topic-card:hover .topic-icon {
  background: var(--primary-color, #007bff);
  transform: rotate(-10deg) scale(1.1);
}

.topic-card:hover .topic-description {
  transform: translateY(0);
  opacity: 1;
}

.topic-card:hover .topic-arrow {
  opacity: 1;
  transform: translateX(0);
}

.topic-card:hover::before {
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 123, 255, 0.4) 40%, /* Tint on hover */
    rgba(0, 0, 0, 0.95) 100%
  );
}

/* High-Quality Card Backgrounds */
.physiology-card { background-image: url('/images/physiology.webp'); }
.pathology-card { background-image: url('/images/pathology.webp'); }
.pharmacology-card { background-image: url('/images/pharmacology.webp'); }
.pediatrics-card { background-image: url('/images/pediatrics.webp'); }
.obstetrics-card { background-image: url('/images/obstetrics.webp'); }
.gynecology-card { background-image: url('/images/gynecology.webp'); }
.internal-medicine-card { background-image: url('/images/internal-medicine.webp'); }
.general-articles-card { background-image: url('/images/general-article.webp'); }
.quiz-card { background-image: url('/images/quiz.webp'); }
.flashcards-card {background-image: url('/images/flashcards.webp');}

/* Responsive adjustments */
@media (max-width: 768px) {
  .topics-grid { gap: 20px; }
  .topic-card { height: 280px; padding: 25px; }
  .topic-arrow { opacity: 1; transform: none; width: 32px; height: 32px; right: 20px; bottom: 20px; }
}