/* ======================================
   Experts Page - Enhanced Design with Fixed Badge
   Modern, Clean, Professional
====================================== */

* { 
  font-family: 'Tajawal', sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== Hero Section - Enhanced ===== */
.experts-page-hero {
  position: relative;
  background: linear-gradient(135deg, #062141 0%, #0a4d4d 100%);
  color: rgba(255, 255, 255, 0.95);
  padding: 120px 20px 50px;
  min-height: 400px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Animated background pattern */
.experts-page-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.04) 0%, transparent 50%);
  pointer-events: none;
  opacity: 0.6;
}

.experts-hero-inner {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  z-index: 1;
}

.experts-page-hero h1 {
  margin: 0 0 15px;
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  animation: fadeInUp 0.6s ease-out;
}

.experts-page-hero p {
  margin: 0 0 35px;
  opacity: 0.92;
  font-size: 18px;
  line-height: 1.7;
  max-width: 700px;
  animation: fadeInUp 0.6s ease-out 0.2s backwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Filters Section - Enhanced ===== */
.experts-filters {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
  animation: fadeInUp 0.6s ease-out 0.4s backwards;
}

/* Search Box - Enhanced */
.search-box {
  flex: 1 1 400px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 14px 18px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.search-box:focus-within {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.search-box i {
  opacity: 0.9;
  font-size: 18px;
  transition: transform 0.3s ease;
}

.search-box:focus-within i {
  transform: scale(1.1);
  opacity: 1;
}

.search-box input {
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

/* Select Dropdowns - Enhanced */
.experts-filters select {
  flex: 0 0 200px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 14px 18px;
  outline: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='white' d='M6 8L0 2l1.5-1.5L6 5 10.5.5 12 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 18px center;
  padding-left: 45px;
}

.experts-filters select:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
}

.experts-filters select:focus {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.experts-filters select option {
  background: #062141;
  color: white;
  padding: 10px;
}

/* ===== Main Content Section ===== */
.experts-page {
  padding: 60px 20px 80px;
  background: #ffffff;
}

/* ===== Grid - Enhanced ===== */
.experts-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 30px;
}

/* ===== Expert Card - FIXED LAYOUT ===== */
.expert-card2 {
  background: #ffffff;
  border: 1px solid rgba(6, 33, 65, 0.08);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  /* ✅ FIX: Ensure card is always visible */
  opacity: 1 !important;
  visibility: visible !important;
}

/* Card hover effect with gradient accent */
.expert-card2::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(to right, #062141, #0a4d4d);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s ease;
}

.expert-card2:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(6, 33, 65, 0.15);
  border-color: rgba(10, 77, 77, 0.2);
}

.expert-card2:hover::before {
  transform: scaleX(1);
}

/* Card Top Section - FIXED LAYOUT */
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  min-height: 80px;
}

/* ===== PERFECT CIRCLE AVATAR ===== */
.avatar-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #062141, #0a4d4d);
  padding: 4px;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.expert-card2:hover .avatar-wrapper {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(6, 33, 65, 0.3);
}

/* Real user image */
.avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid white;
  transition: transform 0.3s ease;
}

.expert-card2:hover .avatar-image {
  transform: scale(1.05);
}

/* Fallback user icon */
.avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #062141, #0a4d4d);
  color: white;
  border-radius: 50%;
  border: 3px solid white;
}

.avatar-fallback i {
  font-size: 40px;
  opacity: 0.9;
}

/* Badge - FIXED TO SHOW FULL TEXT */
.badge {
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(10, 77, 77, 0.1), rgba(6, 33, 65, 0.08));
  color: #0a4d4d;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.3px;
  border: 1px solid rgba(10, 77, 77, 0.15);
  transition: all 0.3s ease;
  white-space: normal;
  word-wrap: break-word;
  text-align: center;
  line-height: 1.4;
  flex: 1;
  max-width: 250px;
  min-width: 0;
}

.expert-card2:hover .badge {
  background: linear-gradient(135deg, rgba(10, 77, 77, 0.15), rgba(6, 33, 65, 0.12));
  border-color: rgba(10, 77, 77, 0.25);
  transform: translateY(-2px);
}

/* Name */
.name {
  margin: 15px 0 8px;
  font-size: 24px;
  font-weight: 800;
  color: #062141;
  line-height: 1.3;
  transition: color 0.3s ease;
  word-wrap: break-word;
}

.expert-card2:hover .name {
  color: #0a4d4d;
}

/* Work info styling */
.work-info {
  margin: 8px 0 15px;
  color: #475569;
  font-size: 14px;
  line-height: 1.8;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  word-wrap: break-word;
}

.work-info i {
  color: #0a4d4d;
  margin-top: 3px;
  flex-shrink: 0;
}

/* Keywords container */
.keywords-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 15px 0 20px;
  min-height: 35px;
  padding-top: 10px;
  border-top: 2px solid #f1f5f9;
}

/* Individual keyword tag */
.keyword-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(10, 77, 77, 0.08), rgba(6, 33, 65, 0.06));
  color: #0a4d4d;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(10, 77, 77, 0.12);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.keyword-tag i {
  font-size: 11px;
  opacity: 0.8;
}

.keyword-tag:hover {
  background: linear-gradient(135deg, rgba(10, 77, 77, 0.15), rgba(6, 33, 65, 0.12));
  border-color: rgba(10, 77, 77, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(10, 77, 77, 0.15);
}

/* Meta Information */
.meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: #64748b;
  font-size: 14px;
  margin-bottom: 20px;
  padding-top: 20px;
  border-top: 2px solid #f1f5f9;
  font-weight: 600;
}

