/**
 * CSS for the TDIH Interactive Block.
 */

/* Main container */
.tdih-interactive-block {
  max-width: 100%;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Header section */
.tdih-interactive-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.tdih-interactive-header h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.tdih-intro-text {
  font-size: 1rem;
  color: #666;
  margin-bottom: 1rem;
}

/* Toggle button for Today in history section */
.tdih-toggle-button {
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #555;
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tdih-toggle-button:hover {
  background-color: #e9e9e9;
}

.tdih-toggle-button.active {
  background-color: #B22222;
  color: white;
  border-color: #8B0000;
}

.tdih-toggle-button::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23555'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-size: contain;
  transition: transform 0.2s ease;
}

.tdih-toggle-button.active::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  transform: rotate(180deg);
}

/* Birthday picker section */
.tdih-birthday-picker {
  margin-bottom: 2rem;
  padding: 1rem;
  background-color: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tdih-birthday-title {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.tdih-birthday-description {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
}

.tdih-birthday-date-picker {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.tdih-birthday-submit {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.tdih-birthday-submit:hover {
  background-color: #0069d9;
}

/* Events section */
.tdih-today-events {
  margin-bottom: 1.5rem;
}

.tdih-today-events h3 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: #333;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.5rem;
}

.tdih-events-list {
  margin-bottom: 1rem;
}

/* Birthday Events Highlighting */
.tdih-birthday-events .tdih-events-list {
  border-left: 4px solid #8B4513;
  padding-left: 1rem;
  background-color: rgba(139, 69, 19, 0.05);
  border-radius: 4px;
}

/* Exact Date Match Highlighting */
.tdih-exact-match {
  order: -1; /* Move to the top of the list */
  position: relative;
  border: 2px solid #B22222 !important;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 2rem !important;
  background-color: rgba(178, 34, 34, 0.05);
  box-shadow: 0 3px 10px rgba(178, 34, 34, 0.2);
}

.tdih-exact-match::before {
  content: "Exact Date Match";
  position: absolute;
  top: -12px;
  left: 10px;
  background-color: #B22222;
  color: white;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: bold;
}

.tdih-exact-match .tdih-event-date {
  font-weight: bold;
  color: #B22222;
  font-size: 1.1rem;
}

.tdih-exact-match .tdih-event-title {
  font-size: 1.4rem;
}

.tdih-birthday-events .tdih-event-item {
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin-bottom: 2rem;
  padding: 1.25rem;
  border-radius: 8px;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(139, 69, 19, 0.1);
  border-left: 3px solid #8B4513;
  display: flex;
  flex-wrap: wrap;
}

.tdih-birthday-events .tdih-event-item:hover {
  transform: translateX(5px);
  box-shadow: -3px 0 0 #8B4513;
}

.tdih-birthday-events .tdih-event-date {
  font-weight: bold;
  color: #8B4513;
}

.tdih-birthday-events .tdih-event-title a {
  color: #5a3511;
}

.tdih-birthday-events h3 {
  color: #8B4513;
  border-bottom: 2px solid #8B4513;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.tdih-birthday-events .tdih-event-item::before {
  content: "★";
  position: absolute;
  left: -1.5rem;
  color: #8B4513;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tdih-birthday-events .tdih-event-item:hover::before {
  opacity: 1;
}

/* Regular event items styling */
.tdih-event-item {
  position: relative;
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  border-radius: 8px;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-wrap: wrap;
}

.tdih-event-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.tdih-event-item:last-child {
  margin-bottom: 0;
}

.tdih-event-image {
  flex: 0 0 20%;
  margin-right: 1rem;
  margin-bottom: 1rem;
  max-width: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tdih-event-image img {
  max-width: 100%;
  border-radius: 4px;
  object-fit: cover;
  width: 100%;
  height: 150px;
}

/* Placeholder image styling */
.tdih-event-image--placeholder {
  background-color: #f0f0f0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  width: 100%;
  color: #B22222;
}

.tdih-event-image--placeholder .fas {
  font-size: 3rem;
  opacity: 0.6;
}

/* Handle portrait orientation images */
.tdih-event-image img.portrait {
  object-position: center top;
}

.tdih-event-content {
  flex: 1;
}

.tdih-event-date {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.tdih-event-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.tdih-event-title a {
  color: #B22222; /* SAHO red color */
  text-decoration: none;
}

.tdih-event-title a:hover {
  text-decoration: underline;
}

.tdih-event-body {
  font-size: 0.9rem;
  color: #333;
  line-height: 1.5;
}

/* Compact mode */
.compact-mode .tdih-event-item {
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

.compact-mode .tdih-event-title {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

/* No events message */
.tdih-no-events {
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 4px;
  text-align: center;
  color: #666;
}

/* Footer section */
.tdih-footer {
  text-align: center;
  margin-top: 1rem;
}

.tdih-more-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: #6c757d;
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
}

.tdih-more-link:hover {
  background-color: #5a6268;
  text-decoration: none;
}

/* African Drum Loading Indicator */
.tdih-interactive-block .ajax-progress {
  position: relative;
  display: inline-block;
  padding-left: 40px;
  margin-left: 10px;
  font-weight: bold;
  color: #8B4513; /* Brown color for African theme */
}

.tdih-interactive-block .ajax-progress .throbber {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%238B4513' d='M50 5C25.1 5 5 25.1 5 50s20.1 45 45 45 45-20.1 45-45S74.9 5 50 5zm0 80c-19.3 0-35-15.7-35-35s15.7-35 35-35 35 15.7 35 35-15.7 35-35 35z'/%3E%3Cpath fill='%23A0522D' d='M50 20c-16.5 0-30 13.5-30 30s13.5 30 30 30 30-13.5 30-30-13.5-30-30-30zm0 50c-11 0-20-9-20-20s9-20 20-20 20 9 20 20-9 20-20 20z'/%3E%3Cpath fill='%23CD853F' d='M50 30c-11 0-20 9-20 20s9 20 20 20 20-9 20-20-9-20-20-20zm0 30c-5.5 0-10-4.5-10-10s4.5-10 10-10 10 4.5 10 10-4.5 10-10 10z'/%3E%3Cpath fill='%23DEB887' d='M50 40c-5.5 0-10 4.5-10 10s4.5 10 10 10 10-4.5 10-10-4.5-10-10-10zm0 15c-2.8 0-5-2.2-5-5s2.2-5 5-5 5 2.2 5 5-2.2 5-5 5z'/%3E%3Cpath fill='%238B4513' d='M30 50h-5c0-13.8 11.2-25 25-25v5c-11 0-20 9-20 20z'/%3E%3Cpath fill='%238B4513' d='M50 75v-5c11 0 20-9 20-20h5c0 13.8-11.2 25-25 25z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  animation: tdih-drum-beat 0.8s ease-in-out infinite alternate;
}

@keyframes tdih-drum-beat {
  0% { transform: translateY(-50%) scale(1); }
  100% { transform: translateY(-50%) scale(1.2); }
}

/* Custom loading message */
.tdih-interactive-block .ajax-progress .message {
  font-style: italic;
  color: #8B4513;
  font-family: 'Georgia', serif;
}

/* Responsive styles */
/* Enhanced tablet responsiveness */
@media (max-width: 1024px) {
  .tdih-interactive-block {
    padding: 0.75rem;
  }

  .tdih-birthday-picker {
    padding: 1rem;
    margin-bottom: 1.25rem;
  }
}

@media (max-width: 768px) {
  .tdih-interactive-block {
    padding: 0.5rem;
  }

  .tdih-event-item {
    margin-bottom: 1.75rem;
    padding: 1.5rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    border-left: none;
    border-top: 3px solid #B22222;
  }

  .tdih-birthday-events .tdih-event-item {
    border-top: 3px solid #8B4513;
    border-left: none;
  }

  .tdih-event-image {
    flex: 0 0 100%;
    margin-right: 0;
    margin-bottom: 1.25rem;
    text-align: center;
  }

  .tdih-event-image img {
    height: 180px;
    border-radius: 6px;
    object-fit: cover;
  }

  /* Better display for vertical/portrait images */
  .saho-card-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 6px 6px 0 0;
  }

  /* Full width utilization for mobile TDIH cards */
  .tdih-interactive-block .saho-cards-grid .saho-card {
    width: calc(100% - 1rem);
    margin: 0 0.5rem 1rem 0.5rem;
  }

  .tdih-birthday-picker {
    padding: 1rem;
    margin-bottom: 1.25rem;
    margin-left: -0.25rem;
    margin-right: -0.25rem;
  }

  .tdih-event-content {
    flex: 0 0 100%;
  }

  .tdih-event-date {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  .tdih-event-title {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
  }

  .tdih-event-body {
    font-size: 1rem;
    line-height: 1.6;
  }

  .tdih-today-events h3 {
    font-size: 1.6rem;
    text-align: center;
    margin-bottom: 1.5rem;
  }

  .tdih-birthday-title {
    font-size: 1.6rem;
    text-align: center;
  }

  .tdih-birthday-description {
    text-align: center;
  }

  .tdih-birthday-submit {
    width: 100%;
    padding: 0.75rem;
    font-size: 1.1rem;
    background-color: #B22222;
  }

  .tdih-birthday-submit:hover,
  .tdih-birthday-submit:focus {
    background-color: #8B0000;
  }

  /* Add separation between entries with a subtle gradient line */
  .tdih-event-item::after {
    content: "";
    position: absolute;
    bottom: -0.875rem;
    left: 10%;
    width: 80%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.1), transparent);
  }

  .tdih-event-item:last-child::after {
    display: none;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .tdih-interactive-block {
    padding: 0.25rem;
  }

  .tdih-event-item {
    padding: 1.25rem 1rem;
  }

  .tdih-event-title {
    font-size: 1.3rem;
  }

  /* Maximum width utilization on small screens */
  .tdih-interactive-block .saho-cards-grid .saho-card {
    width: calc(100% - 0.5rem);
    margin: 0 0.25rem 0.875rem 0.25rem;
  }

  .tdih-birthday-picker {
    padding: 0.875rem;
    margin-left: -0.125rem;
    margin-right: -0.125rem;
  }
}

#edit-spammaster-signature {
  display: none !important;
}