/* =================================================================
   HOSPITALS MODAL - Compact, Responsive & SEO-Friendly Design
   ================================================================= */

/* Modal Container */
.hospitals-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  animation: fadeIn 0.25s ease-out;
}

/* Modal Overlay */
.hospitals-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Modal Container Wrapper */
.hospitals-modal-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  z-index: 10001;
}

/* Modal Content Box - SMALLER SIZE */
.hospitals-modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Close Button - SMALLER */
.close-hospitals {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.close-hospitals:hover {
  transform: rotate(90deg) scale(1.05);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  background: #dc2626;
}

.close-hospitals:active {
  transform: rotate(90deg) scale(0.95);
}

/* Modal Header - COMPACT */
.hospitals-modal-header {
  padding: 20px 25px 15px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 16px 16px 0 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hospitals-modal-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: pulse 4s ease-in-out infinite;
}

/* Header Icon - SMALLER */
.header-icon-wrapper {
  position: relative;
  width: 60px;
  height: 60px;
  margin: 0 auto 12px;
}

.header-icon-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  animation: ripple 2s infinite;
}

.header-icon {
  position: relative;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
  animation: float 3s ease-in-out infinite;
}

/* Modal Title - SMALLER */
.modal-title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.title-gradient {
  background: linear-gradient(135deg, #fff 0%, #e0e7ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 20px rgba(255, 255, 255, 0.3);
}

/* Modal Subtitle - SMALLER */
.modal-subtitle {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.modal-subtitle i {
  color: #fbbf24;
  animation: bounce 2s infinite;
}

/* Modal Body - FULL WIDTH LIST ONLY */
.hospitals-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: block;
  background: #f8fafc;
}

/* Custom Scrollbar */
.hospitals-modal-body::-webkit-scrollbar {
  width: 8px;
}

.hospitals-modal-body::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 10px;
}

.hospitals-modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 10px;
}

.hospitals-modal-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* List Section - FULL WIDTH */
.hospitals-list-section-full {
  background: white;
  width: 100%;
  height: 100%;
}

/* Hide old map section */
.hospitals-map-section {
  display: none;
}

.hospitals-map {
  display: none;
}

.hospitals-list {
  padding: 25px;
  max-height: none;
  overflow-y: auto;
}

.hospitals-list::-webkit-scrollbar {
  width: 6px;
}

.hospitals-list::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.hospitals-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

/* Hospital List Styles - IMPROVED UI */
.hospitals-list h3 {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  padding-bottom: 15px;
  border-bottom: 3px solid #3b82f6;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hospitals-list h3::before {
  content: '🏥';
  font-size: 24px;
}

.hospital-item {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  border: 2px solid #e2e8f0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.hospital-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.hospital-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

.hospital-item:hover::before {
  transform: scaleY(1);
}

.hospital-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.hospital-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hospital-header h4::before {
  content: '🏥';
  font-size: 20px;
}

.relevance-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.relevance-badge.high {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.4);
  animation: pulse 2s infinite;
}

.relevance-badge.low {
  background: #e2e8f0;
  color: #64748b;
}

