:root {
  --ibct-orange: #EF3B00;
  --ibct-dark: #333333;
  --ibct-gray: #f8f9fa;
  --ibct-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --ibct-shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.1);
  --ibct-radius: 12px;
  --ibct-font: 'Poppins', sans-serif;
  --ibct-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ibct-publications-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  padding: 0 0 2rem 0;
  font-family: var(--ibct-font);
}

/* --- Hero Section --- */
.ibct-pubs-hero {
  text-align: center;
  margin-bottom: 2rem;
  padding: 0rem 1rem 2rem 1rem;
}

.ibct-pubs-hero h1.ibct-hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffffff;
  /* Improved contrast for dark backgrounds */
  margin-bottom: 0.5rem;
}

.ibct-pubs-hero .ibct-hero-subtitle {
  font-size: 1.2rem;
  color: #dddddd;
}

/* --- Media Action Column --- */
.ibct-pub-media {
  display: block;
}

.ibct-pub-actions {
  padding: 0 1.5rem 1.5rem 1.5rem;
  margin-top: -0.5rem;
}

/* --- View Toggles --- */
.ibct-view-toggles-wrapper {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.ibct-view-toggles {
  display: flex;
  gap: 0.25rem;
  background: #fff;
  padding: 0.25rem;
  border-radius: 6px;
  border: 1px solid #eaeaea;
}

.ibct-view-btn {
  background: none;
  border: none;
  padding: 0.4rem;
  border-radius: 4px;
  color: #aaa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.ibct-view-btn:hover {
  background-color: #f5f5f5;
  color: #666;
}

.ibct-view-btn.active {
  background-color: var(--ibct-gray);
  color: var(--ibct-orange);
}

/* --- List View Styles --- */
.ibct-publications-grid.list-view {
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.ibct-publications-grid.list-view .ibct-pub-card {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr;
  /* Columns: Left (Media+Action), Right (Content) */
  height: auto;
  min-height: 220px;
  align-items: start;
}

.ibct-publications-grid.list-view .ibct-pub-media {
  grid-row: 1;
  grid-column: 1;
  border-right: 1px solid #f0f0f0;
  background-color: #f9f9f9;
}

.ibct-publications-grid.list-view .ibct-pub-image-wrapper {
  width: 100%;
  padding-top: 66.66%;
  /* Keep aspect ratio logic or reset? */
  /* For List View, maybe we want fixed height? User liked "Small logical size". */
  /* 240px width * 0.66 = ~160px height. */
  border-bottom: none;
  background-color: transparent;
}

.ibct-publications-grid.list-view .ibct-pub-image {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  object-fit: contain;
  padding: 1rem;
}

.ibct-publications-grid.list-view .ibct-pub-actions {
  grid-row: 2;
  grid-column: 1;
  border-right: 1px solid #f0f0f0;
  background-color: #f9f9f9;
  padding: 0 1rem 1rem 1rem;
  /* Pad button */
  display: flex;
  align-items: flex-start;
  margin-top: 0;
}

.ibct-publications-grid.list-view .ibct-pub-content {
  grid-row: 1 / -1;
  grid-column: 2;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}

.ibct-publications-grid.list-view .ibct-pub-excerpt {
  margin-bottom: 1rem;
  display: block;
}

@media (max-width: 768px) {
  .ibct-publications-grid.list-view .ibct-pub-card {
    display: flex;
    flex-direction: column;
  }

  .ibct-publications-grid.list-view .ibct-pub-media,
  .ibct-publications-grid.list-view .ibct-pub-actions {
    border-right: none;
    width: 100%;
  }
}

/* --- Filter Form Styles --- */
.ibct-pubs-filter-form {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #fff;
  border-radius: var(--ibct-radius);
  box-shadow: var(--ibct-shadow-sm);
}

.ibct-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
  align-items: center;
}

.ibct-filter-group {
  flex-grow: 1;
  min-width: 180px;
}

.ibct-search-group {
  flex-grow: 2;
  min-width: 220px;
}

.ibct-pubs-filter-form select,
.ibct-pubs-filter-form input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background-color: #f9f9f9;
  font-family: var(--ibct-font);
  font-size: 0.95rem;
  color: var(--ibct-dark);
  transition: border-color 0.2s;
}

