/* --- General Styling & Variables --- */
:root {
  --primary-color: #3498db;
  --primary-color-dark: #2980b9;
  --secondary-color: #2c3e50;
  --background-color: #ecf0f1;
  --restricted-color: #e74c3c;
  --restricted-color-dark: #c0392b;
  --text-color: #34495e;
  --light-gray: #bdc3c7;
  --white: #ffffff;
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  opacity: 0;
  animation: fadeIn 1s 0.2s ease-in-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.container {
  background-color: var(--white);
  position: relative; /* Needed for the absolute positioning of the auth button */
  padding: 60px 50px 40px 50px; /* Adjusted padding for auth button */
  border-radius: 15px;
  box-shadow: var(--shadow);
  text-align: center;
  max-width: 1200px; /* Increased from 800px for better screen utilization */
  width: 90%; /* Use 90% of viewport width instead of fixed 100% */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.container:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* --- Header --- */
header {
  /* This creates the separator below the title and above the nav */
  padding-bottom: 30px;
  border-bottom: 1px solid #e0e0e0;
}
header h1 {
  color: var(--secondary-color);
  font-size: 2.5rem;
  margin-bottom: 10px;
  font-weight: 700;
}

header .subtitle {
  font-size: 1.2rem;
  color: var(--primary-color);
  font-weight: 300;
}

/* --- Main Content --- */
/*noinspection CssUnusedSymbol*/
main .intro {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 40px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  /* The separator above the nav is on the header. Add margins for spacing. */
  margin-top: 30px;
  /* Add a separator and spacing below the nav */
  padding-bottom: 30px;
  border-bottom: 1px solid #e0e0e0;
}

.nav-link {
  background-color: var(--primary-color);
  color: var(--white);
  text-decoration: none;
  padding: 15px 25px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 400;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.nav-link:hover {
  background-color: var(--primary-color-dark); /* Use the variable */
  transform: translateY(-3px);
}

.nav-link i {
  font-size: 1.2rem;
}

/* --- Footer --- */
footer {
  margin-top: 50px;
  border-top: 1px solid #e0e0e0;
  padding-top: 20px;
}

/*noinspection CssUnusedSymbol*/
.social-links {
  margin-bottom: 15px;
}

.social-links a {
  color: var(--secondary-color);
  font-size: 1.5rem;
  margin: 0 15px;
  text-decoration: none;
  transition: color 0.3s ease, transform 0.3s ease;
  display: inline-block;
}

.social-links a:hover {
  color: var(--primary-color);
  transform: scale(1.2);
}

footer p {
  font-size: 0.9rem;
  color: var(--light-gray);
}

/* --- Footer Credits --- */
footer .credits {
  font-size: 0.8rem;
  color: var(--light-gray);
  margin-top: 10px;
}
footer .credits a {
  color: var(--light-gray);
  text-decoration: none;
}
footer .credits a:hover {
  text-decoration: underline;
}

/* --- Login Page Specific Styles --- */
.login-container {
  max-width: 450px;
}

.login-subtitle {
  margin-bottom: 20px;
}

.form-message-visible {
  display: block;
}

.btn-full-width {
  width: 100%;
}

.login-footer {
  margin-top: 30px;
}

.back-link-small {
  font-size: 0.9rem;
}

/* --- Admin Form Specific Styles --- */
.section-header-left {
  text-align: left;
}

.current-image-text {
  margin-top: 10px;
}

.current-thumbnail {
  max-width: 200px;
  margin-top: 10px;
  border-radius: 5px;
}

.back-link-spaced {
  margin-left: 15px;
}

.nav-home-icon {
  color: #B197FC;
}

/* --- Responsive Design --- */
/* Enhanced responsive breakpoints for better screen utilization */
@media (min-width: 1400px) {
  .container {
    max-width: 1400px; /* Even larger on very wide screens */
    width: 85%; /* Slightly less width on very wide screens for readability */
  }
}

@media (max-width: 1200px) {
  .container {
    width: 95%; /* Use more space on medium screens */
  }
}

@media (max-width: 900px) {
  .container {
    width: 98%; /* Nearly full width on tablets */
    padding: 50px 40px 35px 40px;
  }
}

/* Tablet navigation improvements */
@media (max-width: 1024px) and (min-width: 769px) {
  .main-nav {
    gap: 15px;
  }
  
  .nav-link {
    padding: 12px 20px;
    font-size: 0.95rem;
  }
  
  .nav-link i {
    font-size: 1.1rem;
  }
}

/* Mobile and small tablet navigation */
@media (max-width: 768px) {
  .main-nav {
    gap: 10px;
  }
  
  .nav-link {
    padding: 10px 15px;
    font-size: 0.9rem;
  }
  
  .nav-link span {
    display: none; /* Hide text on small screens, show icons only */
  }
  
  .nav-link {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .container {
    width: 100%; /* Full width on mobile */
    padding: 30px 20px;
    margin: 10px; /* Add small margin on mobile for better appearance */
  }

  header h1 {
    font-size: 2rem;
  }

  .main-nav {
    flex-direction: row; /* Keep horizontal layout but with icons only */
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
  }

  .nav-link {
    justify-content: center;
    min-width: 60px;
    flex: none;
  }

  body {
    padding: 10px; /* Reduce body padding on mobile */
  }
}

/* --- Sub-page Specific Styles --- */

.page-header {
  margin-bottom: 40px;
  /* The main nav now provides the primary separator, so this one is removed for consistency. */
  /* border-bottom: 1px solid #e0e0e0; */
}

.page-header h1 {
  margin-bottom: 15px;
}

.project-subtitle {
  margin-top: 15px;
  margin-bottom: 2em;
  font-size: 1.2rem;
  color: #555;
  font-weight: 300;
}

.back-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.3s ease;
}

.back-link:hover {
  color: var(--primary-color-dark);
  text-decoration: underline;
}

/* Project Page */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  text-align: left;
}

.project-card {
  background-color: #fdfdfd;
  border: 1px solid #e7e7e7;
  border-radius: 8px;
  padding: 25px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.project-card h3 {
  color: var(--secondary-color);
  margin-bottom: 10px;
}

.project-card p {
  line-height: 1.6;
  margin-bottom: 20px;
}

.project-links a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 700;
  margin-right: 15px;
}

.project-links a:hover {
  text-decoration: underline;
}

/* Blog Page */
.blog-post-list {
  text-align: left;
}

.blog-post {
  border-bottom: 1px solid #e0e0e0;
  padding: 25px 0;
}

.blog-post:last-child {
  border-bottom: none;
}

.blog-post h2 a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

.blog-post h2 a:hover {
  color: var(--primary-color);
}

.post-meta {
  font-size: 0.9rem;
  color: var(--light-gray);
  margin: 5px 0 10px;
}

/* About Page */
.about-section {
  display: flex;
  align-items: center;
  gap: 40px;
  text-align: left;
}

.about-image img {
  max-width: 250px;
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.about-text h2 {
  color: var(--secondary-color);
  margin-bottom: 15px;
}

.about-text p {
  line-height: 1.7;
  margin-bottom: 15px;
}

/* MELD Calculator Specific Styles */
.dialysis-checkbox-group {
  margin: 1rem 0;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 5px;
  border: 1px solid #dee2e6;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.4;
  cursor: pointer;
  margin: 0;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

.checkbox-text {
  flex: 1;
  color: #495057;
}

.optn-tooltip {
  color: #007bff;
  font-size: 1.2rem;
  cursor: help;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.optn-tooltip:hover {
  color: #0056b3;
}

.meld-input::placeholder {
  color: #999;
  font-size: 0.9rem;
}

#meldResultContainer {
  margin-top: 1.5rem;
  padding: 1rem;
  background-color: #e8f5e8;
  border: 2px solid #28a745;
  border-radius: 5px;
}

#meldResult {
  margin: 0 0 1rem 0;
  color: #155724;
}

#meldResult small {
  display: block;
  margin-top: 0.5rem;
  font-style: italic;
}

/* View button styling */
.btn-record-view {
  background-color: #17a2b8;
  color: white;
  border: none;
  padding: 0.375rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.875rem;
  margin-right: 0.25rem;
  transition: background-color 0.2s;
}

.btn-record-view:hover {
  background-color: #138496;
}

.btn-record-view i {
  font-size: 0.8rem;
}

/* Contact Page */
.contact-form {
  max-width: 600px;
  margin: 0 auto;
  text-align: left;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--secondary-color);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--light-gray);
  border-radius: 5px;
  font-family: 'Roboto', sans-serif;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.btn-submit {
  background-color: var(--primary-color);
  color: var(--white);
  padding: 12px 25px;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn-submit:hover {
  background-color: var(--primary-color-dark);
}

/* Responsive adjustments for sub-pages */
/* Large tablets and small desktops */
@media (max-width: 1024px) {
  .about-section {
    gap: 30px;
  }
  
  .about-image img {
    max-width: 200px;
  }
  
  .project-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
  }
}

/* Regular tablets */
@media (max-width: 768px) {
  .about-section {
    flex-direction: column;
    text-align: center;
    gap: 25px;
  }
  
  .about-image img {
    max-width: 180px;
  }
  
  .project-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .contact-form {
    max-width: 100%;
    padding: 0 10px;
  }
  
  .form-group input,
  .form-group textarea {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* Small tablets and large phones */
@media (max-width: 480px) {
  .about-image img {
    max-width: 150px;
  }
  
  .project-card {
    padding: 0;
  }
  
  .project-card h3,
  .project-card p {
    padding: 0 15px;
  }
  
  .project-card .project-links {
    padding: 10px 15px 15px 15px;
  }
  
  .project-links a {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}
/* --- Form Status Messages --- */
/*noinspection CssUnusedSymbol*/
.form-status {
  margin-top: 20px;
  padding: 15px;
  border-radius: 5px;
  font-weight: 700;
  display: none; /* Hidden by default */
}

/*noinspection CssUnusedSymbol*/
.form-status.success {
  display: block;
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/*noinspection CssUnusedSymbol*/
.form-status.error {
  display: block;
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Add a style for the sending state of the button */
/*noinspection CssUnusedSymbol*/
.btn-submit .fa-spinner {
  margin-right: 8px;
}

/* For form submission feedback messages */
.form-message {
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 5px;
  font-weight: bold;
  text-align: center;
  border: 1px solid transparent;
}

.form-message.success {
  background-color: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}

.form-message.error {
  background-color: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}
/* --- Enhanced Project Card Styling --- */

/* Style the main title link within the card to remove the underline */
.project-card h3 a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

.project-card h3 a:hover {
  color: var(--primary-color);
}

/* Overwrite the default project links to be styled as buttons */
.project-links a {
  background-color: #f0f0f0;
  color: var(--secondary-color);
  text-decoration: none;
  font-weight: 500; /* Slightly less bold */
  font-size: 0.9rem;
  padding: 8px 15px;
  border-radius: 5px;
  border: 1px solid #e0e0e0;
  transition: all 0.3s ease;
  display: inline-block;
  margin-right: 5px;
  margin-bottom: 5px; /* Helps with wrapping on small screens */
}

.project-links a:hover {
  background-color: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color-dark);
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
  text-decoration: none; /* Ensure no underline on hover */
}

/* Ensure links are pushed to the bottom of the card */
.project-card {
  display: flex;
  flex-direction: column;
}

.project-links {
  margin-top: auto; /* This pushes the links to the bottom */
  padding-top: 10px; /* Add some space above the buttons */
}
/* --- Clickable Card Overlay --- */
.project-card {
  position: relative; /* Required for the overlay to work */
  overflow: hidden; /* Prevent overlay issues */
}

.card-link-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1; /* Sits above the card content */
  pointer-events: auto; /* Ensure proper pointer events */
  cursor: pointer;
}

/* Ensure the title and action buttons are clickable above the overlay */
.project-card h3,
.project-links {
  position: relative;
  z-index: 2;
  pointer-events: auto; /* Explicitly allow pointer events */
}

/* Fix potential cursor issues when moving outside cards */
.project-card:hover .card-link-overlay {
  cursor: pointer;
}

.project-card h3:hover,
.project-links:hover {
  cursor: default;
}

.project-links a:hover {
  cursor: pointer;
}
/* --- Project Card Image Styling --- */
.project-card-image {
  width: 100%;
  height: auto;
  border-radius: 8px 8px 0 0; /* Rounded corners only on top */
  display: block;
  border-bottom: 1px solid #e7e7e7;
  aspect-ratio: 16 / 10; /* Maintain a consistent aspect ratio */
  object-fit: cover; /* Ensure images fill the space without distortion */
  position: relative; /* Sits below the overlay link */
  z-index: 0;
}

/* Adjust card padding to accommodate the image */
.project-card {
  padding: 0; /* Remove existing padding */
}

.project-card h3,
.project-card p {
  padding: 0 25px; /* Add padding to text elements */
}

.project-card h3 {
  margin-top: 20px; /* Space above the title */
}

.project-card .project-links {
  padding: 15px 25px 25px 25px; /* Add padding to the links container */
}


/* --- Blog Post Image Styling --- */
.blog-post {
  display: flex;
  gap: 25px;
  align-items: flex-start; /* Align items to the top */
}

.blog-post-image-link {
  flex-shrink: 0; /* Prevent image from shrinking */
}

.blog-post-image {
  width: 200px;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.blog-post-image-link:hover .blog-post-image {
  transform: scale(1.05);
}

.blog-post-content {
  flex-grow: 1; /* Allow text content to take remaining space */
}

/* Responsive adjustment for blog posts */
@media (max-width: 600px) {
  .blog-post {
    flex-direction: column; /* Stack image and text on small screens */
  }
  .blog-post-image {
    width: 100%; /* Make image full-width on small screens */
  }
}
.project-image-main figcaption {
  text-align: center;
  font-style: italic;
  color: #777;
  margin-top: 10px;
  font-size: 0.9rem;
}

/* --- Responsive Images for Blog Content --- */
/* This class is added by TinyMCE to uploaded images */
/*noinspection CssUnusedSymbol*/
.img-responsive {
  max-width: 100%;
  height: auto;
  display: block; /* Prevents extra space below the image */
  margin: 1em 0; /* Adds some vertical spacing */
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.blog-post-full p {
  margin-bottom: 1.2em;
}
.blog-post-full h3 {
  margin-top: 1.5em;
  margin-bottom: 0.8em;
}
/* --- Image Lightbox/Modal Styling --- */
/*noinspection CssUnusedSymbol*/
.lightbox {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  animation: fadeIn 0.4s; /* Use existing fadeIn animation */
}

.lightbox-content {
  margin: auto;
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90%;
  max-height: 85%;
  animation: zoomIn 0.4s;
}

@keyframes zoomIn {
  from {transform: translate(-50%, -50%) scale(0.5)}
  to {transform: translate(-50%, -50%) scale(1)}
}

.lightbox-close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
}

.lightbox-close:hover,
.lightbox-close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

/* Add a pointer cursor to images that can be enlarged */
/*noinspection CssUnusedSymbol*/
.enlargeable {
  cursor: pointer;
  transition: opacity 0.3s ease;
}

/*noinspection CssUnusedSymbol*/
.enlargeable:hover {
  opacity: 0.8;
}
/* --- Image Remove Toggle Styling --- */
.image-remove-toggle {
    display: flex;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 10px; /* Reduced space below the toggle */
}

.image-remove-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.image-remove-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background-color: var(--restricted-color);
    color: var(--white);
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
    user-select: none;
}

.image-remove-toggle label:hover {
    background-color: var(--restricted-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.image-remove-toggle label::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    content: "\f00d";
    margin-right: 5px;
}

.image-remove-toggle input[type="checkbox"]:checked + label {
    background-color: #c0392b;
    border: 1px solid #a02c20;
}

.image-remove-toggle input[type="checkbox"]:checked + label::before {
    content: "\f058";
}

/* --- Project Detail Page Image Styling --- */
.project-image-main {
  margin: 30px 0; /* Add some space around the image container */
}

.project-image-main img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: var(--shadow);

  /* --- Key properties for consistent sizing --- */
  aspect-ratio: 16 / 9; /* A common widescreen ratio for featured images */
  object-fit: cover;    /* Fills the container, cropping if necessary, without distortion */
}
/* --- Styling for Video Elements --- */
.project-video-main video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* --- Site-wide Auth Button --- */
.site-auth-button {
  position: absolute;
  top: 20px;
  right: 25px;
  width: 32px;
  height: 32px;
  z-index: 10;
  transition: transform 0.2s ease;
}
.site-auth-button:hover {
  transform: scale(1.1);
}
.site-auth-button img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* --- Styling for Icon-Only Navigation Links --- */
.nav-link:has(i:only-child) {
  padding-left: 20px;
  padding-right: 20px;
}

.nav-link:has(i:only-child) i {
  margin: 0; /* Remove any default margins from the icon */
  font-size: 1.4rem; /* Make the icon slightly larger to fill the space */
}

.nav-link.nav-link-icon-only {
  padding: 15px; /* Make it square-ish */
}
.nav-link.nav-link-icon-only span {
  display: none; /* Hide text if it exists */
}
.nav-link.nav-link-icon-only i {
  margin: 0;
  font-size: 1.4rem;
}
/* Style for custom image-based icons in the navigation */
.nav-link.nav-link-icon-only .nav-icon-img {
  height: 1.4rem; /* Explicitly set height to match the font-size of other icons */
  width: 1.4rem;  /* Explicitly set width to create a consistent square icon */
  object-fit: contain; /* Ensures the SVG scales down to fit without distortion */
  vertical-align: middle; /* Align vertically with other icons */
}

/* --- Styling for Restricted Access Button --- */
/*noinspection CssUnusedSymbol*/
.nav-link:has(.fa-shield-heart) {
  background-color: var(--restricted-color);
}

/*noinspection CssUnusedSymbol*/
.nav-link:has(.fa-shield-heart):hover {
  background-color: var(--restricted-color-dark);
}
/* --- Page-Specific Navigation Adjustments --- */
.medical-page-nav {
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
}
/* --- Medical Page Specific Styles --- */

/* Align main content to the left for readability */
.content-left {
  text-align: left;
}

/* Add an active state to the current navigation button */
/*noinspection CssUnusedSymbol*/
.nav-link.active {
  background-color: var(--primary-color-dark);
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* Data tables */
.table-container {
  overflow-x: auto; /* Allows horizontal scrolling on small screens */
  margin-top: 20px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 12px 15px;
  border: 1px solid #ddd;
}
th {
  background-color: #f8f9fa;
  font-weight: 700;
}
tbody tr:nth-child(even) {
  background-color: #fdfdfd;
}

/*noinspection CssUnusedSymbol*/
.status-high { color: #e74c3c; font-weight: bold; }

/*noinspection CssUnusedSymbol*/
.status-low { color: #3498db; font-weight: bold; }

/*noinspection CssUnusedSymbol*/
.status-normal { color: #2ecc71; }

/* Data sections */
.data-section {
  margin-bottom: 40px;
}

/* Event cards */
.event-card {
  background-color: #fdfdfd;
  border-left: 4px solid var(--primary-color);
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 0 8px 8px 0;
}
.event-card h3 {
  margin-bottom: 5px;
}

/* PDF Record List */
.record-list {
  list-style: none;
  margin-top: 20px;
}
.record-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 10px;
  background-color: #fdfdfd;
}
.record-info {
  display: flex;
  align-items: center;
  gap: 15px;
  font-weight: 500;
}

.record-info small {
  display: block;
  color: #777;
  font-weight: normal;
}
.record-info i {
  font-size: 1.5rem;
  color: var(--restricted-color);
}
.record-actions a {
  text-decoration: none;
  color: var(--white);
  padding: 8px 15px;
  border-radius: 5px;
  font-size: 0.9rem;
  font-weight: 700;
  transition: background-color 0.3s ease;
  margin-left: 10px;
}
.btn-record-view {
  background-color: var(--primary-color);
}
.btn-record-view:hover {
  background-color: var(--primary-color-dark);
}
.btn-record-download {
  background-color: var(--secondary-color);
}
.btn-record-download:hover {
  background-color: #1e2b37;
}
/* --- Record Action Button Styling --- */
.record-actions button {
  text-decoration: none;
  color: var(--white);
  padding: 8px 12px; /* Adjusted for icon-only */
  border-radius: 5px;
  font-size: 0.9rem;
  transition: background-color 0.3s ease;
  margin-left: 5px; /* Reduced margin */
  border: none;
  cursor: pointer;
}

.btn-record-edit {
  background-color: #f39c12; /* Orange for edit */
}
.btn-record-edit:hover {
  background-color: #e67e22;
}

.btn-record-delete {
  background-color: var(--restricted-color); /* Red for delete */
}
.btn-record-delete:hover {
  background-color: var(--restricted-color-dark);
}

/* Adjust original link buttons to be icon-only */
.record-actions .btn-record-view,
.record-actions .btn-record-download {
  padding: 8px 12px;
}
/* Center-align the action buttons in table columns */
.actions-column {
  text-align: center;
  width: 120px; /* Give a fixed width to prevent layout shifts */
}

td.record-actions {
  text-align: center;
  white-space: nowrap;
}
/* --- Modal styles EXACTLY like test page --- */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  overflow: auto;
}

.modal-content {
  background-color: var(--white);
  margin: 10vh auto;
  padding: 30px 40px;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  position: relative;
}

/* Desktop-specific modal improvements */
@media (min-width: 1024px) {
  .modal-content {
    width: 70%;
    max-width: 700px;
  }
}

/* Body scroll prevention - EXACT same as test page */
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}
  z-index: 9999 !important;
  background-color: rgba(0, 0, 0, 0.6) !important;
}

/* Ensure modals render above EVERYTHING, including body's flex positioning */
.modal[style*="display: block"] {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  background: rgba(0, 0, 0, 0.6) !important;
  /* Override any parent positioning context */
  contain: layout style paint size !important;
  /* Force rendering on top layer */
  isolation: isolate !important;
}

/* NUCLEAR OPTION: Force ALL modals to cover entire viewport */
#entryModal.modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 10000 !important;
  background: rgba(0, 0, 0, 0.6) !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Force entryModal to show when display is block */
#entryModal.modal[style*="display: block"],
#entryModal.modal[style*="display:block"] {
  display: block !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 10000 !important;
  background: rgba(0, 0, 0, 0.6) !important;
  transform: none !important;
  translate: none !important;
}

/* ULTRA AGGRESSIVE: Override any inline styles that might interfere */
#entryModal[style] {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.6) !important;
  z-index: 10000 !important;
}

/* Ensure HTML and body don't interfere with modal positioning */
html:has(#entryModal[style*="display: block"]) {
  position: static !important;
  overflow: hidden !important;
}

body:has(#entryModal[style*="display: block"]) {
  position: static !important;
  overflow: hidden !important;
}

/* Force the modal to be positioned relative to the viewport, not any container */
#entryModal[style*="display: block"] {
  position: fixed !important;
  inset: 0 !important;
  contain: none !important;
  isolation: auto !important;
}

@keyframes slideIn {
  from { transform: translateY(-50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-close {
  color: var(--light-gray);
  position: absolute;
  top: 15px;
  right: 25px;
  font-size: 28px;
  font-weight: bold;
  transition: color 0.3s ease;
}

.modal-close:hover,
.modal-close:focus {
  color: var(--secondary-color);
  text-decoration: none;
  cursor: pointer;
}
/* --- Header Links Styling --- */
/*noinspection CssUnusedSymbol*/
.header-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

/*noinspection CssUnusedSymbol*/
.logout-link {
  color: var(--restricted-color) !important;
}

/*noinspection CssUnusedSymbol*/
.logout-link:hover {
  color: var(--restricted-color-dark) !important;
}
/* --- Project Detail Page Link Buttons --- */
.project-links-detail {
  margin-top: 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-project {
  background-color: var(--primary-color);
  color: var(--white);
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-project:hover {
  background-color: var(--primary-color-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* Style the GitHub button differently to create visual distinction */
.btn-project.github {
  background-color: var(--secondary-color);
}

.btn-project.github:hover {
  background-color: #1e2b37; /* A darker shade of the secondary color */
}

/* A specific style for the edit button on project/blog pages to match the aesthetic */
.btn-project.edit {
  background-color: #f39c12; /* Orange for edit actions */
}

.btn-project.edit:hover {
  background-color: #e67e22;
}

/* --- Admin Table Reordering Styles --- */
.sortable-table tbody tr {
  cursor: grab;
}

/* Style for the placeholder element that shows where an item will be dropped */
/*noinspection CssUnusedSymbol*/
.sortable-ghost {
  background-color: #d4edda;
  opacity: 0.7;
}

/* Style for the item being dragged */
/*noinspection CssUnusedSymbol*/
.sortable-drag {
  opacity: 0.9;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.admin-actions-footer {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.reorder-hint {
  color: #777;
  font-size: 0.9rem;
}
/* --- Admin Dashboard Styles --- */
.admin-dashboard {
  width: 100%;
  text-align: left;
}

.admin-tabs {
  display: flex;
  /* Add a top border to serve as the separator from the toolbar */
  border-top: 1px solid #e0e0e0;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 30px;
  /* Add padding to create space between the new top border and the tab text */
  padding-top: 15px;
}

.admin-tab {
  padding: 15px 25px;
  cursor: pointer;
  font-weight: 700;
  color: var(--light-gray);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transform: translateY(2px);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-tab:hover {
  color: var(--secondary-color);
}

.admin-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.admin-tab.disabled {
  color: #ccc;
  cursor: not-allowed;
  background-color: #f8f9fa;
}

.admin-tab-content .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.admin-tab-content .section-header h3 {
  margin: 0;
}

.btn-add {
  background-color: var(--primary-color);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.3s ease;
}

.btn-add:hover {
  background-color: var(--primary-color-dark);
}

.btn-icon {
  background-color: #f0f0f0;
  color: var(--secondary-color);
  text-decoration: none;
  width: 50px;
  height: 50px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  border: 1px solid #e0e0e0;
  transition: all 0.3s ease;
  font-size: 1.2rem;
  margin: 15px;
}

.btn-icon:hover {
  background-color: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color-dark);
  transform: scale(1.1);
}
/* --- Admin Dashboard Toolbar --- */
.admin-toolbar {
  display: flex;
  justify-content: center;
}
/* --- Responsive Admin Dashboard --- */
@media (max-width: 768px) {
  .admin-toolbar,
  .admin-tabs {
    /*
     * World-Class Improvement: Enable horizontal scrolling on mobile.
     * This changes the alignment to the start and allows the container
     * to scroll if its contents are too wide for the screen.
     */
    justify-content: flex-start; /* Align items to the left for scrolling */
    overflow-x: auto;          /* The key property to enable horizontal scrolling */
    -webkit-overflow-scrolling: touch; /* Provides a smoother, native-like scrolling experience on iOS devices */
  }

  /*
   * To prevent the flex items from shrinking before they scroll,
   * we ensure they maintain their original size.
   */
  .admin-toolbar .btn-icon,
  .admin-tabs .admin-tab {
    flex-shrink: 0;
  }

  /*
   * Optional: Subtle scrollbar styling for a cleaner look on browsers that support it.
   */
  .admin-toolbar::-webkit-scrollbar,
  .admin-tabs::-webkit-scrollbar {
    height: 6px; /* Makes the scrollbar less intrusive */
  }

  .admin-toolbar::-webkit-scrollbar-track,
  .admin-tabs::-webkit-scrollbar-track {
    background: transparent; /* Hide the track */
  }

  .admin-toolbar::-webkit-scrollbar-thumb,
  .admin-tabs::-webkit-scrollbar-thumb {
    background-color: #ccc; /* A subtle gray for the scrollbar handle */
    border-radius: 3px;
  }
}
.user-manager-form {
    max-width: none;
    margin-top: 1em;
}

.password-hash-cell {
    width: 30%;
}

.password-hash-content {
    word-break: break-all;
    font-size: 0.8rem;
}

.form-message-container {
    margin-top: 15px;
}
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
}

.widget {
  background-color: #fdfdfd;
  border: 1px solid #e7e7e7;
  border-radius: 8px;
  padding: 25px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.kpi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.kpi-card i {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 15px;
}

.kpi-value {
  font-size: 3rem;
  font-weight: 700;
  color: var(--secondary-color);
  line-height: 1;
}

.kpi-label {
  font-size: 1rem;
  color: var(--light-gray);
  margin-top: 5px;
}

.chart-widget.large {
  grid-column: 1 / -1; /* Make chart widgets span the full width */
}

/* --- Bulk Operations Styles --- */
.bulk-controls {
  display: none;
  align-items: center;
  gap: 15px;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  padding: 15px 20px;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  margin: 15px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bulk-selected-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--secondary-color);
  font-weight: 600;
  font-size: 0.95rem;
}

.bulk-selected-count {
  background: var(--primary-color);
  color: white;
  padding: 2px 8px;
  border-radius: 15px;
  font-size: 0.85rem;
  min-width: 20px;
  text-align: center;
}

.bulk-action-select {
  padding: 8px 12px;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  background: white;
  color: var(--text-color);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.3s ease;
  min-width: 160px;
}

.bulk-action-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.bulk-execute-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bulk-execute-btn:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  opacity: 0.6;
}

.bulk-execute-btn:not(:disabled):hover {
  background: var(--primary-color-dark);
  transform: translateY(-1px);
}

.bulk-select-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary-color);
  transform: scale(1.1);
}

.bulk-select-all {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
  transform: scale(1.2);
}

.bulk-select-all-container {
  margin-bottom: 15px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 5px;
}

.bulk-select-all-container label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--secondary-color);
  margin: 0;
}

.bulk-select-all-container input[type="checkbox"] {
  transform: scale(1.2);
}

.bulk-selected {
  background: rgba(52, 152, 219, 0.05) !important;
  border-left: 4px solid var(--primary-color) !important;
}

.bulk-selected td {
  position: relative;
}

.bulk-checkbox-column {
  width: 40px;
  text-align: center;
}

.bulk-message-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  max-width: 400px;
}

.bulk-message {
  padding: 15px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  animation: slideInRight 0.3s ease-out;
  position: relative;
  overflow: hidden;
}

.bulk-message-success {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  border-left: 5px solid #229954;
}

.bulk-message-error {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border-left: 5px solid #a93226;
}

.bulk-message::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  animation: progressBar 5s linear;
  width: 100%;
}

@keyframes progressBar {
  from { width: 100%; }
  to { width: 0%; }
}

/* Superuser-only action styling */
.bulk-action-superuser {
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
  color: white;
  font-weight: bold;
}

.bulk-action-superuser:disabled {
  background: #bdc3c7;
  color: #7f8c8d;
}

/* Modal overrides for bulk description edit */
.modal .contact-form .form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.btn-secondary {
  background: #95a5a6;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.3s ease;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

/* Table checkbox column styling */
th.bulk-checkbox-column,
td.bulk-checkbox-column {
  width: 50px;
  padding: 8px !important;
  text-align: center;
}

/* Event cards for bulk operations */
.event-card {
  position: relative;
  padding-left: 40px;
}

.event-card .bulk-checkbox-column {
  position: absolute;
  top: 10px;
  left: 10px;
}

/* Record list bulk operations */
.record-list li {
  position: relative;
}

.record-list .bulk-checkbox-column {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 10;
}

.record-list.bulk-operations-table .record-info {
  margin-left: 35px;
}

/* Responsive bulk controls */
@media (max-width: 768px) {
  .bulk-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 15px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
    border-bottom: 1px solid #e0e0e0;
  }
  
  .bulk-selected-info {
    justify-content: center;
  }
  
  .bulk-action-select {
    width: 100%;
  }
  
  .bulk-execute-btn {
    justify-content: center;
  }
  
  .bulk-message-container {
    left: 10px;
    right: 10px;
    top: 10px;
    max-width: none;
  }
  
  /* Ensure admin panel content scrolls properly instead of rearranging */
  .admin-dashboard {
    overflow-x: hidden;
    overflow-y: auto;
  }
  
  .admin-tab-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix table containers on mobile */
  .table-container {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
  }
  
  /* Prevent content rearrangement issues */
  .data-section {
    overflow-x: auto;
    overflow-y: visible;
  }
  
  .event-card,
  .record-list,
  .project-grid {
    overflow-x: visible;
    overflow-y: visible;
  }
}

/* --- Medical Search Styles --- */
.medical-search-container {
  margin: 25px 0;
  animation: slideInDown 0.3s ease-out;
}

.medical-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #f8f9fa, #ffffff);
  border: 2px solid #e9ecef;
  border-radius: 15px;
  padding: 5px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  overflow: hidden;
}

.medical-search-wrapper.focused {
  border-color: var(--primary-color);
  box-shadow: 0 4px 20px rgba(52, 152, 219, 0.15), 0 0 0 3px rgba(52, 152, 219, 0.1);
  transform: translateY(-2px);
}

.medical-search-icon {
  position: absolute;
  left: 20px;
  font-size: 1.1rem;
  color: var(--light-gray);
  pointer-events: none;
  transition: color 0.3s ease;
  z-index: 2;
}

.medical-search-wrapper.focused .medical-search-icon {
  color: var(--primary-color);
}

.medical-search-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 15px 50px 15px 50px;
  font-size: 1rem;
  color: var(--text-color);
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  transition: all 0.3s ease;
}

