/**
 * Blog Templates Styles
 * Additional styles for blog archive and single post pages
 * 
 * @package elfas
 */

/* ==========================================================================
   Archive Page Styles
   ========================================================================== */

/* Стилизованный поиск в сайдбаре */
.widget-search--styled {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
    height: auto;
}

.widget-search--styled .widget__title {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #333;
}

.widget-search--styled .widget-search__body {
    margin: 0;
}

.widget-search--styled .widget-search__form {
    margin: 0;
}

.widget-search--styled .widget-search__input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 8px; /* Радиус для всего контейнера */
    overflow: hidden; /* Обрезаем углы */
}

.widget-search--styled .widget-search__input {
    width: 100%;
    padding: 0.85rem 3.5rem 0.85rem 1.25rem; /* Увеличили padding */
    border: 2px solid #e0e0e0;
    border-radius: 8px; /* Увеличили радиус */
    font-size: 1rem; /* Увеличили размер шрифта */
    line-height: 1.5;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #fafafa; /* Легкий серый фон */
}

.widget-search--styled .widget-search__input::placeholder {
    color: #999;
    opacity: 1;
}

.widget-search--styled .widget-search__input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.1);
    background: #fff; /* Белый фон при фокусе */
}

.widget-search--styled .widget-search__button {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    background: #007bff;
    border: none;
    border-radius: 6px; /* Чуть меньше чем у поля */
    width: 40px; /* Увеличили */
    height: 40px; /* Увеличили */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.widget-search--styled .widget-search__button:hover {
    background: #0056b3;
    transform: translateY(-50%) scale(1.05); /* Легкое увеличение */
}

.widget-search--styled .widget-search__button:active {
    transform: translateY(-50%) scale(0.95); /* Нажатие */
}

.widget-search--styled .widget-search__button svg {
    fill: #fff;
    width: 20px;
    height: 20px;
}

/* Описание категории/тега */
.block-header__description {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    border-radius: 4px;
}

.block-header__description p:last-child {
    margin-bottom: 0;
}

/* Toolbar с счетчиком постов */
.posts-view__toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.posts-view__count {
    font-size: 0.95rem;
    color: #666;
}

.posts-view__count strong {
    color: #333;
    font-weight: 600;
}

/* Post Card - Grid Layout */
.post-card--layout--grid {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.post-card--layout--grid:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.post-card--layout--grid .post-card__image {
    position: relative;
    overflow: hidden;
    padding-top: 56%; /* Более компактное соотношение 16:9 */
}

.post-card--layout--grid .post-card__image a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.post-card--layout--grid .post-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-card--layout--grid:hover .post-card__image img {
    transform: scale(1.05);
}

.post-card--layout--grid .post-card__info {
    padding: 1.25rem; /* Уменьшили с 1.5rem */
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card--layout--grid .post-card__category {
    margin-bottom: 0.5rem; /* Уменьшили с 0.75rem */
}

.post-card--layout--grid .post-card__category a {
    display: inline-block;
    padding: 0.2rem 0.6rem; /* Уменьшили */
    background-color: #007bff;
    color: #fff;
    font-size: 0.7rem; /* Уменьшили с 0.75rem */
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 3px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.post-card--layout--grid .post-card__category a:hover {
    background-color: #0056b3;
}

.post-card--layout--grid .post-card__name {
    margin-bottom: 0.5rem; /* Уменьшили с 0.75rem */
    flex-grow: 0;
}

.post-card--layout--grid .post-card__name a {
    color: #333;
    font-size: 1.125rem; /* Уменьшили с 1.25rem */
    font-weight: 600;
    line-height: 1.3; /* Уменьшили с 1.4 */
    text-decoration: none;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card--layout--grid .post-card__name a:hover {
    color: #007bff;
}

.post-card--layout--grid .post-card__date {
    margin-bottom: 0.5rem; /* Уменьшили с 0.75rem */
    color: #999;
    font-size: 0.8rem; /* Уменьшили с 0.875rem */
}

.post-card--layout--grid .post-card__content {
    margin-bottom: 0.75rem; /* Уменьшили с 1rem */
    color: #666;
    font-size: 0.9rem; /* Уменьшили с 0.95rem */
    line-height: 1.5; /* Уменьшили с 1.6 */
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Ограничиваем 3 строками */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card--layout--grid .post-card__read-more {
    margin-top: auto;
}

.post-card--layout--grid .post-card__read-more .btn {
    font-size: 0.875rem; /* Меньше кнопка */
    padding: 0.4rem 0.8rem;
}

/* Post Card - List Layout */
.post-card--layout--list {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    margin-bottom: 1.5rem;
}

.post-card--layout--list:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.post-card--layout--list .post-card__row {
    display: flex;
    flex-direction: row;
}

.post-card--layout--list .post-card__image {
    flex-shrink: 0;
    width: 200px;
    overflow: hidden;
}

.post-card--layout--list .post-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-card--layout--list:hover .post-card__image img {
    transform: scale(1.05);
}

.post-card--layout--list .post-card__info {
    padding: 1.5rem;
    flex: 1;
}

.post-card--layout--list .post-card__category {
    margin-bottom: 0.5rem;
}

.post-card--layout--list .post-card__category a {
    color: #007bff;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    text-decoration: none;
}

.post-card--layout--list .post-card__name {
    margin-bottom: 0.75rem;
}

.post-card--layout--list .post-card__name a {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-card--layout--list .post-card__name a:hover {
    color: #007bff;
}

.post-card--layout--list .post-card__meta {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: #999;
}

.post-card--layout--list .post-card__meta a {
    color: #666;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-card--layout--list .post-card__meta a:hover {
    color: #007bff;
}

.post-card--layout--list .post-card__meta i {
    margin-right: 0.25rem;
}

.post-card--layout--list .post-card__content {
    margin-bottom: 1rem;
    color: #666;
    line-height: 1.6;
}

/* ==========================================================================
   Single Post Page Styles
   ========================================================================== */

/* Post Navigation (prev/next) */
.post__navigation {
    margin: 2rem 0;
}

.post-navigation {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.post-navigation__item {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.post-navigation__item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.post-navigation__item a {
    display: block;
    padding: 1.25rem;
    text-decoration: none;
    color: #333;
}

.post-navigation__direction {
    display: block;
    font-size: 0.875rem;
    color: #999;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-weight: 600;
}

.post-navigation__title {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
    transition: color 0.2s ease;
}

.post-navigation__item:hover .post-navigation__title {
    color: #007bff;
}

.post-navigation__item--prev .post-navigation__direction::before {
    content: "← ";
}

.post-navigation__item--next {
    text-align: right;
}

.post-navigation__item--next .post-navigation__direction::after {
    content: " →";
}

/* Related Posts */
.related-posts {
    margin-top: 1rem;
}

.related-posts__list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.post-card--layout--related {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    min-height: 320px; /* Минимальная высота для единообразия */
}

.post-card--layout--related:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.post-card--layout--related .post-card__image {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 180px; /* Фиксированная высота вместо padding-top */
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    flex-shrink: 0;
}

/* Если нет изображения, показываем заглушку */
.post-card--layout--related .post-card__image:empty::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.post-card--layout--related .post-card__image a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-card--layout--related .post-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-card--layout--related:hover .post-card__image img {
    transform: scale(1.05);
}

.post-card--layout--related .post-card__info {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.post-card--layout--related .post-card__name {
    margin: 0 0 0.75rem 0;
}

.post-card--layout--related .post-card__name a {
    color: #333;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card--layout--related .post-card__name a:hover {
    color: #007bff;
}

.post-card--layout--related .post-card__date {
    color: #999;
    font-size: 0.875rem;
    margin-top: auto;
}

/* ==========================================================================
   Comments Styles
   ========================================================================== */

.comments-area {
    margin-top: 3rem;
}

.comments-title {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.comments-count {
    color: #007bff;
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

.comment {
    margin-bottom: 2rem;
}

.comment-body {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.comment-author-avatar {
    flex-shrink: 0;
}

.comment-author-avatar img {
    border-radius: 50%;
}

.comment-content-wrap {
    flex: 1;
}

.comment-meta {
    margin-bottom: 1rem;
}

.comment-author-name {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.comment-metadata {
    font-size: 0.875rem;
    color: #999;
}

.comment-metadata a {
    color: #999;
    text-decoration: none;
    margin-right: 1rem;
}

.comment-metadata a:hover {
    color: #007bff;
}

.comment-reply-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
    margin-left: 1rem;
}

.comment-reply-link:hover {
    text-decoration: underline;
}

.comment-text {
    color: #333;
    line-height: 1.7;
}

.comment-awaiting-moderation {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* Nested comments */
.children {
    list-style: none;
    padding-left: 2rem;
    margin-top: 1rem;
}

/* Comment form */
.comment-form {
    margin-top: 2rem;
}

.comment-reply-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.comment-notes {
    margin-bottom: 1rem;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 991px) {
    /* Related posts 2 columns on tablet */
    .related-posts__list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    /* List layout becomes column on mobile */
    .post-card--layout--list .post-card__row {
        flex-direction: column;
    }
    
    .post-card--layout--list .post-card__image {
        width: 100%;
        padding-top: 60%;
        position: relative;
    }
    
    .post-card--layout--list .post-card__image img {
        position: absolute;
        top: 0;
        left: 0;
    }
    
    /* Post navigation stacks on mobile */
    .post-navigation {
        flex-direction: column;
    }
    
    .post-navigation__item--next {
        text-align: left;
    }
    
    /* Comments padding */
    .comment-body {
        padding: 1rem;
    }
    
    .children {
        padding-left: 1rem;
    }
    
    /* Related posts single column */
    .related-posts__list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575px) {
    .post-card--layout--grid .post-card__name a {
        font-size: 1.125rem;
    }
    
    .post-card--layout--list .post-card__name a {
        font-size: 1.25rem;
    }
    
    .comment-body {
        flex-direction: column;
    }
}

/* Скрываем excerpt в блоке постов на мобилке */ 
@media (max-width: 767px) {
    .block-posts .post-card__content {
        display: none;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .post-card__read-more,
    .post-navigation,
    .related-posts,
    .post__share-links,
    .comment-form,
    .comment-reply-link {
        display: none !important;
    }
}
