/* Frontend styles for the posts by category block */
.posts-by-category {
  /* margin-bottom: 30px; */
}

/* Стили для заголовка блока */
.posts-by-category .posts-by-category-title {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  font-weight: 700;
}

/* Общие стили для контейнера постов */
.posts-by-category .posts-container {
  margin: 0 -15px;
}

/* Общие стили для карточек постов */
.posts-by-category .post-item {
  padding: 0 15px;
  margin-bottom: 30px;
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.posts-by-category .post-thumbnail {
  position: relative;
  overflow: hidden;
}

.posts-by-category .post-thumbnail img {
  width: 100%;
  height: auto;
  transition: transform 0.3s ease;
}

.posts-by-category .post-content {
  background: #fff;
}

.posts-by-category .post-title {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.25rem;
}

.posts-by-category .post-meta {
  font-size: 0.875rem;
  color: #6c757d;
  margin-bottom: 10px;
}

.posts-by-category .post-link {
  margin-top: 15px;
}

/* Стили для List Layout */
.posts-by-category.layout-list .post-item {
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .posts-by-category.layout-list .post-item {
    flex-direction: row;
  }
  
  .posts-by-category.layout-list .post-thumbnail {
    flex: 0 0 35%;
    /* margin-right: 20px; */
  }
  
  .posts-by-category.layout-list .post-content {
    flex: 1;
  }
}

/* Адаптивные стили для всех layout */
@media (max-width: 991.98px) {
  .posts-by-category .post-title {
    font-size: 1.1rem;
  }
  
  .posts-by-category .post-content {
    /* padding: 15px; */
  }
}

@media (max-width: 767.98px) {
  .posts-by-category .post-item {
    margin-bottom: 20px;
  }
  
  .posts-by-category.layout-list .post-item {
    flex-direction: column;
  }
  
  .posts-by-category.layout-list .post-thumbnail {
    flex: none;
    margin-right: 0;
    margin-bottom: 15px;
  }
  
  .posts-by-category .post-content {
    /* padding: 12px; */
  }
}

/* Grid layouts */
.posts-by-category.layout-grid .post-item {
  width: 100%;
}

@media (min-width: 576px) {
  .posts-by-category.layout-grid-2 .post-item {
    width: 50%;
  }
  
  .posts-by-category.layout-grid-3 .post-item {
    width: 50%;
  }
}

@media (min-width: 992px) {
  .posts-by-category.layout-grid-3 .post-item {
    width: 33.333%;
  }
}

/* Flexible Layout с использованием Bootstrap */
.posts-by-category.layout-flexible .posts-container {
  margin-left: -15px;
  margin-right: -15px;
}

/* Настройка карточек постов */
.posts-by-category.layout-flexible .post-item {
  margin-bottom: 30px;
}

/* Стилизация содержимого карточек - большие */
.posts-by-category.layout-flexible .post-item.large .post-title {
  font-size: 1.5rem;
  margin-bottom: 15px;
  line-height: 1.3;
}

.posts-by-category.layout-flexible .post-item.large .post-excerpt {
  /* font-size: 1.1rem; */
}

.posts-by-category.layout-flexible .post-item.large .post-thumbnail {
  margin-bottom: 15px;
}

/* Стилизация содержимого карточек - маленькие */
.posts-by-category.layout-flexible .post-item.small .post-title {
  font-size: 1.1rem;
  margin-bottom: 10px;
  line-height: 1.3;
}

.posts-by-category.layout-flexible .post-item.small .post-excerpt {
  /* font-size: 0.9rem; */
}

.posts-by-category.layout-flexible .post-item.small .post-thumbnail {
  margin-bottom: 10px;
}

/* Адаптивность для маленьких экранов */
@media (max-width: 767px) {
  .posts-by-category.layout-flexible .post-item {
    margin-bottom: 20px;
  }
  
  .posts-by-category.layout-flexible .post-item.large .post-title,
  .posts-by-category.layout-flexible .post-item.small .post-title {
    font-size: 1.2rem;
  }
  
  .posts-by-category.layout-flexible .post-content {
    padding: 12px;
  }
}

.posts-by-category.layout-list .posts-container article {
  width: 100%;
  padding: 0 15px;
  margin-bottom: 30px;
  display: flex;
}

.posts-by-category.layout-list .post-content {
  flex: 1;
}

.posts-by-category .post-thumbnail img {
  width: 100%;
  height: auto;
  display: block;
}

.posts-by-category .entry-title {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 20px;
}

.posts-by-category .entry-meta {
  color: #666;
  font-size: 14px;
  margin-bottom: 15px;
}

.posts-by-category .entry-content {
  margin-bottom: 15px;
}

.posts-by-category .entry-footer .read-more {
  display: inline-block;
  padding: 8px 15px;
  background-color: #0d6efd;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.posts-by-category .entry-footer .read-more:hover {
  background-color: #0a58ca;
}

/* Новые стили для слайдера постов */
.posts-by-category.layout-slider {
  position: relative;
}

.posts-slider-container {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

.posts-slider-track {
  display: flex;
  transition: transform 0.5s ease;
}

.posts-slide-item {
  flex: 0 0 auto;
  padding: 0 10px;
  box-sizing: border-box;
}

.posts-slide-item article {
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: #fff;
  border-radius: 5px;
  overflow: hidden;
  /* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.posts-slide-item article:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.posts-slide-item .post-thumbnail {
  position: relative;
  overflow: hidden;
}

.posts-slide-item .post-thumbnail img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.posts-slide-item .post-thumbnail:hover img {
  transform: scale(1.05);
}

.posts-slide-item .post-content {
  padding: 15px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.posts-slide-item .entry-title {
  font-size: 18px;
  margin-top: 0;
  margin-bottom: 10px;
}

.posts-slide-item .entry-meta {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
}

.posts-slide-item .entry-content {
  margin-bottom: 15px;
  flex-grow: 1;
}

.posts-slide-item .entry-footer {
  margin-top: auto;
}

.posts-slider-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.3s;
}

.posts-slider-control:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.posts-slider-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.posts-slider-prev {
  left: 10px;
}

.posts-slider-next {
  right: 10px;
}

.posts-slider-indicators {
  display: flex;
  justify-content: center;
  margin-top: 15px;
}

.posts-slider-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #ccc;
  border: none;
  margin: 0 5px;
  padding: 0;
  cursor: pointer;
  transition: background-color 0.3s;
}

.posts-slider-indicator.active {
  background-color: #0d6efd;
}

.posts-slider-message {
  padding: 20px;
  background-color: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  text-align: center;
  color: #666;
}

/* Адаптивные стили */
@media (max-width: 991px) {
  .posts-by-category.layout-grid-3 .posts-container article {
    width: 50%;
  }
  
  .posts-slide-item .entry-title {
    font-size: 16px;
  }
  
  .posts-slide-item .entry-meta {
    font-size: 13px;
  }
}

@media (max-width: 767px) {
  .posts-by-category.layout-grid-2 .posts-container article,
  .posts-by-category.layout-grid-3 .posts-container article {
    width: 100%;
  }
  
  .posts-by-category.layout-list .posts-container article {
    flex-direction: column;
  }
  
  .posts-by-category.layout-list .post-thumbnail {
    flex: none;
    margin-right: 0;
    margin-bottom: 15px;
  }
  
  .posts-slide-item .entry-title {
    font-size: 14px;
  }
  
  .posts-slide-item .entry-content {
    font-size: 13px;
  }
  
  .posts-slider-control {
    width: 30px;
    height: 30px;
    font-size: 18px;
  }
}

/* Flexible Layout Editor Styles */
.flexible-columns-preview {
    margin: 20px 0;
    padding: 15px;
    background: #f0f0f1;
    border-radius: 4px;
}

.preview-devices {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-device {
    background: #fff;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.preview-device span {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #1e1e1e;
}

.preview-device.desktop {
    border-left: 4px solid #2271b1;
}

.preview-device.tablet {
    border-left: 4px solid #72aee6;
}

.preview-device.mobile {
    border-left: 4px solid #2271b1;
}

.preview-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
    min-height: 40px;
    background: #f6f7f7;
    border-radius: 3px;
    padding: 10px;
}

.col-preview {
    padding: 0 10px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.col-preview-inner {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 3px;
    padding: 8px;
    text-align: center;
    font-size: 12px;
    color: #1e1e1e;
    height: 100%;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flexible-columns-editor {
    margin-top: 20px;
}

.flexible-column-item {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.flexible-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dcdcde;
}

.flexible-width-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.flexible-width-settings h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #1e1e1e;
}

.flexible-width-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.flexible-width-badges button {
    margin: 0 !important;
}

/* Responsive Preview Styles */
@media screen and (max-width: 782px) {
    .preview-device.desktop .preview-row {
        display: none;
    }
}

@media screen and (max-width: 600px) {
    .preview-device.tablet .preview-row {
        display: none;
    }
    
    .flexible-width-settings {
        grid-template-columns: 1fr;
    }
}

/* Frontend Styles for Flexible Layout */
.wp-block-rwt-posts-by-category.flexible-layout .row {
    margin: 0 -15px;
}

.wp-block-rwt-posts-by-category.flexible-layout .col {
    padding: 0 15px;
    margin-bottom: 30px;
}

/* Ticker Layout Styles */
.posts-ticker-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
    padding: 0.5rem 0;
}

.posts-ticker-container {
    height: 40px;
    overflow: hidden;
    background-color: #FFAE00;
}

.posts-ticker-content {
    line-height: 40px;
    color: #2A2A34;
    animation: text 30s infinite linear;
    padding-left: 100%;
    white-space: nowrap;
    width: -moz-fit-content;
    width: fit-content;
}

@keyframes text {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

.ticker-item {
    display: inline-block;
    padding: 0 2rem;
    font-size: 1rem;
    white-space: nowrap;
    vertical-align: middle;
}

.ticker-date {
    color: #fff;
    font-size: 0.95em;
    margin-right: 0.5rem;
}

.ticker-excerpt {
    margin-right: 20px;
    color: #2A2A34;
    font-size: 0.95em;
}

.ticker-title {
    color: #2A2A34;
    margin: 0 5px;
}
