/* Home page Clinic */
.clinic-mobile {
  display: none;
}

@media (max-width: 800px) {
  .clinic-desktop {
    display: none;
    visibility: hidden;
  }
  .clinic-mobile {
    display: block;
    visibility: visible;
  }
}



/* Clinic Carousel */
#carousel {
  position: relative;
  height: 400px;
  margin-top: 20px;
  overflow: hidden;
}

#carousel div {
  position: absolute;
  transition: transform 400ms, left 400ms, opacity 400ms, z-index 0s;
  opacity: 1;
}

#carousel div img {
  width: 400px;
  transition: width 400ms;
  -webkit-user-drag: none;
  box-shadow: rgb(38, 57, 77) 0 20px 30px -10px;
  border-radius: 10px;
}

#carousel div.hideLeft {
  left: 0;
  opacity: 0;
  transform: translateY(50%) translateX(-50%);
}

#carousel div.hideLeft img {
  width: 200px;
}

#carousel div.hideRight {
  left: 100%;
  opacity: 0;
  transform: translateY(50%) translateX(-50%);
}

#carousel div.hideRight img {
  width: 200px;
}

#carousel div.prev {
  z-index: 5;
  left: 30%;
  transform: translateY(50px) translateX(-50%);
}

#carousel div.prev img {
  width: 300px;
}

#carousel div.prevLeftSecond {
  z-index: 4;
  left: 15%;
  transform: translateY(50%) translateX(-50%);
  opacity: 0.7;
}

#carousel div.prevLeftSecond img {
  width: 200px;
}

#carousel div.selected {
  z-index: 10;
  left: 50%;
  transform: translateY(0px) translateX(-50%);

}

#carousel div.next {
  z-index: 5;
  left: 70%;
  transform: translateY(50px) translateX(-50%);
}

#carousel div.next img {
  width: 300px;
}

#carousel div.nextRightSecond {
  z-index: 4;
  left: 85%;
  transform: translateY(50%) translateX(-50%);
  opacity: 0.7;
}

#carousel div.nextRightSecond img {
  width: 200px;
}

.button-carousel {
  display: none !important;
}

.text-display{
  display: none;
}

.carousel-text{
  padding-top: 20px;
  font-size: 25px;
  display: none;
}

.carousel .selected .carousel-text {
  display: block;
}



/* Social Media Mobile */
.social-alignment {
  justify-content: left;
}

@media (max-width: 767px) {
  .social-alignment {
    align-items: center;
    justify-content: center;
  }
}



/* Clinics Picture-Cut */
.clip-top-end {
  clip-path: polygon(0 0, 90% 0, 100% 100%, 0% 100%);
}

@media (max-width: 780px) {
  .clip-top-end {
    clip-path: none;
  }
  .clip-top-start {
     clip-path: none;
  }
}


/* Gallery Layout Mobile */
.gallery-mobile{
  display: none;
}

@media (max-width: 768px) {
  .gallery-desktop {
    display: none;
    visibility: hidden;
  }
  .gallery-mobile {
    display: block;
    visibility: visible;
  }
}

/* ==========================================
   UX ENHANCEMENTS & MOBILE OPTIMIZATIONS
   ========================================== */

/* Enhanced Loading Animation - Consistent and Professional */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.95) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  transform: scale(1);
  /* Enhanced transition with hardware acceleration */
  transition: opacity 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
              transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              backdrop-filter 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  /* Force hardware acceleration */
  will-change: opacity, transform, backdrop-filter;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  /* Enhanced CSS fallback with better timing */
  animation: sophisticatedLoading 5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  /* Contain layout repaints for better performance */
  contain: layout style paint;
}

@keyframes sophisticatedLoading {
  0% { 
    opacity: 1; 
    visibility: visible;
    transform: translate3d(0, 0, 0) scale(1);
  }
  80% { 
    opacity: 1; 
    visibility: visible;
    transform: translate3d(0, 0, 0) scale(1);
  }
  90% {
    opacity: 0.8;
    transform: translate3d(0, 0, 0) scale(1.01);
  }
  95% {
    opacity: 0.4;
    transform: translate3d(0, 0, 0) scale(1.02);
  }
  100% { 
    opacity: 0; 
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, 0, 0) scale(1.03);
  }
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 0, 0) scale(1.03);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  /* Add subtle glow effect during fade-out */
  box-shadow: inset 0 0 60px rgba(245, 166, 55, 0.1);
}

