@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&family=Playfair+Display:wght@400;700&display=swap');

:root {
  /* Core Palette - Modernized */
  --light-cream: #F5F3EF; /* Existing base */
  --compass-blue: #4C6E81; /* Existing primary accent */
  --deep-navy: #324A57;    /* Existing darker accent / headings */
  --slate-blue: #5D7A8C;   /* New modern slate blue for CTAs/highlights */
  
  --misty-grey: #D9D7D2;   /* Existing light neutral */
  --warm-grey: #707070;    /* New darker warm grey for sub-text or subtle UI */
  --charcoal: #333333;     /* New strong charcoal for primary body text */
  
  --white: #FFFFFF;
  --black: #000000;

  /* Semantic Colors (optional but good practice) */
  --background-primary: var(--light-cream);
  --background-secondary: var(--white); /* For cards, sections */
  --text-primary: var(--charcoal);
  --text-secondary: var(--warm-grey);
  --text-headings: var(--deep-navy);
  --accent-primary: var(--compass-blue);
  --accent-secondary: var(--slate-blue);

  /* Font Families */
  --font-family-headings: 'Playfair Display', serif;
  --font-family-body: 'Lato', sans-serif;

  /* RGB versions for box-shadows, etc. */
  --rgb-accent-primary: 76, 110, 129; /* From --compass-blue: #4C6E81 */
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: var(--background-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.5rem;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  border-bottom: 1px solid #e0e0e0;
  box-sizing: border-box;
}

.navbar-logo {
  display: flex;
  align-items: center;
}

.navbar-logo img {
  height: 45px;
  margin-right: 0.75rem;
}

.navbar-logo a {
  text-decoration: none;
  font-family: var(--font-family-headings);
  color: var(--text-headings); 
  font-weight: bold;
  font-size: 1.5rem;
}

.navbar-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  align-items: center;
}

.navbar-links a:not(.btn-appointment) {
  text-decoration: none;
  font-family: var(--font-family-body);
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--text-primary); 
  padding: 0.5rem 0.25rem;
  position: relative;
  transition: color 0.3s ease;
}

.navbar-links a:not(.btn-appointment)::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: var(--accent-secondary);
  transition: width 0.3s ease;
}

.navbar-links a:not(.btn-appointment):hover::after,
.navbar-links a:not(.btn-appointment):focus::after {
  width: 100%;
}

.navbar-links a:not(.btn-appointment):hover,
.navbar-links a:not(.btn-appointment):focus {
  color: var(--accent-secondary);
  background-color: transparent;
}

/* Styling for the "Book Appointment" button in navbar */
.btn-appointment {
  font-family: var(--font-family-body);
  font-weight: 700;
  background-color: #4C6E81 !important;
  color: var(--white) !important; 
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-appointment:hover, .btn-appointment:focus {
  background-color: #5D7A8C; 
  color: var(--white) !important;
  transform: translateY(-2px);
  text-decoration: none;
}
.btn-appointment:hover::after {
    width: 0;
}

.dropdown {
  position: relative;
}

.dropdown > a::after {
  content: ' ▾';
  font-size: 0.8em;
  display: inline-block;
  margin-left: 0.3em;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--background-secondary); 
  min-width: 220px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border: 1px solid #e0e0e0;
  border-top: none;
  z-index: 1001;
  padding: 0.5rem 0;
  margin: 0;
  border-radius: 0 0 6px 6px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  visibility: hidden;
}

.dropdown-content li {
  list-style: none;
}