.hospital-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hospital-details p {
  margin: 0;
  font-size: 15px;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.hospital-details i {
  width: 20px;
  color: #3b82f6;
  font-size: 16px;
  flex-shrink: 0;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 60px 20px;
  font-size: 16px;
  color: #64748b;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading::before {
  content: '';
  width: 40px;
  height: 40px;
  border: 4px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Error State */
.error {
  text-align: center;
  padding: 40px 20px;
  font-size: 16px;
  color: #ef4444;
  background: #fef2f2;
  border-radius: 12px;
  border: 1px solid #fecaca;
}

/* No Hospitals State */
.no-hospitals {
  text-align: center;
  padding: 40px 20px;
  font-size: 16px;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 12px;
}

/* Map Container */
.map-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.map-header {
  padding: 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.map-header h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-header p {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
}

.map-content {
  flex: 1;
  position: relative;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  padding: 20px;
}

.map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  color: #64748b;
}

.hospital-marker {
  font-size: 48px;
  margin-bottom: 15px;
  animation: bounce 2s infinite;
}

/* Map Markers */
.map-marker {
  position: absolute;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-marker:hover {
  transform: scale(1.15);
  z-index: 10;
}

.marker-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
  border: 3px solid white;
}

.map-marker.high-relevance .marker-icon {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.marker-info {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  border: 1px solid #e2e8f0;
}

.map-marker:hover .marker-info {
  opacity: 1;
  top: -65px;
}

.marker-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 2px;
}

.marker-distance {
  font-size: 11px;
  color: #64748b;
}

/* Modal Footer - COMPACT */
.hospitals-modal-footer {
  padding: 15px 25px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* Modern Buttons - SMALLER */
.btn-modern {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-modern::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-modern:hover::before {
  width: 300px;
  height: 300px;
}

.btn-icon,
.btn-text {
  position: relative;
  z-index: 1;
}

.btn-refresh {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-refresh:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.btn-refresh:active {
  transform: translateY(0);
}

.btn-close-alt {
  background: #f1f5f9;
  color: #64748b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-close-alt:hover {
  transform: translateY(-2px);
  background: #e2e8f0;
  color: #475569;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }

  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* =================================================================
   RESPONSIVE DESIGN - Mobile First Approach
   ================================================================= */

/* Tablets (Portrait) - 768px to 991px - COMPACT */
@media (max-width: 991px) {
  .hospitals-modal-body {
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 18px 22px;
  }

  .hospitals-modal-header {
    padding: 18px 22px 12px;
  }

  .modal-title {
    font-size: 22px;
  }

  .header-icon-wrapper,
  .header-icon {
    width: 55px;
    height: 55px;
  }

  .header-icon {
    font-size: 26px;
  }

  .hospitals-map {
    min-height: 280px;
  }

  .hospitals-list {
    max-height: 280px;
  }
}

/* Mobile Devices - 576px to 767px */
@media (max-width: 767px) {
  .hospitals-modal-container {
    padding: 15px;
  }

  .hospitals-modal-content {
    border-radius: 20px;
    max-height: 95vh;
  }

  .hospitals-modal-header {
    padding: 30px 25px 20px;
  }

  .close-hospitals {
    width: 38px;
    height: 38px;
    top: 15px;
    right: 15px;
    font-size: 16px;
  }

  .modal-title {
    font-size: 24px;
  }

  .modal-subtitle {
    font-size: 14px;
  }

  .header-icon-wrapper,
  .header-icon {
    width: 60px;
    height: 60px;
  }

  .header-icon {
    font-size: 28px;
  }

  .hospitals-modal-body {
    padding: 0;
  }

  .hospitals-list {
    padding: 18px;
  }

  .hospital-item {
    padding: 10px;
  }

  .hospital-header h4 {
    font-size: 16px;
  }

  .hospit als-modal-footer {
    padding: 12px 18px;
    flex-direction: column;
  }

  .btn-modern {
    width: 100%;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
  }
}

/* Small Mobile Devices - 320px to 575px */
@media (max-width: 575px) {
  .hospitals-modal-container {
    padding: 10px;
  }

  .hospitals-modal-content {
    border-radius: 16px;
  }

  .hospitals-modal-header {
    padding: 25px 20px 15px;
  }

  .close-hospitals {
    width: 34px;
    height: 34px;
    top: 12px;
    right: 12px;
  }

  .modal-title {
    font-size: 20px;
  }

  .modal-subtitle {
    font-size: 13px;
  }

  .header-icon-wrapper,
  .header-icon {
    width: 50px;
    height: 50px;
  }

  .header-icon {
    font-size: 24px;
  }

  .hospitals-modal-body {
    padding: 0;
  }

  .hospitals-list {
    padding: 15px;
  }

  .hospital-item {
    padding: 12px;
  }

  .hospital-header {
    flex-direction: column;
    gap: 8px;
  }

  .hospital-header h4 {
    font-size: 15px;
  }

  .hospital-details p {
    font-size: 13px;
  }

  .hospitals-modal-footer {
    padding: 15px;
  }

  .btn-modern {
    padding: 11px 20px;
    font-size: 13px;
  }
}

/* Extra Small Devices - Less than 400px */
@media (max-width: 399px) {
  .modal-title {
    font-size: 18px;
  }

  .hospitals-modal-header {
    padding: 20px 15px 12px;
  }

  .header-icon-wrapper,
  .header-icon {
    width: 45px;
    height: 45px;
  }

  .header-icon {
    font-size: 20px;
  }

  .hospitals-modal-body {
    padding: 0;
  }

  .hospitals-list {
    padding: 12px;
  }

  .hospital-item {
    padding: 10px;
  }

  .btn-modern {
    padding: 10px 18px;
    font-size: 12px;
  }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
  .hospitals-modal-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  }

  .hospitals-modal-header {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
  }

  .hospitals-modal-body {
    background: #0f172a;
  }

  .hospitals-map-section,
  .hospitals-list-section {
    background: #1e293b;
    border-color: #334155;
  }

  .hospital-item {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #334155;
  }

  .hospital-header h4 {
    color: #f1f5f9;
  }

  .hospital-details p {
    color: #94a3b8;
  }

  .hospitals-modal-footer {
    background: #1e293b;
    border-top-color: #334155;
  }

  .btn-close-alt {
    background: #334155;
    color: #cbd5e1;
  }

  .btn-close-alt:hover {
    background: #475569;
  }
}

/* Print Styles */
@media print {

  .hospitals-modal-overlay,
  .close-hospitals,
  .hospitals-modal-footer {
    display: none;
  }

  .hospitals-modal-content {
    box-shadow: none;
  }
}