.medical-search-input::placeholder {
  color: var(--light-gray);
  transition: color 0.3s ease;
}

.medical-search-wrapper.focused .medical-search-input::placeholder {
  color: rgba(189, 195, 199, 0.7);
}

.medical-search-clear {
  position: absolute;
  right: 15px;
  background: none;
  border: none;
  color: var(--light-gray);
  font-size: 1rem;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 2;
}

.medical-search-clear:hover {
  background-color: rgba(231, 76, 60, 0.1);
  color: var(--restricted-color);
  transform: scale(1.1);
}

.medical-search-clear:active {
  transform: scale(0.95);
}

.medical-search-results {
  font-size: 0.9rem;
  color: var(--secondary-color);
  margin-top: 10px;
  padding: 8px 15px;
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), rgba(52, 152, 219, 0.05));
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  font-weight: 500;
  animation: fadeIn 0.3s ease;
}

.medical-search-no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--light-gray);
  background: linear-gradient(135deg, #f8f9fa, #ffffff);
  border: 2px dashed #dee2e6;
  border-radius: 15px;
  margin: 20px 0;
  animation: fadeIn 0.3s ease;
}

.medical-search-no-results i {
  font-size: 2rem;
  margin-bottom: 15px;
  color: var(--light-gray);
}

.medical-search-no-results p {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 500;
}

