/**
 * SOS Prayer Map Styles
 */

/* ==========================================================================
   Join Prayer Button
   ========================================================================== */

.sos-join-prayer-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.sos-join-prayer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 24px;
  font-size: 18px;
  font-weight: 600;
  color: #fff !important;
  background: #11a05c !important;
  border: none !important;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sos-join-prayer-btn:hover {
  background: var(--wp--preset--color--fl-accent-hover) !important;
}
.sos-scroll-to-active-btn {
  color: #fff !important;
  background: #11a05c !important;
}

.sos-scroll-to-active-btn:hover {
  background: var(--wp--preset--color--fl-accent-hover) !important;
}

.sos-join-prayer-btn:active {
  transform: translateY(0);
}

.sos-join-prayer-btn.sos-loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.sos-join-prayer-btn.sos-already-joined,
.sos-join-prayer-btn.sos-already-joined:hover {
  background: #d4edda !important;
  color: #155724 !important;
  cursor: default;
  box-shadow: none;
}

.sos-occurrence-time {
  font-size: 14px;
  color: #666;
}

/* Profile Error Message */
.sos-profile-error {
  width: 100%;
  margin-top: 16px;
  padding: 20px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  text-align: center;
}

.sos-join-prayer-wrapper:has(.sos-profile-error) {
  flex-wrap: wrap;
}

.sos-profile-error p {
  margin: 0 0 16px;
  font-size: 14px;
  color: #856404;
  line-height: 1.5;
}

.sos-profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  color: #fff !important;
  background: #11a05c !important;
  border: none;
  border-radius: 6px;
  text-decoration: none !important;
  transition: all 0.3s ease;
}

.sos-profile-btn:hover {
  background: #0e8a4e !important;
  box-shadow: 0 4px 12px rgba(17, 160, 92, 0.4);
  color: #fff !important;
  text-decoration: none !important;
}

/* ==========================================================================
   Prayer Map
   ========================================================================== */

.sos-prayer-map-wrapper {
  margin: 20px 0;
}

.sos-prayer-map-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid #e9ecef;
}

.sos-event-title {
  font-weight: 600;
  font-size: 16px;
  color: #333;
}

