/* Highlight today's events */
#upcoming-events .today-event {
  border: 1px solid #2196F3;
  box-shadow: 0 0 8px 2px rgba(33, 150, 243, 0.7);
  border-radius: 6px;
}
html, body {
  overflow-x: hidden;
}

@keyframes logoSpinPause {
  0% { transform: rotateY(0deg); }
  10% { transform: rotateY(360deg); }
  100% { transform: rotateY(360deg); }
}

.logo-spin {
  display: inline-block;
  animation: logoSpinPause 10s ease-in-out infinite;
  transform-style: preserve-3d;
}

@keyframes emojiPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.pulsing-emoji {
  display: inline-block;
  animation: emojiPulse 1.2s ease-in-out infinite;
}
/* Make container fluid and responsive */
.container, .main-content {
  max-width: 100vw;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}

#filter-modal.active {
  display: flex;
}
/* ============================ */
/* Filter Modal Styles */
/* ============================ */
#filter-modal.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1002;
}
#filter-modal.hidden {
  display: none !important;
}
#filter-modal .modal-content {
  background: #fff;
  border-radius: 8px;
  padding: 25px 25px 20px 25px;
  min-width: 260px;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
}
#filter-modal .close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f44336;
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 1.1em;
  padding: 4px 10px;
  cursor: pointer;
}
#filter-modal .close-btn:hover {
  background: #da190b;
}
#filter-modal h3 {
  margin-top: 0;
  font-size: 1.2em;
  color: #333;
  text-align: center;
}
#filter-modal ul {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
}
#filter-modal li[data-town] {
  padding: 9px 15px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1em;
  transition: background 0.15s;
}
#filter-modal li[data-town]:hover {
  background: #f2f2f2;
  color: #2196F3;
}
#filter-modal .count {
  background: #e3e3e3;
  color: #333;
  border-radius: 1em;
  padding: 2px 10px;
  font-size: 0.92em;
  margin-left: 6px;
}

#user-dropdown li[role="link"] {
  cursor: pointer;
  padding: 8px 12px;
  outline: none;
}

#user-dropdown li[role="link"]:hover,
#user-dropdown li[role="link"]:focus {
  background-color: #f0f0f0;
  text-decoration: underline;
}
/* Hamburger and dropdown menu styles */
.hamburger-menu {
  font-size: 1.5em;
  cursor: pointer;
  padding: 10px;
  user-select: none;
}

.dropdown {
  position: absolute;
  top: 50px;
  left: 10px;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 10;
}

.dropdown ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dropdown ul li {
  padding: 10px 15px;
  cursor: pointer;
}

.dropdown ul li:hover {
  background-color: #f0f0f0;
}

/* Enhance hamburger menu li[role="link"] for accessibility and feedback */
.dropdown ul li[role="link"] {
  cursor: pointer;
  padding: 10px 15px;
  outline: none;
}

.dropdown ul li[role="link"]:hover,
.dropdown ul li[role="link"]:focus {
  background-color: #f0f0f0;
  text-decoration: underline;
}

.dropdown ul li a {
  color: #333;
  text-decoration: none;
}
/* Basic styles for the application */
.hidden {
  display: none !important; /* Ensure it overrides other styles */
}

#login-section {
  text-align: center;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute; /* Take it out of flow when visible */
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh; /* Full height only when visible */
  background-color: #fff; /* Avoid transparency issues */
  z-index: 1000; /* Above content but below modals */
}

#login-message {
  font-size: 1.2em;
  margin-bottom: 20px;
  max-width: 600px; /* Limit width for readability */
  line-height: 1.5; /* Improve readability with line spacing */
  color: #333;
}

button {
  padding: 10px 20px;
  margin: 5px;
  cursor: pointer;
}

/* Styles for the Sign In button */
#sign-in-btn {
  background-color: #2196F3;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1em;
}

#sign-in-btn:hover {
  background-color: #1976D2;
}

/* Adjust header to ensure space for all elements */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px; /* Increase padding for better spacing */
  min-height: 60px;
  height: 60px;
  background-color: #283593;
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 3;
  box-sizing: border-box; /* Ensure padding doesn't increase width */
}

.header .header-title,
.header #user-name,
.header #user-dropdown {
  color: #fff;
}

.header-left {
  display: flex;
  gap: 10px; /* Space between buttons */
}

