/* assets/css/doctors.css */

:root {
  --primary: #0057B8;
  --secondary: #FDB913;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --bg-card: #ffffff;
  --border-light: rgba(0, 87, 184, 0.08);
  --shadow-premium: 0 10px 30px -5px rgba(0, 87, 184, 0.06), 0 4px 6px -2px rgba(0, 87, 184, 0.03);
}

/* Container & Filter Pills */
.doctors-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  justify-content: center;
}

.filter-pill {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 87, 184, 0.15);
  color: var(--primary);
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  outline: none;
}

.filter-pill:hover, 
.filter-pill:focus-visible {
  border-color: var(--primary);
  background: rgba(0, 87, 184, 0.05);
}

.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 87, 184, 0.25);
}

.doctors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

/* Card Outer Structure */
.doctor-card {
  perspective: 1000px;
  height: 420px;
  cursor: pointer;
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
}

.doctor-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: left;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.doctor-card:focus-visible .doctor-card-inner {
  box-shadow: 0 0 0 3px var(--secondary);
  border-radius: 16px;
}

.doctor-card.flipped .doctor-card-inner {
  transform: rotateY(180deg);
}

/* Card Front & Back faces */
.doctor-card-front, 
.doctor-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.doctor-card:hover .doctor-card-front {
  border-color: rgba(0, 87, 184, 0.2);
  box-shadow: 0 20px 40px -10px rgba(0, 87, 184, 0.1), 0 4px 12px -2px rgba(0, 87, 184, 0.05);
}

/* Front Styling */
.doctor-photo-container {
  height: 330px;
  width: 100%;
  overflow: hidden;
  position: relative;
  background: #f1f5f9;
}

.doctor-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.doctor-card:hover .doctor-photo {
  transform: scale(1.05);
}

.doctor-info-container {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-grow: 1;
  overflow: hidden;
}

.spec-chip {
  display: inline-block;
  background: rgba(0, 87, 184, 0.06);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
  width: fit-content;
  letter-spacing: 0.5px;
}

.doctor-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.doctor-sub {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 12px;
}

.doctor-bio-preview {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
  margin: 0;
  overflow: hidden;
  position: relative;
  flex-grow: 1;
  -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

/* Back Styling */
.doctor-card-back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, var(--primary) 0%, #003366 100%);
  color: #ffffff;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.back-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
  margin-bottom: 16px;
  filter: brightness(0) invert(1);
}

.back-text {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px;
}

.back-loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--secondary);
  border-radius: 50%;
  animation: back-spin 1s linear infinite;
  margin-top: 16px;
}

@keyframes back-spin {
  to { transform: rotate(360deg); }
}

/* Modal Overlay */
.doctors-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.doctors-modal-overlay.active {
  display: flex;
  opacity: 1;
}

/* Modal Window Content Container */
.doctors-modal-content {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 650px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(0, 87, 184, 0.1);
  transform: scale(0.85);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.doctors-modal-overlay.active .doctors-modal-content {
  transform: scale(1);
  opacity: 1;
}

/* Modal Non-scrolling Header */
.doctors-modal-header {
  padding: 30px 40px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 24px;
  position: relative;
  background: linear-gradient(135deg, rgba(0, 87, 184, 0.02) 0%, rgba(253, 185, 19, 0.02) 100%);
}

.modal-doctor-photo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--secondary);
  box-shadow: 0 4px 10px rgba(0, 87, 184, 0.1);
}

.modal-header-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.modal-header-info h4 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 6px 0;
}

.modal-chips-container {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.modal-chip-exp {
  background: rgba(253, 185, 19, 0.12);
  color: #c27d00;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.3px;
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #94a3b8;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s, color 0.2s;
}

.modal-close-btn:hover,
.modal-close-btn:focus-visible {
  background-color: rgba(148, 163, 184, 0.1);
  color: var(--text-dark);
  outline: none;
}

/* Modal Scrollable Body */
.doctors-modal-body {
  padding: 30px 40px;
  overflow-y: auto;
  max-height: 380px;
}

.doctors-modal-body p {
  color: #334155;
  line-height: 1.7;
  font-size: 14.5px;
  margin: 0;
  white-space: pre-line;
}

/* Slim Custom Scrollbar */
.doctors-modal-body::-webkit-scrollbar {
  width: 6px;
}
.doctors-modal-body::-webkit-scrollbar-track {
  background: #f8fafc;
}
.doctors-modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
.doctors-modal-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Responsive Overrides */
@media (max-width: 576px) {
  .doctors-modal-header {
    padding: 24px 20px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
  }
  
  .doctors-modal-body {
    padding: 24px 20px;
    max-height: 320px;
  }
  
  .modal-close-btn {
    top: 12px;
    right: 12px;
  }
  
  .modal-chips-container {
    justify-content: center;
  }
}

/* Accessibility / Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .doctor-card-inner {
    transition: none !important;
  }
  .doctor-card.flipped .doctor-card-inner {
    transform: none !important;
  }
  .doctor-card.flipped .doctor-card-front {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .doctor-card-back {
    transform: none !important;
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  .doctor-card.flipped .doctor-card-back {
    opacity: 1;
  }
  .doctors-modal-content {
    transition: opacity 0.2s ease !important;
    transform: none !important;
  }
}