.meta span {
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.3s ease;
}

.meta span:hover {
  color: #0a4d4d;
}

.meta i {
  font-size: 16px;
  color: #0a4d4d;
}

/* University tag */
.university-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}

.university-tag i {
  color: #0a4d4d;
}

/* Action Buttons */
.actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
}

/* Primary Button - Enhanced */
.btn-primary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border-radius: 14px;
  background: linear-gradient(135deg, #062141, #0a4d4d);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(6, 33, 65, 0.2);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary:hover {
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(6, 33, 65, 0.3);
}

/* Ghost Button - Enhanced */
.btn-ghost {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border-radius: 14px;
  border: 2px solid rgba(10, 77, 77, 0.2);
  color: #0a4d4d;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  background: rgba(10, 77, 77, 0.04);
  transition: all 0.3s ease;
}

.btn-ghost:hover {
  background: rgba(10, 77, 77, 0.1);
  border-color: rgba(10, 77, 77, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(10, 77, 77, 0.15);
}

/* Keywords stats in hero */
.keywords-stats {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 25px;
  padding: 15px 25px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50px;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  width: fit-content;
  animation: fadeInUp 0.6s ease-out 0.6s backwards;
}

.stat-label {
  font-size: 15px;
  opacity: 0.85;
  font-weight: 500;
}

.stat-value {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.stat-separator {
  opacity: 0.5;
  font-size: 18px;
}

/* No experts message */
.no-experts {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.no-experts i {
  font-size: 80px;
  color: #cbd5e1;
  margin-bottom: 25px;
}

.no-experts h3 {
  font-size: 28px;
  font-weight: 800;
  color: #062141;
  margin-bottom: 12px;
}

.no-experts p {
  font-size: 18px;
  color: #64748b;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
  .experts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
  }
  
  .experts-page-hero h1 {
    font-size: 42px;
  }
  
  .badge {
    max-width: 200px;
  }
}

/* ✅ FIX: Tablets - ensure cards show properly */
@media (max-width: 768px) {
  .experts-page-hero {
    padding: 128px 20px 40px;
    min-height: 350px;
  }
  
  .experts-page-hero h1 {
    font-size: 36px;
  }
  
  .experts-page-hero p {
    font-size: 16px;
  }
  
  /* ✅ FIX: Single column grid on mobile */
  .experts-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 0 5px;
    width: 100%;
    max-width: 100%;
  }

  /* ✅ FIX: Force cards to be visible and block */
  .expert-card2 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: unset !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  .experts-filters {
    flex-direction: column;
    width: 100%;
  }
  
  .search-box {
    flex: 1 1 100%;
    width: 100%;
  }
  
  .experts-filters select {
    flex: 1 1 100%;
    width: 100%;
  }
  
  .avatar-wrapper {
    width: 70px;
    height: 70px;
  }
  
  .avatar-fallback i {
    font-size: 35px;
  }
  
  .name {
    font-size: 22px;
  }
  
  .badge {
    max-width: 180px;
    font-size: 11px;
    padding: 7px 14px;
  }
  
  .keywords-stats {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }
}

/* ✅ FIX: Small phones */
@media (max-width: 480px) {
  .experts-page-hero {
    padding: 128px 15px 30px;
    min-height: 300px;
  }
  
  .experts-page-hero h1 {
    font-size: 30px;
  }

  .experts-page {
    padding: 40px 15px 60px;
  }
  
  /* ✅ FIX: Explicit grid override for small phones */
  .experts-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
  }

  /* ✅ FIX: Cards must be fully visible */
  .expert-card2 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: unset !important;
    opacity: 1 !important;
    visibility: visible !important;
    padding: 20px 16px;
    border-radius: 16px;
    box-sizing: border-box !important;
  }
  
  .avatar-wrapper {
    width: 65px;
    height: 65px;
  }
  
  .avatar-fallback i {
    font-size: 32px;
  }
  
  .badge {
    max-width: 150px;
    font-size: 10px;
    padding: 6px 12px;
  }

  .name {
    font-size: 20px;
  }

  .work-info {
    font-size: 13px;
  }

  .keyword-tag {
    font-size: 11px;
    padding: 5px 10px;
  }

  .meta {
    font-size: 12px;
  }
  
  .actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .btn-primary,
  .btn-ghost {
    width: 100%;
    font-size: 14px;
    padding: 12px;
  }
}

/* ✅ FIX: Extra small phones */
@media (max-width: 360px) {
  .experts-page-hero h1 {
    font-size: 24px;
  }

  .experts-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .expert-card2 {
    display: flex !important;
    padding: 16px 14px !important;
  }

  .avatar-wrapper {
    width: 60px;
    height: 60px;
  }

  .avatar-fallback i {
    font-size: 28px;
  }

  .name {
    font-size: 17px;
  }

  .badge {
    font-size: 10px;
    padding: 5px 10px;
  }

  .keyword-tag {
    font-size: 10px;
    padding: 4px 8px;
  }
}

/* Landscape mode */
@media (max-width: 768px) and (orientation: landscape) {
  .experts-page-hero {
    min-height: auto;
    padding: 80px 15px 30px;
  }
  
  .experts-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ===== Loading State ===== */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.expert-card2.loading {
  background: linear-gradient(90deg, #f0f0f0 0%, #f8f8f8 50%, #f0f0f0 100%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* ===== Smooth Scroll ===== */
html {
  scroll-behavior: smooth;
}