/**
 * Academic Journal Theme - Custom Sidebar Components Styles
 * Styling for enhanced sidebar widgets
 * 
 * Components:
 * - Search Widget
 * - Featured Content
 * - Categories/Browse
 * - Recent Articles
 * - Newsletter Signup
 * - Social Media Links
 */

/* ────────────────────────────────────────────────────────────
   SIDEBAR BASE STYLES
   ──────────────────────────────────────────────────────────── */

.pkp_structure_sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.aj_sidebar_widget {
    background: var(--sidebar-widget-bg, #f9f9f9);
    border: 1px solid var(--sidebar-widget-border, #e0e0e0);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.aj_sidebar_widget:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ────────────────────────────────────────────────────────────
   WIDGET HEADERS
   ──────────────────────────────────────────────────────────── */

.aj_sidebar_announcements,
.aj_sidebar_search_widget,
.aj_sidebar_featured_widget,
.aj_sidebar_categories_widget,
.aj_sidebar_recent_articles_widget,
.aj_sidebar_newsletter_widget,
.aj_sidebar_social_widget {
    @extend .aj_sidebar_widget;
}

.aj_sidebar_announcements_header,
.aj_sidebar_search_header,
.aj_sidebar_featured_header,
.aj_sidebar_categories_header,
.aj_sidebar_recent_articles_header,
.aj_sidebar_newsletter_header,
.aj_sidebar_social_header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, 
        var(--sidebar-header-bg, #f5f5f5) 0%, 
        var(--sidebar-header-bg-light, #fafafa) 100%);
    border-bottom: 2px solid var(--sidebar-header-border, #e0e0e0);
}

.aj_sidebar_announcements_icon,
.aj_sidebar_search_icon,
.aj_sidebar_featured_icon,
.aj_sidebar_categories_icon,
.aj_sidebar_recent_articles_icon,
.aj_sidebar_newsletter_icon,
.aj_sidebar_social_icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--sidebar-icon-color, #0066cc);
    flex-shrink: 0;
}

.aj_sidebar_announcements_title,
.aj_sidebar_search_title,
.aj_sidebar_featured_title,
.aj_sidebar_categories_title,
.aj_sidebar_recent_articles_title,
.aj_sidebar_newsletter_title,
.aj_sidebar_social_title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--sidebar-header-text, #333);
}

/* ────────────────────────────────────────────────────────────
   SEARCH WIDGET
   ──────────────────────────────────────────────────────────── */

.aj_sidebar_search_form {
    padding: 1rem;
}

.aj_sidebar_search_input_wrapper {
    display: flex;
    gap: 0.5rem;
    border: 1px solid var(--search-border, #ddd);
    border-radius: 4px;
    overflow: hidden;
    background: white;
}

.aj_sidebar_search_input {
    flex: 1;
    padding: 0.75rem;
    border: none;
    font-size: 0.95rem;
    outline: none;
    background: transparent;
}

.aj_sidebar_search_input::placeholder {
    color: var(--search-placeholder, #999);
}

.aj_sidebar_search_button {
    padding: 0.75rem 0.875rem;
    border: none;
    background: var(--search-button-bg, #0066cc);
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aj_sidebar_search_button:hover {
    background: var(--search-button-hover, #0052a3);
}

/* ────────────────────────────────────────────────────────────
   FEATURED CONTENT WIDGET
   ──────────────────────────────────────────────────────────── */

.aj_sidebar_featured_list {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.aj_sidebar_featured_item {
    display: flex;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--sidebar-divider, #eee);
}

.aj_sidebar_featured_item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.aj_sidebar_featured_image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--featured-image-bg, #e0e0e0);
}

.aj_sidebar_featured_image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aj_sidebar_featured_content {
    flex: 1;
    min-width: 0;
}

.aj_sidebar_featured_category {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--featured-category-bg, #e8f4ff);
    color: var(--featured-category-text, #0066cc);
    border-radius: 3px;
    margin-bottom: 0.25rem;
}

.aj_sidebar_featured_item_title {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
}

.aj_sidebar_featured_item_title a {
    color: var(--featured-link-color, #0066cc);
    text-decoration: none;
    transition: color 0.3s ease;
}

.aj_sidebar_featured_item_title a:hover {
    color: var(--featured-link-hover, #0052a3);
    text-decoration: underline;
}

.aj_sidebar_featured_excerpt {
    margin: 0.25rem 0;
    font-size: 0.85rem;
    color: var(--featured-excerpt-text, #666);
    line-height: 1.4;
}

.aj_sidebar_featured_date {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--featured-date-text, #999);
}

/* ────────────────────────────────────────────────────────────
   CATEGORIES WIDGET
   ──────────────────────────────────────────────────────────── */

.aj_sidebar_categories_list {
    list-style: none;
    padding: 1rem;
    margin: 0;
}

.aj_sidebar_categories_item {
    margin-bottom: 0.75rem;
}

.aj_sidebar_categories_item:last-child {
    margin-bottom: 0;
}

.aj_sidebar_categories_link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    color: var(--categories-link-color, #0066cc);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.aj_sidebar_categories_link:hover {
    background: var(--categories-hover-bg, #f0f7ff);
    border-left-color: var(--categories-link-color, #0066cc);
    padding-left: 0.5rem;
}

.aj_sidebar_categories_name {
    font-weight: 500;
}

.aj_sidebar_categories_count {
    font-size: 0.85rem;
    color: var(--categories-count-text, #999);
    font-weight: normal;
}

.aj_sidebar_subcategories_list {
    list-style: none;
    padding: 0.5rem 0 0 1.5rem;
    margin: 0.5rem 0 0 0;
    border-left: 1px solid var(--categories-border, #e0e0e0);
}

.aj_sidebar_subcategories_list li {
    margin: 0.25rem 0;
}

.aj_sidebar_subcategories_list a {
    font-size: 0.9rem;
    color: var(--categories-sublink-color, #0066cc);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    display: inline-block;
    transition: color 0.3s ease;
}

.aj_sidebar_subcategories_list a:hover {
    color: var(--categories-link-hover, #0052a3);
    text-decoration: underline;
}

/* ────────────────────────────────────────────────────────────
   RECENT ARTICLES WIDGET
   ──────────────────────────────────────────────────────────── */

.aj_sidebar_recent_articles_list {
    list-style: none;
    padding: 1rem;
    margin: 0;
}

.aj_sidebar_recent_article_item {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--sidebar-divider, #eee);
}

.aj_sidebar_recent_article_item:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.aj_sidebar_recent_article_badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--article-badge-bg, #0066cc);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.aj_sidebar_recent_article_content {
    flex: 1;
    min-width: 0;
}

.aj_sidebar_recent_article_title {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
}

.aj_sidebar_recent_article_title a {
    color: var(--article-link-color, #0066cc);
    text-decoration: none;
    transition: color 0.3s ease;
}

.aj_sidebar_recent_article_title a:hover {
    color: var(--article-link-hover, #0052a3);
    text-decoration: underline;
}

.aj_sidebar_recent_article_authors {
    margin: 0.25rem 0;
    font-size: 0.8rem;
    color: var(--article-author-text, #666);
    font-style: italic;
}

.aj_sidebar_recent_article_issue {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    background: var(--article-issue-bg, #f0f0f0);
    color: var(--article-issue-text, #666);
    border-radius: 3px;
    margin-right: 0.5rem;
}

.aj_sidebar_recent_article_date {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--article-date-text, #999);
}

.aj_sidebar_recent_articles_more {
    display: block;
    padding: 1rem;
    text-align: center;
    color: var(--recent-more-link, #0066cc);
    text-decoration: none;
    background: var(--recent-more-bg, #f9f9f9);
    border-top: 1px solid var(--sidebar-divider, #eee);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.aj_sidebar_recent_articles_more:hover {
    background: var(--recent-more-hover-bg, #f0f0f0);
    color: var(--recent-more-hover, #0052a3);
}

/* ────────────────────────────────────────────────────────────
   NEWSLETTER WIDGET
   ──────────────────────────────────────────────────────────── */

.aj_sidebar_newsletter_content {
    padding: 1rem;
}

.aj_sidebar_newsletter_description {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: var(--newsletter-desc-text, #666);
    line-height: 1.4;
}

.aj_sidebar_newsletter_form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.aj_sidebar_newsletter_field {
    display: flex;
}

.aj_sidebar_newsletter_input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--newsletter-input-border, #ddd);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
}

.aj_sidebar_newsletter_input:focus {
    outline: none;
    border-color: var(--newsletter-button-bg, #0066cc);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--newsletter-button-bg, #0066cc) 15%, transparent);
}

.aj_sidebar_newsletter_categories {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--newsletter-categories-bg, #f9f9f9);
    border-radius: 4px;
}

.aj_sidebar_newsletter_label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    margin: 0;
}

.aj_sidebar_newsletter_label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--newsletter-button-bg, #0066cc);
}

.aj_sidebar_newsletter_button {
    padding: 0.875rem 1rem;
    background: var(--newsletter-button-bg, #0066cc);
    color: var(--newsletter-button-color, #ffffff);
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.aj_sidebar_newsletter_button:hover {
    background: var(--newsletter-button-hover, #0052a3);
}

.aj_sidebar_newsletter_privacy {
    margin: 0.75rem 0 0 0;
    font-size: 0.8rem;
    color: var(--newsletter-privacy-text, #999);
    text-align: center;
}

.aj_sidebar_newsletter_privacy a {
    color: var(--newsletter-privacy-link, #0066cc);
    text-decoration: none;
}

.aj_sidebar_newsletter_privacy a:hover {
    text-decoration: underline;
}

/* ────────────────────────────────────────────────────────────
   SOCIAL MEDIA WIDGET
   ──────────────────────────────────────────────────────────── */

.aj_sidebar_social_links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
    gap: 0.5rem;
    padding: 1rem;
}

.aj_sidebar_social_link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.75rem;
    border: 2px solid var(--social-border, #e0e0e0);
    border-radius: 8px;
    background: white;
    color: var(--social-text, #333);
    text-decoration: none;
    transition: all 0.3s ease;
}

.aj_sidebar_social_link:hover {
    border-color: var(--social-hover-border, #0066cc);
    background: var(--social-hover-bg, #f0f7ff);
}

.aj_sidebar_social_icon_svg {
    color: var(--social-icon-color, #0066cc);
    transition: color 0.3s ease;
}

.aj_sidebar_social_link:hover .aj_sidebar_social_icon_svg {
    color: var(--social-icon-hover, #0052a3);
}

.aj_sidebar_social_label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    text-align: center;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Social media specific styling */

.aj_sidebar_social_twitter:hover {
    border-color: #1DA1F2;
    background: rgba(29, 161, 242, 0.1);
}

.aj_sidebar_social_twitter:hover .aj_sidebar_social_icon_svg {
    color: #1DA1F2;
}

.aj_sidebar_social_facebook:hover {
    border-color: #4267B2;
    background: rgba(66, 103, 178, 0.1);
}

.aj_sidebar_social_facebook:hover .aj_sidebar_social_icon_svg {
    color: #4267B2;
}

.aj_sidebar_social_linkedin:hover {
    border-color: #0A66C2;
    background: rgba(10, 102, 194, 0.1);
}

.aj_sidebar_social_linkedin:hover .aj_sidebar_social_icon_svg {
    color: #0A66C2;
}

.aj_sidebar_social_instagram:hover {
    border-color: #E1306C;
    background: rgba(225, 48, 108, 0.1);
}

.aj_sidebar_social_instagram:hover .aj_sidebar_social_icon_svg {
    color: #E1306C;
}

.aj_sidebar_social_youtube:hover {
    border-color: #FF0000;
    background: rgba(255, 0, 0, 0.1);
}

.aj_sidebar_social_youtube:hover .aj_sidebar_social_icon_svg {
    color: #FF0000;
}

.aj_sidebar_social_github:hover {
    border-color: #333;
    background: rgba(51, 51, 51, 0.1);
}

.aj_sidebar_social_github:hover .aj_sidebar_social_icon_svg {
    color: #333;
}

/* ────────────────────────────────────────────────────────────
   CALL-TO-ACTION BUTTONS
   ──────────────────────────────────────────────────────────── */

.aj_sidebar_cta_buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--sidebar-widget-bg, #f9f9f9);
    border: 1px solid var(--sidebar-widget-border, #e0e0e0);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.aj_cta_button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--cta-button-bg, #0066cc);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    border: 2px solid transparent;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    text-align: left;
}

.aj_cta_button:hover {
    background: var(--cta-button-hover, #0052a3);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.2);
}

.aj_cta_button_icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.aj_cta_button_text {
    flex: 1;
}

.aj_cta_button_reviewer {
    background: var(--cta-reviewer-bg, #7c3aed);
    border-color: rgba(124, 58, 237, 0.3);
}

.aj_cta_button_reviewer:hover {
    background: #6d28d9;
}

.aj_cta_button_submit {
    background: var(--cta-submit-bg, #059669);
    border-color: rgba(5, 150, 105, 0.3);
}

.aj_cta_button_submit:hover {
    background: #047857;
}

/* ────────────────────────────────────────────────────────────
   RESPONSIVE DESIGN
   ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .pkp_structure_sidebar {
        gap: 1rem;
    }

    .aj_sidebar_announcements_header,
    .aj_sidebar_search_header,
    .aj_sidebar_featured_header,
    .aj_sidebar_categories_header,
    .aj_sidebar_recent_articles_header,
    .aj_sidebar_newsletter_header,
    .aj_sidebar_social_header {
        padding: 0.875rem;
    }

    .aj_sidebar_announcements_title,
    .aj_sidebar_search_title,
    .aj_sidebar_featured_title,
    .aj_sidebar_categories_title,
    .aj_sidebar_recent_articles_title,
    .aj_sidebar_newsletter_title,
    .aj_sidebar_social_title {
        font-size: 1rem;
    }

    .aj_sidebar_featured_list,
    .aj_sidebar_categories_list,
    .aj_sidebar_recent_articles_list {
        padding: 0.875rem;
    }

    .aj_sidebar_social_links {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .aj_sidebar_widget {
        border-radius: 6px;
    }

    .aj_sidebar_search_input_wrapper {
        flex-wrap: wrap;
    }

    .aj_sidebar_featured_item {
        flex-wrap: wrap;
    }

    .aj_sidebar_featured_image {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .aj_sidebar_social_links {
        grid-template-columns: repeat(3, 1fr);
    }

    .aj_sidebar_recent_articles_more {
        font-size: 0.85rem;
    }
}

/* ────────────────────────────────────────────────────────────
   DARK MODE SUPPORT (Optional)
   ──────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
    .aj_sidebar_widget {
        background: var(--sidebar-widget-bg-dark, #2a2a2a);
        border-color: var(--sidebar-widget-border-dark, #444);
        color: var(--sidebar-text-dark, #e0e0e0);
    }

    .aj_sidebar_announcements_header,
    .aj_sidebar_search_header,
    .aj_sidebar_featured_header,
    .aj_sidebar_categories_header,
    .aj_sidebar_recent_articles_header,
    .aj_sidebar_newsletter_header,
    .aj_sidebar_social_header {
        background: linear-gradient(135deg, 
            var(--sidebar-header-bg-dark, #333) 0%, 
            var(--sidebar-header-bg-light-dark, #2a2a2a) 100%);
        border-bottom-color: var(--sidebar-header-border-dark, #444);
    }

    .aj_sidebar_search_input_wrapper {
        border-color: var(--search-border-dark, #444);
        background: #1a1a1a;
    }

    .aj_sidebar_search_input {
        color: #e0e0e0;
    }

    .aj_sidebar_newsletter_categories {
        background: var(--newsletter-categories-bg-dark, #1a1a1a);
    }

    .aj_sidebar_social_link {
        border-color: var(--social-border-dark, #444);
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .aj_sidebar_social_link:hover {
        background: var(--social-hover-bg-dark, #2a2a2a);
    }

    .aj_cta_button {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }

    .aj_cta_button:hover {
        background: #3a3a3a;
        color: #fff;
    }

    .aj_cta_button_reviewer {
        border-color: #5a5a8a;
    }

    .aj_cta_button_submit {
        border-color: #8a5a5a;
    }
}