.dropdown-content a {
  display: block;
  padding: 0.6rem 1.2rem;
  color: var(--text-primary); 
  text-decoration: none;
  font-size: 0.9rem;
  font-family: var(--font-family-body);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-content a:hover {
  background-color: var(--misty-grey);
  color: var(--accent-secondary);
}

/* Mobile and tablet - JavaScript controlled dropdowns */
.dropdown.open .dropdown-content {
  display: block;
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

/* Desktop hover behavior - only on larger screens */
@media (min-width: 769px) {
  .dropdown:hover .dropdown-content,
  .dropdown:focus-within .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
  }
}


/* Hamburger Icon */
.navbar .icon {
  display: none; 
  font-size: 1.8rem; 
  color: var(--text-headings);
  text-decoration: none;
  padding: 0.25rem 0.5rem; 
  cursor: pointer;
  line-height: 1; 
  background: none;
  border: none;
  /* Add touch-friendly styling */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.navbar .icon:hover {
  color: var(--accent-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .navbar {
    padding: 0.8rem 1rem;
  }
  
  .navbar-links {
    /* Use max-height for a transition effect instead of display: none */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-out;

    flex-direction: column;
    width: 100%;
    position: absolute; 
    top: 100%;
    left: 0;
    background-color: var(--background-secondary); 
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); 
    z-index: 1001; /* Increased z-index */
    padding: 0; /* Remove padding when closed */
    border-top: 1px solid #e0e0e0;
  }

  .navbar-links.active {
    max-height: 95vh; /* A large enough value to show all content */
    overflow-y: auto; /* Allow scrolling for long menus on small screens */
    padding: 0.5rem 0; /* Restore padding when open */
  }

  .navbar-links li {
    width: 100%;
    text-align: left;
    position: relative; /* Ensure proper stacking context */
  }

  .navbar-links a:not(.btn-appointment) {
    display: block; 
    width: 100%;
    box-sizing: border-box; 
    padding: 0.8rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 1rem;
    /* Improve touch targets */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  
  .navbar-links a:not(.btn-appointment)::after {
      display: none;
  }
  
  .navbar-links a:not(.btn-appointment):hover,
  .navbar-links a:not(.btn-appointment):active {
    background-color: var(--misty-grey); 
    color: var(--accent-secondary);
  }

  .navbar-links li:last-child a:not(.btn-appointment) {
    border-bottom: none; 
  }
  
  .navbar .icon {
    display: block; 
  }
  
  .navbar-logo img {
    height: 40px;
  }

  .dropdown {
    width: 100%;
    position: relative; /* Ensure proper positioning */
  }
  
  .dropdown > a {
    /* Improve touch targets for dropdown toggles */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  
  .dropdown > a::after {
    transition: transform 0.2s ease;
  }
  
  /* Rotate arrow when dropdown is open */
  .dropdown.open > a::after {
    transform: rotate(180deg);
  }

  .dropdown-content {
    display: none; /* Hidden by default on mobile */
    position: static; /* Let it flow within the li */
    background-color: #f0f0f0; /* Slight background color for context */
    box-shadow: none;
    border: none;
    border-top: 1px dashed var(--misty-grey);
    width: 100%; 
    min-width: unset; 
    padding: 0;
    margin: 0;
    border-radius: 0;
    /* Reset desktop transforms and opacity for mobile */
    transform: none;
    opacity: 1;
    visibility: visible;
  }
  
  .dropdown.open .dropdown-content {
    display: block;
  }
  
  .dropdown-content li {
    list-style: none;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  
  .dropdown-content a {
    display: block;
    padding: 0.8rem 2rem;
    font-size: 0.95rem;
    border-bottom: 1px solid #f0f0f0;
    color: var(--text-primary) !important; /* Force color */
    text-decoration: none;
    background-color: transparent;
    width: 100%;
    box-sizing: border-box;
    /* Improve touch targets */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    font-family: var(--font-family-body);
    font-weight: 400;
    transition: background-color 0.2s ease, color 0.2s ease;
  }
  
  .dropdown-content a:hover,
  .dropdown-content a:active,
  .dropdown-content a:focus {
    background-color: var(--misty-grey) !important;
    color: var(--accent-secondary) !important;
    text-decoration: none;
  }
  
  .dropdown-content li:last-child a {
    border-bottom: none;
  }

  .navbar-links .btn-appointment {
    display: block; 
    text-align: center;
    margin: 1rem 1.5rem;
    padding: 0.8rem 1rem;
    width: auto;
    /* Improve touch targets */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
}