/**
 * Church Map Styles
 * Church map with OpenStreetMap + Leaflet
 */

/* Container */
.church-map-container {
   max-width: 1400px;
   margin: 0 auto;
   padding: 20px;
}

/* Header */
.church-map-header {
   text-align: center;
   margin-bottom: 30px;
}

.church-map-header .page-title {
   font-size: 2.5rem;
   font-weight: 800;
   color: #1e40af;
   margin-bottom: 10px;
}

.church-map-header .page-subtitle {
   font-size: 1.1rem;
   color: #64748b;
}

/* Controls */
.church-map-controls {
   display: flex;
   flex-direction: row;
   flex-wrap: nowrap;
   justify-content: space-between;
   align-items: center;
   gap: 15px;
   margin-bottom: 20px;
   padding: 15px 20px;
   background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
   border-radius: 12px;
   width: 100%;
}

.control-group {
   display: flex;
   flex-direction: row;
   gap: 10px;
   align-items: center;
   margin: 0;
}

#find-near-me {
   background: white;
   color: #1e40af;
   border: 2px solid #e2e8f0;
   padding: 10px 20px;
   border-radius: 8px;
   font-weight: 700;
   font-size: 14px;
   cursor: pointer;
   transition: all 0.3s ease;
   display: inline-flex;
   align-items: center;
   justify-content: center;
   gap: 8px;
   white-space: nowrap;
   min-width: 140px;
   height: 42px;
   line-height: 42px;
   text-transform: uppercase;
   vertical-align: middle;
   margin: 0;
   box-sizing: border-box;
}

#find-near-me:hover {
   background: #f8fafc;
   border-color: #3b82f6;
   color: #1d4ed8;
   transform: translateY(-2px);
   box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

#find-near-me:disabled {
   background: #94a3b8;
   color: white;
   cursor: not-allowed;
   transform: none;
   border-color: #94a3b8;
}

#find-near-me i {
   font-size: 16px;
}

.province-select {
   padding: 0 16px;
   height: 42px;
   border: 2px solid #e2e8f0;
   border-radius: 8px;
   font-size: 14px;
   min-width: 200px;
   width: 200px;
   cursor: pointer;
   background: white;
   line-height: 42px;
   margin: 0;
   box-sizing: border-box;
   vertical-align: middle;
}

.province-select:focus {
   border-color: #3b82f6;
   outline: none;
}

.church-search-input {
   padding: 0 16px;
   height: 42px;
   border: 2px solid #e2e8f0;
   border-radius: 8px;
   font-size: 14px;
   min-width: 280px;
   width: 100%;
   transition: border-color 0.3s;
   margin: 0;
   box-sizing: border-box;
   line-height: 42px;
   vertical-align: middle;
}

.church-search-input:focus {
   border-color: #3b82f6;
   outline: none;
}

.search-group {
   display: flex;
   flex-grow: 1;
   gap: 10px;
   align-items: center;
   margin: 0;
}

.search-group button,
.search-group .button {
   height: 42px;
   padding: 0 20px;
   display: inline-flex;
   align-items: center;
   justify-content: center;
   white-space: nowrap;
   box-sizing: border-box;
   margin: 0;
}

/* Main Content Layout */
.church-map-content {
   display: grid;
   grid-template-columns: 1fr 350px;
   gap: 20px;
   min-height: 600px;
}

/* Map */
.map-wrapper {
   position: relative;
   border-radius: 16px;
   overflow: hidden;
   box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

#church-map {
   width: 100%;
   height: 600px;
   background: #e2e8f0;
   z-index: 1;
}

.map-loading {
   position: absolute;
   top: 50%;
   left: 50%;
   transform: translate(-50%, -50%);
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: 10px;
   color: #64748b;
   z-index: 2;
}

.map-loading.hidden {
   display: none;
}

.spinner {
   width: 40px;
   height: 40px;
   border: 3px solid #e2e8f0;
   border-top-color: #3b82f6;
   border-radius: 50%;
   animation: spin 1s linear infinite;
}

@keyframes spin {
   to {
      transform: rotate(360deg);
   }
}

/* Sidebar */
.church-list-sidebar {
   background: white;
   border-radius: 16px;
   box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
   overflow: hidden;
   display: flex;
   flex-direction: column;
}

.sidebar-header {
   padding: 20px;
   background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
   color: white;
   display: flex;
   justify-content: space-between;
   align-items: center;
}

.sidebar-header h3 {
   margin: 0;
   font-size: 1.1rem;
   font-weight: 700;
   color: white;
}

