/**
 * Media Outlets Listing Styles
 *
 * @package JTI_Custom
 */

#map {
  aspect-ratio: 2 / 1;
  max-width: 1026px;
  height: auto;
  background: #fff;
  z-index: 1;
}

/* Container */
.jti-media-outlets-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Region Tabs - */
.jti-media-outlets-regions {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 20px;
  overflow: scroll;
  justify-content: space-between;
  flex-wrap: wrap;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.jti-media-outlets-regions::-webkit-scrollbar {
  display: none;
}

.region-tab {
  padding: 15px 0;
  margin: 0 20px;
  cursor: pointer;
  font-size: 14px;
  color: #555;
  position: relative;
  transition: color 0.2s ease;
}

.region-tab:first-child {
  margin-left: 0;
}

.region-tab:hover {
  color: #000;
}

.region-tab.active {
  color: #000;
  font-weight: 500;
}

.region-tab.active:after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #000;
}

/* Search and Filters  */
.jti-media-outlets-search-filters {
  display: flex;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.search-box input {
  width: 100%;
  padding: 10px 40px 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  height: 40px;
}

.search-button {
  background: none !important;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #777;
}

.filter-dropdowns {
  display: flex;
  gap: 15px;
  align-items: center;
}

.filter-dropdowns select {
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  font-size: 14px;
  min-width: 140px;
  height: 40px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='6' fill='none'%3E%3Cpath d='M1 1l5 4 5-4' stroke='%23333' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  padding-right: 30px;
}

/* Sort by dropdown */
.sort-dropdown {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  color: #555;
}

.sort-dropdown select {
  border: none;
  background: none;
  font-size: 14px;
  color: #555;
  cursor: pointer;
  padding-right: 15px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='5' fill='none'%3E%3Cpath d='M1 1l4 3 4-3' stroke='%23555' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
}

/* Main layout with sidebar */
.jti-media-outlets-main {
  display: flex;
  gap: 30px;
}

/* Refine Results Header */
.refine-results-header {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #e0e0e0;
  font-size: 14px;
  margin-bottom: 15px;
}

.refine-results-header span:first-child {
  color: #555;
  font-weight: 500;
}

.clear-all {
  color: #007bff;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.clear-all svg {
  margin-left: 5px;
}

/* Country Filters Sidebar */
.jti-media-outlets-countries {
  width: 260px;
  flex-shrink: 0;
  max-height: 813px;
  /* overflow: scroll; */
  /* scroll-behavior: auto; */
}

.country-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: scroll;
  max-height: 733px;
}

/* Custom Checkbox Styling */
.country-list input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.country-list label {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  margin-bottom: 8px;
  padding-left: 28px;
  position: relative;
}

/* Custom checkbox */
.country-list label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  border: 1px solid #6b7986;
  background-color: transparent;
  box-sizing: border-box;
}

.country-list input[type="checkbox"] + label:before {
  background: none !important;
}

/* Checked state */
.country-list input[type="checkbox"]:checked + label::before {
  background-color: #6b7986 !important;
  border-color: #6b7986;
}

/* Checkmark */
.country-list input[type="checkbox"]:checked + label::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 12px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Focus state */
.country-list input[type="checkbox"]:focus + label::before {
  box-shadow: 0 0 0 2px rgba(87, 95, 107, 0.3);
}

/* Hover state */
.country-list label:hover::before {
  border-color: #575f6b;
}

/* Media Outlets Listing */
.jti-media-outlets-listing {
  flex: 1;
}

/* Media Outlets Grid */
.media-outlets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.media-outlet-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  background-color: white;
  display: flex;
  flex-direction: row;
  position: relative;
  max-height: 116px;
}

.media-outlet-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.media-outlet-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: transparent;
  position: relative;
  width: 120px;
  flex-shrink: 0;
}

.media-outlet-logo img {
  max-height: 80px;
  max-width: 100%;
  object-fit: contain;
}

