/* =============================================
   Custom Widgets Styles
   ============================================= */

/* Shared Widget Styles */
.widget-recent-posts,
.widget-category-posts {
    margin-bottom: 1.5rem;
}

.widget-recent-posts__title,
.widget-category-posts__title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.widget-recent-posts__list,
.widget-category-posts__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget-recent-posts__item,
.widget-category-posts__item {
    margin-bottom: 0.75rem;
}

.widget-recent-posts__item:last-child,
.widget-category-posts__item:last-child {
    margin-bottom: 0;
}

.widget-recent-posts__link,
.widget-category-posts__link {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.widget-recent-posts__link:hover,
.widget-category-posts__link:hover {
    opacity: 0.8;
}

/* Thumbnail */
.widget-recent-posts__thumb,
.widget-category-posts__thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    background: #f3f4f6;
}

.widget-recent-posts__thumb img,
.widget-category-posts__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.widget-recent-posts__thumb--placeholder,
.widget-category-posts__thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.widget-recent-posts__thumb--placeholder svg,
.widget-category-posts__thumb--placeholder svg {
    width: 24px;
    height: 24px;
}

/* Content */
.widget-recent-posts__content,
.widget-category-posts__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.widget-recent-posts__post-title,
.widget-category-posts__post-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.widget-recent-posts__date {
    font-size: 0.75rem;
    color: #6b7280;
}

.widget-category-posts__category {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--theme-primary, #0f4c81);
}

/* =============================================
   Search Widget
   ============================================= */
.widget-search {
    margin-bottom: 1.5rem;
}

.widget-search__title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.widget-search__form {
    display: flex;
    gap: 0;
}

.widget-search__input {
    flex: 1;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    border: 1px solid #e5e7eb;
    border-right: none;
    border-radius: 4px 0 0 4px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s ease;
}

.widget-search__input:focus {
    border-color: var(--theme-primary, #0f4c81);
}

.widget-search__button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    padding: 0;
    border: none;
    border-radius: 0 4px 4px 0;
    background: var(--theme-primary, #0f4c81);
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.widget-search__button:hover {
    opacity: 0.9;
}

.widget-search__button svg {
    width: 18px;
    height: 18px;
}

/* =============================================
   Authors Widget
   ============================================= */
.widget-authors {
    margin-bottom: 1.5rem;
}

.widget-authors__title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.widget-authors__cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.widget-authors__author {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    color: #374151;
    background: #f3f4f6;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
}

.widget-authors__author:hover {
    background: var(--theme-primary, #0f4c81);
    color: #fff;
}

.widget-authors__count {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.widget-authors__author:hover .widget-authors__count {
    background: rgba(255, 255, 255, 0.2);
}

/* =============================================
   Tags Cloud Widget
   ============================================= */
.widget-tags {
    margin-bottom: 1.5rem;
}

.widget-tags__title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.widget-tags__cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.widget-tags__tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    color: #374151;
    background: #f3f4f6;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
}

.widget-tags__tag:hover {
    background: var(--theme-primary, #0f4c81);
    color: #fff;
}

.widget-tags__count {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.widget-tags__tag:hover .widget-tags__count {
    background: rgba(255, 255, 255, 0.2);
}

/* =============================================
   Footer Widget Adaptations
   ============================================= */

/* Ensure proper layout in footer */
.site-footer .widget-recent-posts,
.site-footer .widget-category-posts {
    margin-bottom: 0;
}

.site-footer .widget-recent-posts__link,
.site-footer .widget-category-posts__link {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
}

.site-footer .widget-recent-posts__thumb,
.site-footer .widget-category-posts__thumb {
    flex-shrink: 0 !important;
}

.site-footer .widget-recent-posts__content,
.site-footer .widget-category-posts__content {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Adapt widget titles to footer colors */
.site-footer .widget-recent-posts__title,
.site-footer .widget-category-posts__title,
.site-footer .widget-search__title,
.site-footer .widget-authors__title,
.site-footer .widget-tags__title {
    color: var(--footer-heading, #ffffff);
}

/* Adapt post titles to footer colors */
.site-footer .widget-recent-posts__post-title,
.site-footer .widget-category-posts__post-title {
    color: var(--footer-link, #d1d5db);
}

.site-footer .widget-recent-posts__link:hover .widget-recent-posts__post-title,
.site-footer .widget-category-posts__link:hover .widget-category-posts__post-title {
    color: var(--footer-link-hover, #ffffff);
}

/* Adapt dates and metadata to footer text color */
.site-footer .widget-recent-posts__date {
    color: var(--footer-text, #9ca3af);
}

.site-footer .widget-category-posts__category {
    color: var(--footer-link, #d1d5db);
}

/* Adapt thumbnails for dark footer background */
.site-footer .widget-recent-posts__thumb,
.site-footer .widget-category-posts__thumb {
    background: rgba(255, 255, 255, 0.05);
}

.site-footer .widget-recent-posts__thumb--placeholder,
.site-footer .widget-category-posts__thumb--placeholder {
    color: var(--footer-text, #9ca3af);
}

/* Adapt search widget to footer colors */
.site-footer .widget-search__input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--footer-link, #d1d5db);
}

.site-footer .widget-search__input::placeholder {
    color: var(--footer-text, #9ca3af);
}

.site-footer .widget-search__input:focus {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

/* Adapt tag/author clouds to footer colors */
.site-footer .widget-authors__author,
.site-footer .widget-tags__tag {
    color: var(--footer-link, #d1d5db);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 0.875rem;
}

.site-footer .widget-authors__author:hover,
.site-footer .widget-tags__tag:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--footer-link-hover, #ffffff);
}

.site-footer .widget-authors__count,
.site-footer .widget-tags__count {
    background: rgba(255, 255, 255, 0.1);
}

.site-footer .widget-authors__author:hover .widget-authors__count,
.site-footer .widget-tags__tag:hover .widget-tags__count {
    background: rgba(255, 255, 255, 0.2);
}