/* Backdrop filter fallback for better performance on older devices */
@supports not (backdrop-filter: blur(8px)) {
  .loading-overlay {
    background: rgba(255, 255, 255, 0.95);
  }
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(245, 166, 55, 0.2);
  border-top: 4px solid #f5a637;
  border-radius: 50%;
  animation: enhancedSpin 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(245, 166, 55, 0.1);
  /* Hardware acceleration for smoother spinning */
  will-change: transform;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
}

@keyframes enhancedSpin {
  0% { 
    transform: translate3d(0, 0, 0) rotate(0deg);
    border-top-color: #f5a637;
  }
  25% {
    border-top-color: #e69500;
  }
  50% { 
    transform: translate3d(0, 0, 0) rotate(180deg);
    border-top-color: #d48806;
  }
  75% {
    border-top-color: #e69500;
  }
  100% { 
    transform: translate3d(0, 0, 0) rotate(360deg);
    border-top-color: #f5a637;
  }
}

/* Loading text with fade animation */
.loading-overlay::after {
  content: "Loading your healthcare experience...";
  font-family: 'Lato', sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #495057;
  text-align: center;
  animation: loadingPulse 3s ease-in-out infinite;
  letter-spacing: 0.5px;
  /* Hardware acceleration */
  will-change: opacity;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
}

@keyframes loadingPulse {
  0%, 100% { 
    opacity: 0.6; 
  }
  50% { 
    opacity: 1; 
  }
}

/* Enhanced loading states for different page types */
.loading-overlay[data-page="index"]::after {
  content: "Welcome to St John's Pharmacy";
}

.loading-overlay[data-page="about"]::after {
  content: "Discovering our healthcare mission and team...";
}

.loading-overlay[data-page="contact"]::after {
  content: "Preparing contact form and location details...";
}

.loading-overlay[data-page="clinics"]::after {
  content: "Loading medical professionals and specialties...";
}

.loading-overlay[data-page="gallery"]::after {
  content: "Loading virtual pharmacy tour and photo gallery...";
}

/* Additional page-specific loading texts */
.loading-overlay[data-page="services"]::after {
  content: "Exploring our pharmacy services...";
}

.loading-overlay[data-page="appointments"]::after {
  content: "Setting up your appointment...";
}

.loading-overlay[data-page="prescriptions"]::after {
  content: "Managing your prescriptions...";
}

/* Progressive loading indicator */
.loading-progress {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 4px;
  background: rgba(245, 166, 55, 0.2);
  border-radius: 2px;
  overflow: hidden;
  /* Hardware acceleration */
  will-change: transform;
  transform: translate3d(-50%, 0, 0);
  -webkit-transform: translate3d(-50%, 0, 0);
}

.loading-progress::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #f5a637, transparent);
  animation: progressSlide 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
  /* Hardware acceleration */
  will-change: transform;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
}

@keyframes progressSlide {
  0% {
    left: -100%;
    transform: translate3d(0, 0, 0);
  }
  100% {
    left: 100%;
    transform: translate3d(0, 0, 0);
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .loading-overlay {
    animation: none;
    transition: opacity 0.6s ease-out;
  }
  
  .loading-spinner {
    animation: reducedSpin 3s linear infinite;
  }
  
  @keyframes reducedSpin {
    to { 
      transform: translate3d(0, 0, 0) rotate(360deg); 
    }
  }
  
  .loading-overlay::after {
    animation: none;
    opacity: 0.8;
  }
  
  .loading-progress::before {
    animation: reducedProgress 4s ease-in-out infinite;
  }
  
  @keyframes reducedProgress {
    0%, 100% { 
      opacity: 0.3; 
    }
    50% { 
      opacity: 0.8; 
    }
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .loading-overlay {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: none;
  }
  
  .loading-spinner {
    border: 4px solid #000;
    border-top: 4px solid #007bff;
    box-shadow: none;
  }
  
  .loading-overlay::after {
    color: #000;
    font-weight: 600;
  }
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: #f5a637;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(245, 166, 55, 0.3);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: #e69500;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(245, 166, 55, 0.4);
}

/* Cookie Consent Banner - Simplified and Fixed */
.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  color: #212529;
  padding: 24px 20px;
  text-align: center;
  z-index: 9998;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 4px solid #f5a637;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  /* Force hidden by default - overrides everything */
  display: none !important;
  opacity: 0;
  visibility: hidden;
}

.cookie-consent.show {
  /* Only show when explicitly given show class */
  display: block !important;
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.cookie-consent::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f5a637 0%, #e69500 50%, #f5a637 100%);
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 200% 0; }
  50% { background-position: -200% 0; }
}

.cookie-consent .container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.cookie-consent p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: #495057;
  font-weight: 400;
  flex: 1;
  min-width: 280px;
  text-align: left;
}