.ibct-pubs-filter-form select:focus,
.ibct-pubs-filter-form input[type="text"]:focus {
  outline: none;
  border-color: var(--ibct-orange);
  background-color: #fff;
}

.ibct-filter-btn {
  padding: 0.75rem 1.5rem;
  background-color: var(--ibct-dark);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-family: var(--ibct-font);
}

.ibct-reset-btn {
  color: #666;
  text-decoration: underline;
  font-size: 0.9rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  /* Push to right */
}

/* --- Loader --- */
#ibct-loader {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 10px 0;
}

.ibct-spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--ibct-orange);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: ibct-spin 1s linear infinite;
}

@keyframes ibct-spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* --- Card Styles --- */
.ibct-pub-card {
  background: white;
  border-radius: var(--ibct-radius);
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: var(--ibct-shadow-sm);
  transition: var(--ibct-transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  height: 100%;
}

/* --- Stretched Link (Clickable Card) --- */
.ibct-stretched-link::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  content: "";
}

/* Ensure Download Button sits ABOVE the stretched link */
.ibct-pub-actions,
.ibct-pub-button {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.ibct-pub-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--ibct-shadow-hover);
}

.ibct-pub-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 66.66%;
  /* 3:2 Aspect Ratio - better for taller docs */
  overflow: hidden;
  background-color: #ffffff;
  /* White bg for documents */
  border-bottom: 1px solid #f0f0f0;
}

.ibct-pub-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Shows full image */
  padding: 1rem;
  /* Padding so it doesn't touch edges */
  transition: transform 0.5s ease;
}

.ibct-pub-card:hover .ibct-pub-image {
  transform: scale(1.02);
}

.ibct-pub-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.ibct-pub-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ibct-tag {
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  /* More formal squared aesthetic */
  background-color: var(--ibct-gray);
  color: #666;
}

.ibct-pub-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ibct-dark);
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
}

.ibct-pub-excerpt {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  /* Removed line-clamp to show full text as requested */
  flex-grow: 1;
}

.ibct-pub-footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f0f0f0;
}

.ibct-meta-item strong {
  color: var(--ibct-dark);
}

.ibct-pub-button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem;
  background-color: var(--ibct-orange);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: opacity 0.2s;
  border: none;
  cursor: pointer;
  margin-top: auto;
}

.ibct-pub-button:hover {
  opacity: 0.9;
  color: white;
}

.ibct-pub-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

@media (max-width: 768px) {
  .ibct-publications-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Hero Section --- */
.ibct-pubs-hero {
  position: relative;
  background: linear-gradient(135deg, var(--ibct-dark) 0%, #1a1a1a 100%);
  color: white;
  padding: 4rem 2rem;
  border-radius: var(--ibct-radius);
  margin-bottom: 3rem;
  text-align: center;
  overflow: hidden;
}

.ibct-pubs-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('https://ibct-mena.com/wp-content/uploads/2020/09/pattern-09.png');
  opacity: 0.1;
  pointer-events: none;
}

.ibct-hero-content {
  position: relative;
  z-index: 1;
}

.ibct-hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: white;
}

.ibct-hero-subtitle {
  font-size: 1.1rem;
  opacity: 0.8;
  max-width: 600px;
  margin: 0 auto;
}

/* --- Load More --- */
.ibct-load-more-wrapper {
  text-align: center;
  margin-top: 4rem;
  /* Increased spacing */
  margin-bottom: 2rem;
}

.ibct-load-more-btn {
  display: inline-block;
  padding: 12px 30px;
  background-color: transparent;
  color: var(--ibct-dark);
  border: 2px solid var(--ibct-dark);
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--ibct-font);
  font-size: 1rem;
}