/* Search highlighting */
.medical-search-highlight {
  background: linear-gradient(135deg, #fff3cd, #ffeeba);
  color: #856404;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 700;
  border: 1px solid #ffeaa7;
  box-shadow: 0 1px 3px rgba(255, 193, 7, 0.3);
  animation: highlightPulse 0.6s ease;
  display: inline;
  line-height: 1.2;
}

/* Ensure mark elements inherit proper styling */
mark.medical-search-highlight {
  background: linear-gradient(135deg, #fff3cd, #ffeeba);
  color: #856404;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 700;
  border: 1px solid #ffeaa7;
  box-shadow: 0 1px 3px rgba(255, 193, 7, 0.3);
  animation: highlightPulse 0.6s ease;
}

@keyframes highlightPulse {
  0% {
    transform: scale(1);
    background: linear-gradient(135deg, #fff3cd, #ffeeba);
  }
  50% {
    transform: scale(1.05);
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
  }
  100% {
    transform: scale(1);
    background: linear-gradient(135deg, #fff3cd, #ffeeba);
  }
}

/* Search item animations */
.search-visible {
  animation: searchItemShow 0.3s ease;
}

.search-hidden {
  animation: searchItemHide 0.2s ease;
}

@keyframes searchItemShow {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes searchItemHide {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-5px);
  }
}

/* Responsive search bar */
@media (max-width: 768px) {
  .medical-search-wrapper {
    border-radius: 12px;
    padding: 3px;
  }
  
  .medical-search-input {
    padding: 12px 40px 12px 45px;
    font-size: 0.95rem;
  }
  
  .medical-search-icon {
    left: 15px;
    font-size: 1rem;
  }
  
  .medical-search-clear {
    right: 12px;
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }
  
  .medical-search-results {
    font-size: 0.85rem;
    padding: 6px 12px;
  }
  
  .medical-search-no-results {
    padding: 30px 15px;
  }
  
  .medical-search-no-results i {
    font-size: 1.5rem;
  }
  
  .medical-search-no-results p {
    font-size: 1rem;
  }
}

/* Dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
  .medical-search-wrapper {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-color: #495057;
  }
  
  .medical-search-input {
    color: #ecf0f1;
  }
  
  .medical-search-input::placeholder {
    color: #95a5a6;
  }
  
  .medical-search-results {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.15), rgba(52, 152, 219, 0.08));
    color: #ecf0f1;
  }
  
  .medical-search-no-results {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-color: #495057;
    color: #95a5a6;
  }
}

/* Integration with existing medical page styles */
.medical-page-nav + .medical-search-container {
  margin-top: 30px;
}

.section-header + .medical-search-container {
  margin-top: 20px;
  margin-bottom: 25px;
}

/* Ensure search works well with bulk operations */
.medical-search-container + .bulk-controls {
  margin-top: 15px;
}

/* Special spacing for MELD page search placement */
.data-section .medical-search-container {
  margin: 30px 0;
  border-top: 1px solid #e9ecef;
  padding-top: 25px;
}

.data-section .medical-search-container + h3 {
  margin-top: 0;
}

/* Search bar between sections (like on MELD page) */
.medical-search-container + .data-section {
  border-top: 1px solid #e9ecef;
  padding-top: 30px;
  margin-top: 20px;
}

.medical-search-container + .data-section h3:first-child {
  margin-top: 0;
}

/* Tracking page admin tabs integration */
.admin-dashboard .admin-tab-content .medical-search-container {
  margin: 20px 0 25px 0;
}

.admin-dashboard .admin-tabs + .admin-tab-content {
  padding-top: 20px;
}

/* Ensure search works well in admin tab content */
.admin-tab-content .section-header + .medical-search-container {
  margin-top: 20px;
  margin-bottom: 20px;
}

/* --- Advanced Labs UI Styles --- */

/* Panel Filters */
.panel-filters {
  background: linear-gradient(135deg, #f8f9fa, #ffffff);
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 15px 20px;
  margin: 20px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.panel-filters h4 {
  margin: 0 0 15px 0;
  color: var(--secondary-color);
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-filters h4 i {
  color: var(--primary-color);
}

.panel-dropdown-container {
  display: flex;
  gap: 15px;
  align-items: center;
}

.panel-filter-select {
  padding: 8px 15px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  background: white;
  color: var(--text-color);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 200px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.panel-filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15), 0 0 0 2px rgba(52, 152, 219, 0.1);
  transform: translateY(-1px);
}

/* Provider Badge Styling */
.provider-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.provider-uihc {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #8b6914;
  border: 1px solid #f1c40f;
}

.provider-mercy {
  background: linear-gradient(135deg, #e74c3c, #ff6b6b);
  color: white;
  border: 1px solid #c0392b;
}

.provider-unity-point {
  background: linear-gradient(135deg, #3498db, #5dade2);
  color: white;
  border: 1px solid #2980b9;
}

.provider-broadlawns {
  background: linear-gradient(135deg, #27ae60, #58d68d);
  color: white;
  border: 1px solid #229954;
}

.provider-mission-blood {
  background: linear-gradient(135deg, #e67e22, #f39c12);
  color: white;
  border: 1px solid #d68910;
}

.provider-other {
  background: linear-gradient(135deg, #95a5a6, #bdc3c7);
  color: #2c3e50;
  border: 1px solid #7f8c8d;
}

/* No Panel Indicator */
.no-panel {
  color: #adb5bd;
  font-style: italic;
  font-size: 0.9rem;
}

/* Enhanced Lab Table Styling */
.admin-dashboard .table-container table th {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-bottom: 2px solid var(--primary-color);
  font-weight: 600;
  color: var(--secondary-color);
  padding: 12px 15px;
  text-align: left;
}

.admin-dashboard .table-container table td {
  padding: 12px 15px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f3f4;
}

.admin-dashboard .table-container table tbody tr:hover {
  background: linear-gradient(135deg, #f8f9fa, #ffffff);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

/* Lab Status Styling */
.status-normal {
  color: #27ae60;
  font-weight: 600;
}

.status-abnormal {
  color: #e74c3c;
  font-weight: 600;
}

.status-high {
  color: #e67e22;
  font-weight: 600;
}

.status-low {
  color: #f39c12;
  font-weight: 600;
}

.status-critical {
  color: #c0392b;
  font-weight: 700;
  background: rgba(231, 76, 60, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Enhanced Admin Tabs for Labs with Horizontal Scroll */
.admin-dashboard .admin-tabs {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(52, 152, 219, 0.3) transparent;
}

/* Webkit Scrollbar Styling for Admin Tabs */
.admin-dashboard .admin-tabs::-webkit-scrollbar {
  height: 4px;
}

.admin-dashboard .admin-tabs::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 2px;
}

.admin-dashboard .admin-tabs::-webkit-scrollbar-thumb {
  background: rgba(52, 152, 219, 0.4);
  border-radius: 2px;
  transition: background 0.3s ease;
}

.admin-dashboard .admin-tabs::-webkit-scrollbar-thumb:hover {
  background: rgba(52, 152, 219, 0.6);
}

/* Prevent tabs from wrapping and ensure they maintain minimum width */
.admin-dashboard .admin-tabs {
  flex-wrap: nowrap;
  white-space: nowrap;
}

.admin-dashboard .admin-tab {
  flex-shrink: 0;
  min-width: 120px;
  white-space: nowrap;
}

/* Add scroll indicators for better UX */
.admin-dashboard .admin-tabs {
  position: relative;
  --left-indicator-opacity: 0;
  --right-indicator-opacity: 0;
}

.admin-dashboard .admin-tabs::before,
.admin-dashboard .admin-tabs::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 25px;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.3s ease;
}

.admin-dashboard .admin-tabs::before {
  left: 0;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.95), transparent);
  opacity: var(--left-indicator-opacity);
}

.admin-dashboard .admin-tabs::after {
  right: 0;
  background: linear-gradient(to left, rgba(255, 255, 255, 0.95), transparent);
  opacity: var(--right-indicator-opacity);
}

/* Add subtle scroll arrows */
.admin-dashboard .admin-tabs.scrollable::before {
  background: linear-gradient(to right, rgba(255, 255, 255, 0.95), transparent),
              linear-gradient(45deg, transparent 40%, var(--primary-color) 50%, transparent 60%);
  background-size: 100% 100%, 8px 8px;
  background-position: 0 0, 8px center;
  background-repeat: no-repeat;
}

.admin-dashboard .admin-tabs.scrollable::after {
  background: linear-gradient(to left, rgba(255, 255, 255, 0.95), transparent),
              linear-gradient(225deg, transparent 40%, var(--primary-color) 50%, transparent 60%);
  background-size: 100% 100%, 8px 8px;
  background-position: 0 0, calc(100% - 8px) center;
  background-repeat: no-repeat;
}

/* Show scroll indicators when scrollable */
.admin-dashboard .admin-tabs.scrollable::before {
  opacity: var(--left-indicator-opacity);
}

.admin-dashboard .admin-tabs.scrollable::after {
  opacity: var(--right-indicator-opacity);
}

/* Responsive Labs Interface */
@media (max-width: 768px) {
  .panel-filters {
    padding: 12px 15px;
  }
  
  .panel-dropdown-container {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .panel-filter-select {
    min-width: auto;
    width: 100%;
  }
  
  .provider-badge {
    font-size: 0.75rem;
    padding: 3px 6px;
  }
  
  .admin-dashboard .table-container {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }
  
  .admin-dashboard .table-container table {
    min-width: 800px;
  }
  
  /* Enhanced tab styling for mobile */
  .admin-dashboard .admin-tab {
    min-width: 100px;
    font-size: 0.85rem;
    padding: 12px 15px;
  }
  
  .admin-dashboard .admin-tab i {
    font-size: 1rem;
  }
  
  /* Make scrollbar more visible on mobile */
  .admin-dashboard .admin-tabs::-webkit-scrollbar {
    height: 6px;
  }
  
  /* Improve modal buttons accessibility on mobile */
  .record-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
  }
  
  .record-actions button,
  .record-actions a {
    min-width: 44px; /* Minimum touch target size */
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Ensure action columns are properly sized on mobile */
  .actions-column {
    width: auto;
    min-width: 120px;
  }
  
  /* Fix admin panel body scroll issues */
  body.admin-page {
    overflow-x: hidden;
    overflow-y: auto;
  }
  
  /* Prevent horizontal scroll in admin sections */
  .admin-dashboard,
  .admin-tab-content {
    max-width: 100%;
    overflow-x: hidden;
  }
}

/* Labs No Results Styling */
.labs-no-results {
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #f8f9fa, #ffffff);
  border: 2px dashed #dee2e6;
  border-radius: 15px;
  margin: 20px 0;
  animation: fadeIn 0.3s ease;
}

.no-results-content {
  max-width: 400px;
  margin: 0 auto;
}

.no-results-content i {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 20px;
}

.no-results-content h4 {
  color: var(--secondary-color);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 10px 0;
}

.no-results-content p {
  color: var(--light-gray);
  font-size: 1.1rem;
  margin: 0 0 20px 0;
  line-height: 1.5;
}

.btn-clear-filter {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.btn-clear-filter:hover {
  background: var(--primary-color-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}
