/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* New color palette based on the green shades */
  --dark-green: #4a6516;
  --medium-green: #6a9019;
  --light-green: #8eba26;
  --pale-green: #e5faae;
  --white: #ffffff;
  --light-gray: #f5f5f5;
  --dark-gray: #333;
  --teal: #4d9ea3;
}

body {
  font-family: 'Arial', sans-serif;
  line-height: 1.6;
  color: var(--dark-gray);
}

a {
  text-decoration: none;
}

/* Header styles */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background-color: var(--dark-green);
  color: var(--white);
  height: 80px;
  max-height: 80px;
  position: relative;
  overflow: visible;
}

.logo {
  display: flex;
  align-items: center;
  height: 100%;
  position: relative;
  overflow: visible;
  flex: 0 0 35%;
}

.logo-image {
  max-height: 192px;
  max-width: 800px;
  object-fit: contain;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
}

.nav-links {
  flex: 0 0 30%;
  display: flex;
  justify-content: center;
}

.nav-links a {
  color: var(--white);
  margin-left: 2rem;
  font-weight: 500;
}

.auth-buttons {
  flex: 0 0 35%;
  display: flex;
  justify-content: flex-end;
}

.auth-buttons .btn {
  margin-left: 1.5rem;
}

/* Hero section */
.hero {
  background: linear-gradient(135deg, var(--dark-green) 0%, var(--medium-green) 100%);
  color: var(--white);
  padding: 8rem 2rem 5rem 2rem;
  display: flex;
  position: relative;
  overflow: visible;
  z-index: 20;
}

.hero-content {
  max-width: 600px;
  position: relative;
  z-index: 21;
  margin-top: -5rem;
  text-align: center;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1.5rem;
}

.hero-image {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 50%;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-image: url('images/landing_doctors.png');
}

/* Search box */
.search-container {
  margin: 2rem 0;
  display: flex;
  background: var(--white);
  border-radius: 50px;
  overflow: visible;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 25;
  flex-wrap: nowrap;
  max-width: 850px;
  min-width: 600px;
}

.search-input {
  flex: 2;
  padding: 1rem 1.5rem;
  border: none;
  outline: none;
  font-size: 1rem;
  border-radius: 50px 0 0 50px;
  position: relative;
}

.search-input::before {
  content: '\f002';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
}

.location-input {
  flex: 1;
  padding: 1rem 1.5rem 1rem 2.5rem;
  border: none;
  border-left: 1px solid #eee;
  outline: none;
  font-size: 1rem;
  position: relative;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path><circle cx="12" cy="10" r="3"></circle></svg>');
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 16px;
}

/* Timeframe Options */
.timeframe-options {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.timeframe-option {
  position: relative;
}

.timeframe-option input[type="radio"] {
  display: none;
}

.timeframe-option label {
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--white);
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
}

.timeframe-option label:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.timeframe-option input[type="radio"]:checked + label {
  background: var(--white);
  color: var(--dark-green);
  border-color: var(--white);
}

.timeframe-option label i {
  margin-right: 0.5rem;
  font-size: 1.1rem;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.timeframe-option input[type="radio"]:checked + label i {
  opacity: 1;
  color: var(--medium-green);
}

.timeframe-option label span {
  white-space: nowrap;
}

.search-btn {
  background-color: var(--medium-green);
  color: var(--white);
  border: none;
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 0 50px 50px 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Autocomplete styles */
.autocomplete-container {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: var(--white);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  max-height: 350px;
  overflow-y: auto;
  z-index: 2000;
  display: none;
  border: 1px solid #eee;
  border-top: none;
  transform: translateZ(0);
  will-change: transform;
}

.autocomplete-item {
  padding: 0.8rem 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  transition: background-color 0.2s;
}

.autocomplete-item:hover {
  background-color: var(--pale-green);
}

.specialty-name {
  font-weight: bold;
  color: var(--dark-green);
}

.autocomplete-item .specialty-name {
  position: relative;
  display: flex;
  align-items: center;
}

.specialty-count {
  font-size: 0.85rem;
  color: var(--medium-green);
  white-space: nowrap;
}

/* Highlight matching text in autocomplete */
.highlight {
  color: var(--medium-green);
  font-weight: bold;
}

/* Popup styles */
.city-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--white);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 2rem;
  z-index: 2000;
  max-width: 400px;
  width: 90%;
  text-align: center;
  display: none;
}