.ibct-load-more-btn:hover:not(:disabled) {
  background-color: var(--ibct-dark);
  color: white;
}

.ibct-load-more-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* --- Single Page Template --- */
.ibct-single-wrapper {
  background-color: #f9f9f9;
  padding-bottom: 4rem;
}

.ibct-single-hero {
  background: linear-gradient(135deg, var(--ibct-dark) 0%, #1a1a1a 100%) !important;
  color: white !important;
  padding: 4rem 0;
  margin-bottom: 3rem;
  position: relative;
  width: 100%;
  border-radius: 0;
}

.ibct-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.ibct-hero-label {
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
  opacity: 0.8;
  display: block;
  margin-bottom: 0.5rem;
}

.ibct-single-title {
  font-size: 2.5rem;
  margin: 0 0 1rem 0;
  color: white;
}

.ibct-hero-meta {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 0.95rem;
  opacity: 0.9;
}

.ibct-single-body {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: flex-start;
}

.ibct-single-main {
  flex: 1 !important;
  min-width: 0 !important;
  width: 100% !important;
  /* Force override Divi's 47% */
  max-width: 100% !important;
}

/* High-specificity Divi overrides */
.ibct-single-wrapper .ibct-single-body .ibct-single-main,
.et_pb_gutters3 .ibct-single-main,
.et_pb_gutters3.et_pb_row .ibct-single-main,
div.ibct-single-main {
  flex: 1 !important;
  width: 100% !important;
  max-width: 100% !important;
}


.ibct-single-sidebar {
  flex: 0 0 350px;
  max-width: 350px;
}

.ibct-single-featured-image img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
  display: block;
}

.ibct-single-content-area {
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  line-height: 1.8;
  font-size: 1.05rem;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  color: #444;
}

/* Divi override for content area */
.ibct-single-wrapper .ibct-single-content-area,
.et_pb_gutters3 .ibct-single-content-area {
  width: 100% !important;
  max-width: 100% !important;
}

/* Override Divi columns INSIDE the content area */
.ibct-single-content-area .et_pb_column,
.ibct-single-content-area .et_pb_column_1_2,
.ibct-single-content-area .et_pb_column_1_3,
.ibct-single-content-area .et_pb_column_2_3,
.ibct-single-content-area [class*="et_pb_column"] {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  float: none !important;
}

.ibct-single-content-area .et_pb_row,
.ibct-single-content-area .et_pb_section {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
}

.ibct-single-content-area .et_pb_gutters3 .et_pb_column_1_2,
.ibct-single-content-area .et_pb_gutters3.et_pb_row .et_pb_column_1_2 {
  width: 100% !important;
}

/* Sidebar Card */
.ibct-sidebar-card {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 40px;
}

.ibct-btn-download {
  display: block;
  width: 100%;
  text-align: center;
  padding: 15px;
  color: white;
  font-weight: 700;
  text-decoration: none;
  border-radius: 4px;
  margin-bottom: 20px;
  transition: opacity 0.3s;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

.ibct-btn-download:hover {
  opacity: 0.9;
  color: white;
}

.ibct-meta-list {
  border-top: 1px solid #eee;
  padding-top: 15px;
}

.ibct-meta-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 0.95rem;
}

.ibct-meta-row:last-child {
  border-bottom: none;
}

.meta-label {
  color: #888;
  font-weight: 500;
}

.meta-value {
  color: #333;
  font-weight: 600;
  text-align: right;
}

/* Responsive */
@media (max-width: 850px) {
  .ibct-single-body {
    flex-direction: column;
  }

  .ibct-single-sidebar {
    order: -1;
    /* Sidebar on top on mobile for easy download */
  }
}

/* Back Link */
.ibct-back-link {
  display: inline-block;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  margin-bottom: 15px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.3s;
}

.ibct-back-link:hover {
  color: #fff;
  text-decoration: none;
}

/* Related Publications */
.ibct-related-section {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid #eee;
}

.ibct-related-title {
  font-size: 1.8rem;
  margin-bottom: 30px;
  color: #333;
}