.media-outlet-info {
  padding: 15px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.media-outlet-name {
  font-family: "Roboto", sans-serif !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  line-height: 22px !important;
  margin: 0 !important;
}

.media-outlet-location,
.media-outlet-date {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #666;
  gap: 6px;
}

.country-flag {
  width: 16px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
}

.media-outlet-status {
  margin-top: 5px;
}

.status-badge {
  display: inline-block;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  background-color: #e0e0e0;
  color: #555;
}

.media-outlet-status.certified .status-badge {
  background-color: transparent;
  color: #0f1f2d;
  font-family: "Roboto", serif;
  font-weight: 400;
  border: 1px solid #9ca5b2;
  border-radius: 5px;
  padding-left: 0;
  padding-bottom: 1px;
  width: 90px;
  height: 22px;
}

.jti-icon {
  background-color: #0f1f2d;
  color: white;
  padding: 4px 6px;
  font-family: Roboto, sans-serif;
  font-weight: bold;
  font-size: 12px;
  text-transform: lowercase;
  border-radius: 5px;
  margin-left: -1px;
  margin-right: 5px;
}

/* Card arrow */
.media-outlet-card:after {
  content: "";
  position: absolute;
  right: 15px;
  top: 50%;
  width: 10px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='18' viewBox='0 0 10 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L7.58579 7.58579C8.36684 8.36684 8.36684 9.63317 7.58579 10.4142L1 17' stroke='%230F1F2D' stroke-opacity='0.7' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.2s ease;
  transform: translateY(-50%);
}

.media-outlet-card:hover:after {
  transform: translate(4px, -50%);
  opacity: 0.7;
}

/* Pagination */
.jti-pagination {
  font-family: Roboto, sans-serif;
  display: flex;
  align-items: center;
  margin: 30px 0;
  justify-content: space-between;
}

.pagination-arrow {
  color: #0f1f2db2 !important;
  background: none !important;
  border: none;
  box-shadow: none;
  cursor: pointer;
}

.pagination-arrow:disabled {
  color: #0f1f2db2;
  cursor: not-allowed;
  background: none;
  border: none;
  box-shadow: none;
}

.pagination-numbers {
  display: flex;
  gap: 5px;
}

.page-number {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  color: #0f1f2db2;
  border-bottom: 1px solid #0f1f2db2;
}

.page-number.active {
  font-weight: 400;
  color: #0f1f2d;
  border-color: #0f1f2d;
    background: #fff;
}

.pagination-ellipsis {
  display: flex;
  align-items: center;
  padding: 0 5px;
}

/* Loading and Error States */
.loading-indicator,
.error-message,
.no-results {
  padding: 40px;
  text-align: center;
  color: #666;
}

/* Loading state styles for progressive loading */
.media-outlet-location.loading,
.media-outlet-status.loading,
.media-outlet-logo.loading {
  position: relative;
  min-height: 18px;
}

.media-outlet-location.loading .placeholder,
.media-outlet-status.loading .placeholder {
  display: none;
}

.media-outlet-location.loading::before,
.media-outlet-status.loading::before,
.media-outlet-logo.loading::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* Make sure the logo image is visible even during loading */
.media-outlet-logo.loading {
  overflow: visible;
}

.media-outlet-logo.loading img {
  position: relative;
  z-index: 2;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.error-message {
  color: #d32f2f;
}

/* Responsive Styles */
@media (max-width: 992px) {
  .jti-media-outlets-main {
    flex-direction: column;
  }

  .jti-media-outlets-countries {
    width: 100%;
  }

  .country-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .country-list label {
    width: calc(33.33% - 10px);
  }

  /* Keep 2 columns on tablets */
  .media-outlets-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .jti-media-outlets-search-filters {
    flex-direction: column;
  }

  .search-box {
    max-width: 100%;
  }

  .country-list label {
    width: calc(50% - 10px);
  }

  /* Switch to 1 column on mobile */
  .media-outlets-grid {
    grid-template-columns: 1fr;
  }

  .media-outlet-card {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .jti-media-outlets-search-filters {
    flex-direction: column;
  }

  .search-box {
    max-width: 100%;
  }

  .country-list label {
    width: calc(50% - 10px);
  }

  .media-outlet-card {
    max-height: none;
  }
}

@media (max-width: 480px) {
  #map {
    height: 50vh;
    max-width: 100%;
  }
  .country-list label {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .leaflet-control.legend,
  .leaflet-control.info {
    display: none !important;
  }
}