.popup-header {
  margin-bottom: 1rem;
}

.popup-title {
  color: var(--dark-green);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.popup-icon {
  font-size: 3rem;
  color: var(--medium-green);
  margin-bottom: 1rem;
}

.popup-message {
  margin-bottom: 1.5rem;
  color: var(--dark-gray);
  line-height: 1.6;
}

.popup-button {
  background-color: var(--medium-green);
  color: var(--white);
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s;
}

.popup-button:hover {
  background-color: var(--dark-green);
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1999;
  display: none;
}

/* Doctor cards styles */
.doctors-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2rem;
}

.doctor-card {
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: transform 0.3s ease;
  border-top: 5px solid var(--medium-green);
}

.doctor-card:hover {
  transform: translateY(-5px);
}

.doctor-info {
  padding: 1.5rem;
}

.doctor-name {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--dark-green);
  margin-bottom: 0.5rem;
}

.doctor-specialty {
  color: var(--medium-green);
  margin-bottom: 1rem;
}

.doctor-address {
  margin-bottom: 1rem;
  color: var(--dark-gray);
  font-size: 0.9rem;
}

.doctor-availability {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1rem;
}

.date-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--pale-green);
}

.date-label {
  width: 100%;
  font-weight: bold;
  color: var(--dark-green);
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

.time-slot {
  background-color: var(--pale-green);
  color: var(--dark-green);
  padding: 0.5rem;
  border-radius: 5px;
  text-align: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.time-slot:hover {
  background-color: var(--light-green);
  color: var(--white);
}

/* "Voir les disponibilités" lazy-load button */
.doctor-slots-section {
  margin-top: 1.5rem;
  text-align: center;
}

.load-slots-btn {
  background-color: var(--pale-green);
  color: var(--dark-green);
  border: 2px solid var(--light-green);
  transition: all 0.2s ease;
}

.load-slots-btn:hover:not(:disabled) {
  background-color: var(--light-green);
  color: var(--white);
}

.load-slots-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.doctor-profile-link {
  margin-top: 1.5rem;
  text-align: center;
}

.doctor-profile-link a {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: var(--medium-green);
  color: var(--white);
  border-radius: 5px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}

.doctor-profile-link a:hover {
  background-color: var(--dark-green);
}

/* Doctor list header styles */
.doctors-header {
  background-color: var(--pale-green);
  padding: 2rem;
  margin-bottom: 2rem;
}

.doctors-title {
  font-size: 2rem;
  color: var(--dark-green);
  margin-bottom: 1rem;
}

.doctors-subtitle {
  color: var(--medium-green);
  margin-bottom: 1.5rem;
}

/* Sorting Filter */
.sorting-filter {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.sorting-filter label {
  font-weight: 500;
  color: var(--dark-green);
  font-size: 1rem;
}

.sort-dropdown {
  padding: 0.75rem 1rem;
  border: 2px solid var(--medium-green);
  border-radius: 8px;
  background: var(--white);
  color: var(--dark-gray);
  font-size: 1rem;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%236a9019" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6,9 12,15 18,9"></polyline></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 2.5rem;
  min-width: 240px;
}

.sort-dropdown:hover {
  border-color: var(--dark-green);
  box-shadow: 0 2px 8px rgba(74, 101, 22, 0.1);
}

.sort-dropdown:focus {
  border-color: var(--dark-green);
  box-shadow: 0 0 0 3px rgba(106, 144, 25, 0.1);
}

.sort-dropdown::-ms-expand {
  display: none;
}

/* Info cards */
.info-cards {
  display: flex;
  justify-content: space-between;
  padding: 4rem 2rem;
  gap: 2rem;
  background-color: var(--pale-green);
  position: relative;
  z-index: 10;
}

.info-card {
  flex: 1;
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease;
  display: flex;
  border-left: 5px solid var(--light-green);
}

.info-card:hover {
  transform: translateY(-5px);
}

.card-content {
  padding: 1.5rem;
  flex: 1;
}

.card-image {
  width: 50%;
  background-size: cover;
  background-position: center;
}

.info-card h3 {
  margin-bottom: 1rem;
  color: var(--dark-green);
}

.info-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--medium-green);
  font-weight: bold;
}

/* Footer section */
.footer {
  background-color: var(--light-gray);
  padding: 3rem 2rem;
  text-align: center;
}

.tagline {
  font-size: 1.8rem;
  margin-bottom: 2rem;
  color: var(--dark-green);
}

.footer-links a {
  color: var(--medium-green);
  margin: 0 0.5rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  font-weight: bold;
  cursor: pointer;
}

.btn-primary {
  background-color: var(--white);
  color: var(--dark-green);
}

.btn-outline {
  border: 2px solid var(--white);
  color: var(--white);
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Auth links duplicated inside the mobile burger menu; hidden on desktop */
.nav-links .mobile-only {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .menu-toggle {
    display: block;
  }

  .nav-links {
    display: none;
  }

  .nav-links.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--dark-green);
    padding: 1rem;
    z-index: 100;
  }

  .nav-links a {
    margin: 0.5rem 0;
  }

  .nav-links .mobile-only {
    display: block;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
  }

  .header {
    padding: 1rem;
  }

  .logo {
    flex: 1 1 auto;
  }

  .logo-image {
    max-height: 120px;
    max-width: 55vw;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }

  .auth-buttons {
    display: none;
  }

  .hero {
    flex-direction: column;
    padding: 2.5rem 1rem 2rem;
  }

  .hero-content {
    margin-top: 0;
    max-width: 100%;
  }

  .hero h1 {
    font-size: 1.9rem;
    margin-bottom: 1rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .hero-image {
    position: relative;
    width: 100%;
    height: 220px;
    margin-top: 1.5rem;
  }

  .search-wrapper {
    margin: 1.5rem 0;
    max-width: 100%;
  }

  .search-container {
    flex-direction: column;
    border-radius: 14px;
    min-width: 0;
    max-width: 100%;
  }

  .search-input {
    border-radius: 14px 14px 0 0;
  }

  .location-input {
    border-left: none;
    border-top: 1px solid #eee;
  }

  .search-btn {
    border-radius: 0 0 14px 14px;
    justify-content: center;
    padding: 1rem;
  }

  .timeframe-options {
    gap: 0.6rem;
    margin-top: 1.2rem;
  }

  .timeframe-option label {
    font-size: 0.9rem;
    padding: 0.45rem 0.9rem;
  }

  .doctors-header {
    padding: 1.5rem 1rem;
    margin-bottom: 1rem;
  }

  .doctors-title {
    font-size: 1.5rem;
  }

  .sorting-filter {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .sort-dropdown {
    min-width: 0;
    width: 100%;
  }

  .doctors-container {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 1rem;
  }

  .info-cards {
    flex-direction: column;
    padding: 2rem 1rem;
  }

  .info-card {
    flex-direction: column;
  }

  .card-image {
    width: 100%;
    height: 200px;
  }

  .tagline {
    font-size: 1.4rem;
  }
}

/* Error and loading messages */
.loading, .error-message, .no-results {
  text-align: center;
  padding: 2rem;
  color: var(--dark-gray);
  grid-column: 1 / -1;
}

.error-message {
  color: #d32f2f;
  background-color: #ffebee;
  border-radius: 10px;
  padding: 1.5rem;
}

.error-message i, .no-results i {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.no-results {
  color: var(--dark-green);
  background-color: var(--pale-green);
  border-radius: 10px;
  padding: 2rem;
}

/* Style for showing more results */
.autocomplete-item.show-more {
  background-color: #f9f9f9;
  text-align: center;
  color: var(--medium-green);
  font-weight: normal;
}

.autocomplete-item.show-more:hover {
  background-color: #f0f0f0;
}

/* Special overlay handling for dropdown */
body.dropdown-open .info-cards {
  position: relative;
  z-index: 5; /* Ensure info cards are beneath the dropdown */
}

body.dropdown-open .autocomplete-container {
  position: absolute;
  z-index: 2000; /* Even higher z-index */
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3); /* Stronger shadow for better visibility */
}

/* Ensure the dropdown is rendered on top of everything */
.autocomplete-container {
  transform: translateZ(0); /* Force GPU rendering */
  will-change: transform; /* Hint to browser about changes */
}

/* Ensure search container and its contents remain on top */
.search-container, 
.search-container * {
  position: relative;
  z-index: 30;
}

/* When dropdown is open, create an overlay to ensure dropdown is visible */
body.dropdown-open::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: 15; /* Between hero and dropdown */
  pointer-events: none; /* Allow clicks to pass through */
}

/* Ensure hero and search elements are above the overlay */
body.dropdown-open .hero,
body.dropdown-open .search-container {
  z-index: 25;
}

/* Search wrapper to properly position autocomplete */
.search-wrapper {
  position: relative;
  z-index: 2000; /* Extremely high z-index */
  margin: 2rem 0;
  width: 100%;
  max-width: 850px;
}

/* Update autocomplete position */
.search-wrapper .autocomplete-container {
  position: absolute;
  top: 100%; /* Position it below the search form */
  left: 0;
  width: 100%;
  margin-top: -10px; /* Slight overlap with search form */
}

/* Doctor rating styles */
.doctor-rating {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.8rem;
}

.doctor-rating .stars {
  color: #FFB800;
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.doctor-rating .stars:hover {
  transform: scale(1.05);
}

.doctor-rating .rating-text {
  color: var(--dark-gray);
  font-size: 0.9rem;
}

/* No reviews style */
.doctor-rating.no-reviews .rating-text {
  color: #888;
  font-style: italic;
}

.doctor-rating.no-reviews i {
  margin-right: 6px;
  color: #aaa;
}

.doctor-rating.no-reviews .stars {
  cursor: default;
}

.doctor-rating.no-reviews .stars:hover {
  transform: none;
}

/* Reviews Popup Styles */
.reviews-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 3000;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  animation: popupSlideIn 0.3s ease-out;
}

@keyframes popupSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.reviews-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 2px solid var(--pale-green);
  background: linear-gradient(135deg, var(--pale-green) 0%, rgba(229, 250, 174, 0.5) 100%);
}