.header-title {
  flex-grow: 1;
  text-align: center;
  margin: 0;
  font-size: 1.5em;
  color: #333;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  white-space: normal; /* Allow wrapping if needed */
  overflow: visible; /* Prevent clipping */
  text-overflow: initial; /* Disable ellipsis */
  max-width: 40%; /* Limit width to prevent overlap with title */
  padding-right: 10px; /* Add padding to avoid edge clipping */
}

/* Ensure user profile fits */
#new-family-btn,
#new-family-btn:hover,
#user-profile {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  max-width: 100%; /* Allow full width within parent */
}

/* New Family button styling; it may cause extra height in admin mode */
#new-family-btn {
  height: 40px;
  line-height: 40px;
  font-size: 0.9em;
  padding: 0 10px;
  white-space: nowrap;
  margin-top: 0;
}

.user-photo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-right: 10px;
}

/* Adjust user name to prevent overflow */
#user-name {
  font-size: 1em;
  color: #333;
  white-space: normal; /* Allow wrapping */
  overflow: visible;
  max-width: 150px; /* Limit width to prevent excessive stretching */
}

#user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  padding: 10px;
  z-index: 10; /* Above header */
}

#user-email {
  margin: 0 0 10px 0;
  font-size: 0.9em;
  color: #666;
}

#sign-out {
  background-color: #f44336;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1em;
  padding: 5px 10px;
  width: 100%;
}

#sign-out:hover {
  background-color: #da190b;
}

/* Styles for the search container */
.search-container {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  padding: 10px;
  gap: 10px;
  max-width: 100%;
  position: relative;
  z-index: 2;
  margin: 0 auto; /* Center the container */
  box-sizing: border-box; /* Ensure padding doesn't cause overflow */
}

/* Styles for the search bar with higher specificity */
#content .search-container #search-bar {
  width: 400px !important; /* Increased width for desktop */
  max-width: 100%; /* Prevent overflow */
  min-width: 150px; /* Ensure usability on very small screens */
  padding: 8px 10px; /* Balanced padding */
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 0.9em; /* Slightly smaller font for mobile */
  box-sizing: border-box;
  margin-left: 0; /* Remove any left margin causing cropping */
}

/* Styles for the search button */
#search-btn {
  background-color: #4CAF50; /* Green to distinguish from other buttons */
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1em;
  padding: 10px 20px;
  flex-shrink: 0; /* Prevent button from shrinking */
}

#search-btn:hover {
  background-color: #45a049;
}

/* Styles for the family list section */
#family-list-section {
  z-index: 2;
  position: relative;
  padding: 10px 0; /* Minimal padding for top/bottom only */
}

#family-list {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center; /* Center cards horizontally */
  z-index: 1;
  position: relative;
  min-height: 200px;
}

.family-card {
  border: 1px solid #ccc;
  padding: 15px;
  padding-bottom: 60px; /* Reserve space for action buttons */
  margin: 0;
  border-radius: 5px;
  width: 320px;
  box-sizing: border-box;
  position: relative;
  z-index: 2; /* Above #family-list */
}

.family-photo-container {
  width: 300px;
  height: 250px;
  overflow: hidden;
  position: relative;
  display: flex; /* Use flexbox to center content */
  justify-content: center; /* Center horizontally */
  align-items: top; /* Align to top */
  padding: 0; /* Remove padding to ensure even spacing */
}

.family-photo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center; /* Center the image */
  cursor: pointer;
  z-index: 1;
  display: block;
  margin: auto; /* Additional centering for non-flex contexts */
}

.section {
  margin-top: 10px;
}

.section h4 {
  margin: 5px 0;
  font-size: 1.1em;
  font-weight: bold;
}

.section h4.sub-heading-gray {
  color: #666;
  font-weight: normal;
}

.section h4 span {
  font-size: 0.8em;
  font-weight: normal;
  color: #666;
}

.sub-heading {
  display: block;
  margin-top: 5px;
  font-weight: normal;
  font-size: 0.9em;
}

.section ul,
.section p {
  margin-left: 20px;
}

ul {
  list-style-type: none;
  padding: 0;
}

li {
  margin: 5px 0;
}

/* Ribbon styles */
.ribbon {
  position: absolute;
  bottom: 10px; /* Slightly above the bottom edge for better spacing */
  right: 10px;
  padding: 5px 10px;
  color: white;
  font-size: 0.9em; /* Slightly larger for readability */
  font-weight: bold;
  border-radius: 3px;
  z-index: 10; /* Above the photo */
  background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent black background */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); /* Subtle shadow for depth */
}