.church-count {
   background: rgba(255, 255, 255, 0.2);
   padding: 4px 12px;
   border-radius: 20px;
   font-size: 0.85rem;
   color: white;
   white-space: nowrap;
}

.church-list {
   flex: 1;
   overflow-y: auto;
   max-height: 520px;
}

/* Church Card */
.church-card {
   padding: 15px 20px;
   border-bottom: 1px solid #e2e8f0;
   cursor: pointer;
   transition: background 0.2s;
}

.church-card:hover {
   background: #f8fafc;
}

.church-card.active {
   background: #eff6ff;
   border-left: 4px solid #3b82f6;
}

.church-card .church-name {
   font-weight: 700;
   color: #1e293b;
   margin-bottom: 5px;
   display: flex;
   align-items: center;
   gap: 8px;
}

.church-card .church-name::before {
   content: '⛪';
}

.church-card .church-address {
   font-size: 0.85rem;
   color: #64748b;
   margin-bottom: 8px;
}

.church-card .church-distance {
   font-size: 0.8rem;
   color: #3b82f6;
   font-weight: 600;
}

.church-card .church-mass {
   font-size: 0.8rem;
   color: #059669;
   margin-top: 5px;
}

/* Leaflet Popup */
.leaflet-popup-content-wrapper {
   border-radius: 12px;
   box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
   margin: 15px;
   min-width: 250px;
}

.church-popup {
   font-family: inherit;
}

.church-popup .popup-title {
   font-size: 1.1rem;
   font-weight: 700;
   color: #1e293b;
   margin-bottom: 10px;
   display: flex;
   align-items: center;
   gap: 8px;
}

.church-popup .popup-title::before {
   content: '⛪';
   font-size: 1.3rem;
}

.church-popup .popup-address {
   font-size: 0.9rem;
   color: #64748b;
   margin-bottom: 10px;
}

.church-popup .popup-mass {
   background: #f8fafc;
   padding: 10px;
   border-radius: 8px;
   margin-bottom: 10px;
}

.church-popup .popup-mass-title {
   font-weight: 600;
   color: #1e40af;
   margin-bottom: 5px;
   font-size: 0.85rem;
}

.church-popup .popup-mass-time {
   color: #059669;
   font-size: 0.85rem;
}

.church-popup .popup-actions {
   display: flex;
   gap: 8px;
   margin-top: 10px;
}

.church-popup .popup-btn {
   flex: 1;
   padding: 8px 12px;
   border-radius: 6px;
   font-size: 0.85rem;
   text-align: center;
   text-decoration: none;
   transition: all 0.2s;
}

.church-popup .popup-btn-primary {
   background: #1e40af;
   color: white;
}

.church-popup .popup-btn-secondary {
   background: #e2e8f0;
   color: #1e293b;
}

.church-popup .popup-btn:hover {
   opacity: 0.9;
}

/* Info Message */
.church-map-info {
   margin-top: 20px;
   padding: 15px 20px;
   background: #eff6ff;
   border-radius: 8px;
   border-left: 4px solid #3b82f6;
   color: #1e40af;
   font-size: 0.9rem;
}

/* Empty State */
.empty-state {
   text-align: center;
   padding: 40px 20px;
   color: #64748b;
}

.empty-state .icon {
   font-size: 3rem;
   margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 992px) {
   .church-map-content {
      grid-template-columns: 1fr;
   }

   .church-list-sidebar {
      order: -1;
      max-height: 300px;
   }

   .church-list {
      max-height: 220px;
   }

   #church-map {
      height: 400px;
   }
}

@media (max-width: 768px) {
   .church-map-controls {
      flex-direction: column;
      align-items: stretch;
   }

   .control-group {
      flex-direction: column;
   }

   .province-select,
   .church-search-input {
      width: 100%;
      min-width: unset;
   }

   .church-map-header .page-title {
      font-size: 1.8rem;
   }
}

/* Dark Mode Support */
.dark-mode .church-map-controls {
   background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.dark-mode .province-select,
.dark-mode .church-search-input {
   background: #1e293b;
   border-color: #475569;
   color: #e2e8f0;
}

.dark-mode .church-list-sidebar {
   background: #1e293b;
}

.dark-mode .church-card {
   border-color: #334155;
}

.dark-mode .church-card:hover {
   background: #334155;
}

.dark-mode .church-card .church-name {
   color: #e2e8f0;
}

.dark-mode .church-map-info {
   background: #1e293b;
   border-color: #3b82f6;
   color: #93c5fd;
}