.sos-event-status {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.sos-event-status.sos-active {
  background: #d4edda;
  color: #155724;
}

.sos-event-status.sos-upcoming {
  background: #fff3cd;
  color: #856404;
}

.sos-total-praying {
  margin-left: auto;
  font-size: 14px;
  color: #666;
}

.sos-prayer-map {
  width: 100%;
  border-radius: 0 0 8px 8px;
  border: 1px solid #e9ecef;
  border-top: none;
}

.sos-prayer-map-message {
  padding: 40px 20px;
  text-align: center;
  background: #f8f9fa;
  border-radius: 0 0 8px 8px;
  color: #666;
  font-size: 16px;
}

/* ==========================================================================
   Map Pins
   ========================================================================== */

.sos-prayer-pin {
  background: transparent !important;
  border: none !important;
}

.sos-pin-marker {
  position: relative;
  width: 24px;
  height: 32px;
}

.sos-pin-icon {
  width: 24px;
  height: 32px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.sos-pin-count {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: #11a05c;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Login Prompt
   ========================================================================== */

.sos-prayer-map-login {
  padding: 60px 20px;
  text-align: center;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.sos-prayer-map-login p {
  margin: 0 0 20px;
  font-size: 16px;
  color: #666;
}

.sos-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.3s ease;
}

.sos-login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  color: #fff;
  text-decoration: none;
}

/* ==========================================================================
   Leaflet Popup Overrides
   ========================================================================== */

.sos-prayer-map .leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sos-prayer-map .leaflet-popup-content {
  margin: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.sos-fade-out {
  animation: fadeOut 0.4s ease forwards;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 600px) {
  .sos-join-prayer-wrapper {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .sos-prayer-map-header {
    flex-wrap: wrap;
  }

  .sos-total-praying {
    margin-left: 0;
    width: 100%;
    margin-top: 8px;
  }
}

/* ==========================================================================
   MEC Timetable Active Event Highlight
   ========================================================================== */

/* Active event in clean timetable (t2) - border-only style */
.mec-timetable-t2-col .mec-event-article.sos-active-event {
  position: relative;
}

/* Override the colored background span with white + colored border */
.mec-timetable-t2-col .mec-event-article.sos-active-event .event-color {
  background: #fff !important;
  border: 3px solid var(--sos-event-color, #40d9f1);
  box-sizing: border-box;
}

/* Dark text for readability on white background */
.mec-timetable-t2-col
  .mec-event-article.sos-active-event
  .mec-timetable-t2-content {
  color: #333 !important;
}

.mec-timetable-t2-col .mec-event-article.sos-active-event .mec-event-title,
.mec-timetable-t2-col .mec-event-article.sos-active-event .mec-event-title a {
  color: #333 !important;
}

.mec-timetable-t2-col .mec-event-article.sos-active-event .mec-event-time,
.mec-timetable-t2-col .mec-event-article.sos-active-event .mec-event-loction,
.mec-timetable-t2-col .mec-event-article.sos-active-event .mec-event-organizer {
  color: #555 !important;
}

/* Icon color adjustment */
.mec-timetable-t2-col
  .mec-event-article.sos-active-event
  .mec-timetable-t2-content
  i,
.mec-timetable-t2-col
  .mec-event-article.sos-active-event
  .mec-timetable-t2-content
  svg {
  color: var(--sos-event-color, #40d9f1) !important;
  fill: var(--sos-event-color, #40d9f1) !important;
}

/* ==========================================================================
   MEC Clean Timetable: per-event Edit link
   ========================================================================== */
.mec-timetable-t2-col .mec-event-article {
  position: relative;
}
.mec-timetable-t2-col .mec-event-article .sos-mec-edit-link {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  background-color: #fff;
  color: #3c3c32;
  padding: 8px 16px;
  border-radius: 50px;
}
.mec-timetable-t2-col .mec-event-article .sos-mec-edit-link:hover {
  text-decoration: underline;
}

/* Active card: green background with white text for the Edit link */
.mec-timetable-t2-col .mec-event-article.sos-active-event .sos-mec-edit-link {
  color: #fff;
  background-color: #11a05c;
}

/* Local time details section - make text dark on highlighted cards (white bg) */
.mec-timetable-t2-col
  .mec-event-article.sos-active-event
  .mec-local-time-details,
.mec-timetable-t2-col
  .mec-event-article.sos-active-event
  .mec-local-time-details
  * {
  color: #555 !important;
}

.mec-timetable-t2-col
  .mec-event-article.sos-active-event
  .mec-local-time-details
  i,
.mec-timetable-t2-col
  .mec-event-article.sos-active-event
  .mec-local-time-details
  svg {
  color: var(--sos-event-color, #40d9f1) !important;
  fill: var(--sos-event-color, #40d9f1) !important;
}

/* ==========================================================================
   My Prayer Events Table
   ========================================================================== */

.sos-my-prayer-events {
  margin: 24px 0;
}

.sos-my-prayer-events table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sos-my-prayer-events th {
  text-align: left;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #11a05c;
  border-bottom: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sos-my-prayer-events td {
  padding: 14px 16px;
  font-size: 14px;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.sos-my-prayer-events tbody tr:last-child td {
  border-bottom: none;
}

.sos-my-prayer-events tbody tr:hover {
  background: #fafafa;
}

.sos-my-prayer-events td a {
  color: #11a05c;
  text-decoration: none;
  font-weight: 500;
}

.sos-my-prayer-events td a:hover {
  text-decoration: underline;
}

/* Event badge (Ongoing indicator) */
.sos-event-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

.sos-event-badge.sos-ongoing {
  background: #d4edda;
  color: #155724;
}

/* Responsive: stack table on mobile */
@media (max-width: 600px) {
  .sos-my-prayer-events table,
  .sos-my-prayer-events thead,
  .sos-my-prayer-events tbody,
  .sos-my-prayer-events th,
  .sos-my-prayer-events td,
  .sos-my-prayer-events tr {
    display: block;
  }

  .sos-my-prayer-events thead {
    display: none;
  }

  .sos-my-prayer-events tbody tr {
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
  }

  .sos-my-prayer-events td {
    padding: 12px 16px;
    text-align: right;
    border-bottom: 1px solid #f0f0f0;
  }

  .sos-my-prayer-events td:before {
    content: attr(data-label);
    float: left;
    font-weight: 600;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
  }

  .sos-my-prayer-events td:last-child {
    border-bottom: none;
  }

  .sos-my-prayer-events tbody tr:hover {
    background: #fff;
  }

  .sos-event-badge {
    display: block;
    margin-left: 0;
    margin-top: 6px;
    width: fit-content;
    margin-left: auto;
  }
}