.member-ribbon {
  background-color: #4CAF50; /* Green for Member */
}

.extended-member-ribbon {
  background-color: #2196F3; /* Blue for Extended Member */
}

.non-member-ribbon {
  background-color: #FFC107; /* Yellow for Non Member */
}

.priest-ribbon {
  background-color: #9C27B0; /* Purple for Priest */
}

/* ============================ */
/* Styles for the edit family modal (Polished Version) */
/* ============================ */

/* Add a fade-in and scale animation */
@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

#edit-family-section {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20; /* Above family cards */
  animation: fadeInModal 0.3s ease;
}

#edit-family-section .modal-content {
  background: white;
  padding: 30px;
  border-radius: 8px;
  width: 70vw; /* At least 70% of viewport width */
  max-width: 600px; /* Cap at 600px for large screens */
  max-height: 90%;
  overflow-y: auto;
  position: relative;
  z-index: 3; /* Above modal overlay and family list */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Polished modal title bar & close button */
.modal-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eaeaea;
  margin-bottom: 20px;
  padding-bottom: 10px;
}

.modal-title-bar h2 {
  font-size: 1.5em;
  color: #333;
  margin: 0;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  padding: 5px 10px;
  color: #aaa;
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: #333;
}

/* Enhanced form element styling within the edit modal */
.edit-modal-body input[type="text"],
.edit-modal-body input[type="date"],
.edit-modal-body input[type="email"],
.edit-modal-body input[type="url"],
.edit-modal-body input[type="tel"],
.edit-modal-body select,
#json-editor {
  width: 100%;
  max-width: 300px;
  padding: 10px;
  margin-top: 5px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
  transition: border-color 0.3s ease;
}

.edit-modal-body input:focus,
.edit-modal-body select:focus,
#json-editor:focus {
  border-color: #66afe9;
  outline: none;
}

/* Updated button styles within the edit modal */
.add-field,
.remove-field,
#save-changes,
#edit-json-btn,
#delete-family-btn,
#save-json-btn,
#cancel-json-btn {
  padding: 10px 20px;
  margin: 10px 5px 10px 0;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.add-field,
#edit-json-btn,
#save-json-btn {
  background-color: #2196F3;
  color: #fff;
}

.add-field:hover,
#edit-json-btn:hover,
#save-json-btn:hover {
  background-color: #1976D2;
}

.remove-field,
#delete-family-btn,
#cancel-json-btn {
  background-color: #f44336;
  color: #fff;
}

.remove-field:hover,
#delete-family-btn:hover,
#cancel-json-btn:hover {
  background-color: #da190b;
}

/* ============================ */
/* End of Polished Edit Modal Styles */
/* ============================ */



.edit-modal-body {
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
}

.edit-modal-body label {
  display: block;
  margin: 5px 0;
}

/* Styles for additional buttons within the edit modal */
.add-field,
.remove-field {
  background: #2196F3;
  color: white;
  border: none;
  border-radius: 5px;
  margin: 5px 0;
}

.add-field:hover,
.remove-field:hover {
  background: #1976D2;
}

.delete-btn {
  background: #f44336;
  color: white;
  border: none;
  border-radius: 5px;
  margin: 5px;
  padding: 10px 20px;
  font-size: 1em;
}

.delete-btn:hover {
  background: #da190b;
}

.field-group,
.child-section,
.other-member-section {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

#save-changes {
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 10px 20px;
  margin-top: 10px;
}

#save-changes:hover {
  background: #45a049;
}

.success {
  color: green;
}

.error {
  color: red;
}

/* Loading section */
#loading-section {
  text-align: center;
  padding: 20px;
  font-size: 1.2em;
  color: #666;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: #fff;
  z-index: 1001; /* Above content but below modals */
}

/* Ensure content takes full space when shown */
#content {
  min-height: 100vh;
  position: relative;
  z-index: 1; /* Below login/loading/modals */
  padding-top: 60px; /* Space for fixed header only */
}

/* When notification bar is visible, push content down */
#notification-bar.notification-bar:not(.hidden) + #content {
  padding-top: 108px; /* Header + notification bar */
}