.reviews-popup-title {
  color: var(--dark-green);
  font-size: 1.4rem;
  font-weight: bold;
  margin: 0;
}

.reviews-popup-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--medium-green);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.reviews-popup-close:hover {
  background: var(--medium-green);
  color: var(--white);
  transform: scale(1.1);
}

.reviews-popup-content {
  padding: 1.5rem 2rem 2rem;
  overflow-y: auto;
  max-height: calc(80vh - 100px);
}

.doctor-info-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.doctor-info-header h4 {
  color: var(--dark-green);
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.popup-rating {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.popup-rating .stars {
  color: #FFB800;
  font-size: 1.4rem;
}

.popup-rating .rating-text {
  color: var(--dark-gray);
  font-size: 1rem;
  font-weight: 500;
}

.reviews-list {
  margin-bottom: 1.5rem;
}

.review-item {
  background: var(--light-gray);
  border-radius: 8px;
  padding: 1.2rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--medium-green);
  position: relative;
  line-height: 1.6;
}

.review-item:last-child {
  margin-bottom: 0;
}

.review-item::before {
  content: '"';
  font-size: 2rem;
  color: var(--medium-green);
  position: absolute;
  top: 0.5rem;
  left: 0.8rem;
  font-family: serif;
  opacity: 0.7;
}

.review-text {
  color: var(--dark-gray);
  font-style: italic;
  padding-left: 1.5rem;
}

.reviews-disclaimer {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  color: #888;
  font-size: 0.85rem;
  font-style: italic;
}

/* Overlay for popup */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2999;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Mobile responsiveness for reviews popup */
@media (max-width: 768px) {
  .reviews-popup {
    width: 95%;
    max-height: 90vh;
  }
  
  .reviews-popup-header {
    padding: 1rem 1.5rem;
  }
  
  .reviews-popup-content {
    padding: 1rem 1.5rem 1.5rem;
  }
  
  .reviews-popup-title {
    font-size: 1.2rem;
  }
} 