/* ============================================
   This Day in History - Frontend Styles
   ============================================ */

.tdih-container {
  max-width: 100%;
  padding: 20px;
  border-radius: 8px;
  background: transparent;
  box-sizing: border-box;
  font-family: inherit;
  overflow-x: hidden;
}

/* ============================================
   Header / Date Badge
   ============================================ */
.tdih-header-date {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.tdih-date-circle {
  background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
  color: #fff;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(26,115,232,0.35);
}

/* Box style: rounded rectangle — standalone, no circle inheritance */
.tdih-date-box {
  background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
  color: #fff;
  border-radius: 8px;
  width: auto;
  min-width: 56px;
  padding: 6px 12px;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(26,115,232,0.35);
}

/* Inline style: no background, plain text — standalone */
.tdih-date-inline {
  background: none;
  border-radius: 0;
  box-shadow: none;
  width: auto;
  height: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 0;
  color: #1a73e8;
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
}

.tdih-date-circle-day {
  font-size: 20px;
  font-weight: 700;
}

.tdih-date-circle-month {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.tdih-main-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
  line-height: 1.2;
}

/* ============================================
   No Events
   ============================================ */
.tdih-no-events {
  text-align: center;
  padding: 40px 20px;
}

/* ============================================
   List Layout
   ============================================ */
.tdih-layout-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ============================================
   Grid Layout
   ============================================ */
.tdih-layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* ============================================
   Card Layout
   ============================================ */
.tdih-layout-card {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ============================================
   Event Item
   ============================================ */
.tdih-event {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
  background: transparent;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.tdih-event::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #1a73e8 0%, #1557b0 100%);
  border-radius: 4px 0 0 4px;
}

.tdih-event:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

/* Card variant */
.tdih-layout-card .tdih-event {
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tdih-layout-card .tdih-event::before {
  display: none;
}

.tdih-layout-card .tdih-event::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #1a73e8 0%, #34a853 100%);
}

/* ============================================
   Event with icon - positioning
   ============================================ */
.tdih-event-inner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.tdih-event-inner.icon-left {
  flex-direction: row;
}

.tdih-event-inner.icon-right {
  flex-direction: row-reverse;
}

.tdih-event-inner.icon-top {
  flex-direction: column;
  align-items: flex-start;
}

/* ============================================
   Event Image / Icon
   ============================================ */
.tdih-event-image {
  flex-shrink: 0;
}

.tdih-event-image img {
  width: 64px;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

/* Clickable image */
.tdih-event-image-clickable .tdih-image-link {
  display: block;
  border-radius: 8px;
  overflow: hidden;
}

.tdih-event-image-clickable img {
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.tdih-event-image-clickable img:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

/* ============================================
   Event Body
   ============================================ */
.tdih-event-body {
  flex: 1;
  min-width: 0;
}

.tdih-event-year {
  display: inline-block;
  background: #e8f0fe;
  color: #1557b0;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tdih-event-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 8px;
  line-height: 1.3;
}

.tdih-event-content {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  margin: 0;
}

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

/* ============================================
   Animations
   ============================================ */
.tdih-animate-fade {
  animation: tdihFadeIn 0.6s ease forwards;
}

.tdih-animate-slide {
  animation: tdihSlideIn 0.5s ease forwards;
}

.tdih-animate-bounce {
  animation: tdihBounceIn 0.6s ease forwards;
}

@keyframes tdihFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes tdihSlideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes tdihBounceIn {
  0%   { opacity: 0; transform: scale(0.95); }
  60%  { opacity: 1; transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}

/* Stagger delays */
.tdih-event:nth-child(1) { animation-delay: 0.05s; }
.tdih-event:nth-child(2) { animation-delay: 0.1s; }
.tdih-event:nth-child(3) { animation-delay: 0.15s; }
.tdih-event:nth-child(4) { animation-delay: 0.2s; }
.tdih-event:nth-child(5) { animation-delay: 0.25s; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .tdih-layout-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .tdih-container {
    padding: 14px;
  }

  .tdih-layout-grid,
  .tdih-layout-card {
    grid-template-columns: 1fr;
  }

  .tdih-event-inner.icon-left,
  .tdih-event-inner.icon-right {
    flex-direction: column;
  }

  .tdih-event-content {
    overflow-wrap: break-word;
    word-break: break-word;
  }
}

/* ============================================
   Event Category Labels
   ============================================ */
.tdih-event-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tdih-event-category-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1.6;
}

.tdih-event-category-label .dashicons {
  font-size: 12px;
  width: 12px;
  height: 12px;
  line-height: 1.6;
}