/* Notification bar above the header */
#notification-bar.notification-bar {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 20px;
  background-color: #ffeb3b;
  color: #000;
  border-bottom: 1px solid #ccc;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

/* Centered inner container with max width */
.notification-container {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

/* Notification bar buttons */
#notification-bar .notification-btn {
  background-color: #2196F3;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.95em;
  cursor: pointer;
  margin-right: 10px;
  transition: background-color 0.2s ease;
}
#notification-bar .notification-btn:hover {
  background-color: #1976D2;
}
#notification-bar .close-btn {
  background-color: #f44336;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 1.2em;
  margin-left: 0;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
#notification-bar .close-btn:hover {
  background-color: #da190b;
}

/* Styles for JSON editor */
#json-editor {
  font-family: monospace;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 10px;
  resize: vertical; /* Allow vertical resizing only */
}

.json-editor-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* Styles for admin buttons container */
.admin-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

/* Ensure Edit JSON button is visible */
#edit-json-btn.add-field {
  display: block !important;
  margin: 0;
  background: #2196F3;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 10px 20px;
  cursor: pointer;
}

#edit-json-btn.add-field:hover {
  background: #1976D2;
}

/* Styles for field instructions */
.field-instruction {
  font-size: 0.9em;
  color: #666;
  margin: 5px 0;
}

.dropdown-separator {
  margin: 10px 0;
  border: 0;
  border-top: 1px solid Orgba(0, 0, 0, 0.1);
}

.dropdown-label {
  font-size: 0.9em;
  color: #666;
  margin: 5px 0;
  font-weight: bold;
}

/* Label used for notification messages */
.notif-label {
  font-size: 0.85em;
  color: #f44336;
}

#my-families-list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
}

#my-families-list li {
  padding: 5px 0;
  cursor: pointer;
  font-size: 0.9em;
  color: #2196F3;
}

#my-families-list li:hover {
  text-decoration: underline;
}

#upcoming-events {
  background-color: #f9f9f9;
  padding: 15px;
  margin: 10px auto;
  border-radius: 8px;
  max-width: 2000px;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#upcoming-events h3 {
  margin-bottom: 10px;
}

.event-group h4 {
  margin-top: 10px;
  font-weight: bold;
}

.event-group ul {
  list-style: none;
  padding: 0;
}

.event-group li h4 {
  margin: 0;
}

.event-group li h4 span {
  font-size: 0.8em;
  font-weight: normal;
  color: #666;
}

.note {
  font-size: 0.8em;
  color: #666;
  font-style: italic;
}

/* ─────────────────────────────────────────────────────
  Reduce font sizes inside the Upcoming Events panel
  ───────────────────────────────────────────────────── */
#upcoming-events {
  font-size: 0.9em; /* base reduction for all text */
}

#upcoming-events h3 {
  font-size: 1.2em; /* section title */
}

#upcoming-events .event-group h4 {
  font-size: 1em;   /* group headings ("Birthdays", "Anniversaries") */
}

#upcoming-events .event-group li h4 {
  font-size: 0.9em; /* individual event lines */
}

#upcoming-events .note,
#upcoming-events span {
  font-size: 0.8em; /* c/o notes and date spans */
}

@media (max-width: 600px) {
  /* Ensure that the container for the user dropdown does not clip its children */
  #user-profile {
    overflow: visible;
    z-index: 1000;
  }
  
  /* Raise the drop-down's stacking order so it appears above other elements */
  #user-dropdown {
    z-index: 1001;
  }
  
  /* (Retain your existing mobile adjustments below) */
  .header {
    flex-direction: row;
    height: 60px;
    padding: 5px 10px;
  }
  /* Shrink New Family button for mobile admin */
  #new-family-btn {
    font-size: 0.8em;
    padding: 5px 8px;
    margin: 0;
    height: auto;
    line-height: normal;
  }
  .header-title {
    font-size: 1.2em;
    margin: 0;
    flex-grow: 1;
    text-align: center;
  }
  .header-right {
    font-size: 0.8em;
    max-width: 35%;
  }
  .search-container {
    padding: 5px;
    gap: 5px;
  }
  #content .search-container #search-bar {
    width: 200px !important; /* Further reduce width */
    min-width: 120px;
    font-size: 0.85em;
  }
  /* Remove extra top margin on mobile */
  /* #upcoming-events {
    margin-top: 0;
    padding-top: 8px; 
  } */
}