.cookie-consent .cookie-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: middle;
  opacity: 0.8;
}

.cookie-consent .btn-group {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

.cookie-consent button {
  padding: 10px 24px;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-width: 120px;
}

.cookie-consent button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.cookie-consent button:hover::before {
  left: 100%;
}

.cookie-consent .accept-btn {
  background: linear-gradient(135deg, #f5a637 0%, #e69500 100%);
  color: #ffffff;
  border-color: #f5a637;
  box-shadow: 0 4px 14px rgba(245, 166, 55, 0.3);
}

.cookie-consent .decline-btn {
  background: transparent;
  color: #6c757d;
  border-color: #dee2e6;
}

.cookie-consent .accept-btn:hover {
  background: linear-gradient(135deg, #e69500 0%, #d48806 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 166, 55, 0.4);
  border-color: #e69500;
}

.cookie-consent .decline-btn:hover {
  background: #f8f9fa;
  color: #495057;
  border-color: #adb5bd;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cookie-consent button:active {
  transform: translateY(0);
}

/* Enhanced mobile layout */
@media (max-width: 768px) {
  .cookie-consent {
    padding: 20px 16px;
  }
  
  .cookie-consent .container {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  
  .cookie-consent p {
    text-align: center;
    font-size: 14px;
    min-width: auto;
  }
  
  .cookie-consent .btn-group {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .cookie-consent button {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
  }
}

/* Accessibility improvements */
.cookie-consent button:focus {
  outline: 3px solid #f5a637;
  outline-offset: 2px;
}

.cookie-consent .decline-btn:focus {
  outline: 3px solid #6c757d;
  outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .cookie-consent {
    transition: none;
  }
  
  .cookie-consent::before {
    animation: none;
  }
  
  .cookie-consent button::before {
    transition: none;
  }
}

/* Enhanced Mobile Carousel */
.carousel-mobile-controls {
  display: none;
  position: absolute;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  gap: 15px;
  align-items: center;
}

.carousel-nav-btn {
  width: 44px;
  height: 44px;
  border: 2px solid #007bff;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: #007bff;
  transition: all 0.3s ease;
  touch-action: manipulation;
}

.carousel-nav-btn:hover {
  background: #007bff;
  color: white;
  transform: scale(1.1);
}

.carousel-nav-btn:active {
  transform: scale(0.95);
}

.carousel-indicators {
  display: flex;
  gap: 8px;
}

.carousel-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ddd;
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-indicator.active {
  background: #007bff;
  transform: scale(1.2);
}

/* Mobile-specific carousel improvements */
@media (max-width: 800px) {
  .carousel-mobile-controls {
    display: flex;
  }
  
  #carousel {
    position: relative;
    padding-bottom: 80px;
  }
  
  #carousel div img {
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
  }
  
  /* Larger touch targets for mobile */
  .carousel-text {
    padding-top: 15px !important;
    font-size: 18px !important;
  }
  
  /* Swipe indicator */
  .swipe-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
  }
  
  .swipe-indicator.show {
    opacity: 1;
  }
}

/* Accessibility Improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Enhanced touch targets for mobile */
@media (max-width: 768px) {
  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .btn {
    min-height: 44px;
    font-size: 16px;
  }
  
  /* Larger social media icons on mobile */
  .list-inline-item a {
    font-size: 20px;
    padding: 12px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Facebook Messenger Chat Plugin Styles */
.fb-messengermessageus {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  z-index: 9999 !important;
}

@media (max-width: 768px) {
  .fb-messengermessageus {
    bottom: 80px !important;
    right: 15px !important;
  }
}

/* Custom chat bubble if needed */
.custom-chat-bubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: #0084ff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 132, 255, 0.3);
  z-index: 9999;
  transition: all 0.3s ease;
}

.custom-chat-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 15px rgba(0, 132, 255, 0.4);
}

.custom-chat-bubble i {
  color: white;
  font-size: 24px;
}

/* Improved form styles */
.form-control:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Loading states for buttons */
.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  margin: auto;
  border: 2px solid transparent;
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Enhanced gallery hover effects */
.gallery-desktop a:hover img,
.gallery-mobile a:hover img {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

/* Error states */
.form-control.error {
  border-color: #dc3545;
}

.error-message {
  color: #dc3545;
  font-size: 12px;
  margin-top: 5px;
  display: none;
}

.error-message.show {
  display: block;
}

/* Success states */
.form-control.success {
  border-color: #28a745;
}

.success-message {
  color: #28a745;
  font-size: 12px;
  margin-top: 5px;
  display: none;
}

.success-message.show {
  display: block;
}