@media (max-width: 600px) {
  /* When notification bar is visible on mobile, push content down */
  #notification-bar.notification-bar:not(.hidden) + #content {
    padding-top: 108px; /* Header + notification bar */
  }
}


/* === Family Edit Screen Enhancements === */

/* 1. Field Group Spacing and Alignment */
.field-group label,
.child-section label,
.other-member-section label {
  display: block;
  margin: 5px 0;
}
.field-group,
.child-section,
.other-member-section {
  margin-bottom: 15px;
}

/* 2. Headings Hierarchy and Readability */
.edit-modal-body h3 {
  font-size: 1.3em;
  margin-top: 20px;
  color: #444;
}
.edit-modal-body h4 {
  font-size: 1.1em;
  margin-top: 10px;
  color: #555;
}

/* 3. Form Field Width and Responsiveness */
.edit-modal-body input,
.edit-modal-body select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* 4. Buttons Styling Consistency */
.add-field,
.remove-field {
  display: inline-block;
  margin-top: 5px;
  margin-right: 10px;
}

/* 5. Visual Grouping */
.child-section,
.other-member-section {
  background: #fafafa;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

/* 6. Modal Scroll Behavior */
.edit-modal-body {
  padding-right: 10px;
}

/* 7. Mobile Responsiveness */
@media (max-width: 600px) {
  #content .search-container #search-bar {
    width: 200px !important;
    min-width: 120px;
    font-size: 16px; /* prevent iOS zoom */
  }
}
@media (max-width: 600px) {
  .modal-content {
    width: 90vw;
    padding: 15px;
  }

  .edit-modal-body label {
    font-size: 0.9em;
  }

  .add-field,
  .remove-field {
    font-size: 0.9em;
    padding: 8px 15px;
  }
}

/* --- Collapsible Details/Summary for Modal Sections --- */
.edit-modal-body details {
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  margin-bottom: 18px;
  background: #fafbfc;
  padding: 0 0 8px 0;
  transition: box-shadow 0.2s;
}
.edit-modal-body details[open] {
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.edit-modal-body summary {
  font-weight: 600;
  font-size: 1.15em;
  padding: 10px 0 10px 6px;
  margin-bottom: 6px;
  outline: none;
  cursor: pointer;
  user-select: none;
}
.edit-modal-body details:not([open]) summary {
  border-bottom: 1px solid #e0e0e0;
}
.edit-modal-body summary::-webkit-details-marker {
  display: none;
}
.edit-modal-body summary:before {
  content: "▶";
  display: inline-block;
  margin-right: 6px;
  font-size: 0.95em;
  transition: transform 0.2s;
}
.edit-modal-body details[open] summary:before {
  content: "▼";
  transform: rotate(0deg);
}

.show-link-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background-color: #03A9F4;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
}

.show-link-btn:hover {
  background-color: #0288D1;
}


.inline-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 5px 0;
  white-space: nowrap; /* <-- this prevents the label text from wrapping */
}

/* Override block display for inline-label inside edit-modal-body */
.edit-modal-body label.inline-label {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin: 5px 0;
}

@media (max-width: 600px) {
  .edit-modal-body summary {
    font-size: 1em;
    padding: 8px 0 8px 4px;
  }
  .edit-modal-body details {
    margin-bottom: 10px;
  }
}
/* Recent Users Modal */
.modal.recent-users-modal {
  position: fixed;
  top: 60px;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
}

.recent-users-modal .modal-content {
  background: #fff;
  border-radius: 8px;
  width: 90vw;
  max-width: 600px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow-y: auto;
  max-height: 90vh;
}

.recent-users-modal .modal-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.recent-users-modal .modal-title-bar h2 {
  margin: 0;
  font-size: 1.4em;
}


.recent-users-modal .modal-body {
  font-size: 0.95em;
}

.recent-users-modal .modal-body ul {
  list-style: none;
  padding: 0;
}

.recent-users-modal .modal-body li {
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.recent-users-modal .send-msg-btn {
  margin-top: 5px;
  background: #2196F3;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
}

.recent-users-modal .send-msg-btn:hover {
  background: #1976D2;
}

/* Notification label next to user name */
.notif-label {
  color: green;
  margin-left: 4px;
}
/* Fade-in and fade-out transitions for dropdowns */
.dropdown,
#user-dropdown {
  transition: opacity 0.2s ease, visibility 0.2s ease;
  opacity: 1;
  visibility: visible;
}

.dropdown.hidden,
#user-dropdown.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
/* Highlight the logged-in user's family card */
.highlight-user-family {
  border: 2px solid #FF9800;
  box-shadow: 0 0 10px rgba(255, 152, 0, 0.4);
}
/* Ensure dropdown menu links are visible and styled properly */
.dropdown ul li[role="link"] {
  color: #333;
  font-size: 1em;
  text-decoration: none;
}
/* --- Family details toggle styles --- */
.family-details.hidden {
  display: none;
}

.toggle-details-bar {
  text-align: center;
  padding: 8px;
  background-color: #f0f0f0;
  cursor: pointer;
  font-weight: bold;
  border-top: 1px solid #ccc;
  user-select: none;
  transition: background 0.2s;
}

.toggle-details-bar:hover {
  background-color: #e0e0e0;
}
#upcoming-events .event-group ul {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 12px 32px;
  margin-bottom: 16px;
}

@media (min-width: 600px) {
  #upcoming-events .event-group ul {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 900px) {
  #upcoming-events .event-group ul {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 1200px) {
  #upcoming-events .event-group ul {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (min-width: 1600px) {
  #upcoming-events .event-group ul {
    grid-template-columns: repeat(5, 1fr);
  }
}
@media (min-width: 2000px) {
  #upcoming-events .event-group ul {
    grid-template-columns: repeat(6, 1fr);
  }
}

#upcoming-events .event-group li {
  break-inside: avoid;
  background: #fff;
  margin-bottom: 8px;
  border-radius: 5px;
  padding: 6px 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
/* ============================ */
/* Filter Button Styles */
/* ============================ */
#filter-btn {
  background-color: #2196F3;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1em;
  padding: 10px 20px;
  height: 42px;
  min-width: 90px;
  margin-left: 0;
  flex-shrink: 0;
}

#filter-btn:hover {
  background-color: #1976D2;
}

@media (max-width: 600px) {
  #filter-btn {
    font-size: 1em;
    padding: 10px 14px;
    height: 40px;
    min-width: 80px;
  }
}
#upcoming-events .event-group {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(60,90,120,0.08);
  margin-bottom: 32px;
  padding: 22px 18px 16px 18px;
  min-width: 0;
}

#upcoming-events .event-group h4 {
  font-size: 1.25em;
  margin-bottom: 10px;
  font-weight: 700;
  color: #263fa0;
  letter-spacing: 0.01em;
  border-left: 4px solid #2196F3;
  padding-left: 8px;
  background: linear-gradient(90deg, #f3f8ff 80%, #fff 100%);
  border-radius: 4px 0 0 4px;
  display: inline-block;
}

#upcoming-events .event-group ul {
  margin-top: 10px;
}

#upcoming-events .event-group:not(:last-child) {
  margin-bottom: 36px;
}

#upcoming-events .event-group li {
  margin-bottom: 8px;
  background: #f9fbff;
  border: 1px solid #e3e9f3;
  border-radius: 7px;
  padding: 9px 14px;
  box-shadow: 0 1px 3px rgba(80,120,180,0.03);
}

#upcoming-events .event-group li h4 {
  font-size: 1em;
  margin: 0;
  font-weight: 500;
  color: #222;
}

#upcoming-events .event-group li h4 span,
#upcoming-events .event-group li .note {
  font-size: 0.9em;
  color: #446;
}
# Mobile-specific adjustments for upcoming events and main container
@media (max-width: 900px) {
  #upcoming-events {
    max-width: 100vw;
    width: 100vw;
    margin-left: 0;
    margin-right: 0;
    border-radius: 0;
    padding-left: 8px;
    padding-right: 8px;
  }
  .container, .main-content {
    max-width: 100vw;
    width: 100vw;
    padding-left: 8px;
    padding-right: 8px;
  }
}

/* Today's public events override to ensure visibility */
#upcoming-events .event-group li.today-event {
  border: 1px solid #2196F3;
  box-shadow: 0 0 8px 2px rgba(33, 150, 243, 0.7);
  background-color: #fff !important;
}

/* Fullscreen overlay for AI Chat modal */
#ai-chat-modal.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

#ai-chat-modal .modal-content {
  width: 90vw;
  max-width: 600px;
  height: 90vh;
  background: #fff;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 32px rgba(0,0,0,0.2);
  position: relative;
}