/**
 * Professional Blog Widget - Frontend Styles
 * Version: 4.2.0
 * Auto-height image support added
 */

/* ========================================
   Base Container Styles
   ======================================== */
.pbw-blog-container {
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
}

/* ========================================
   Blog List Wrapper
   ======================================== */
.pbw-blog-list-wrapper {
    flex: 1;
    background: transparent;
    padding: 0;
    min-width: 0;
}

/* ========================================
   Blog Card Styles
   ======================================== */
.pbw-blog-card {
    display: flex;
    align-items: flex-start;
    transition: transform 0.3s ease;
    position: relative;
}

.pbw-blog-card:hover {
    transform: translateX(5px);
}

.pbw-blog-card:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* ========================================
   Image Container - Default Styles
   ======================================== */
.pbw-blog-image-container {
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.pbw-blog-image-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.pbw-blog-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, filter 0.3s ease;
    display: block;
}

.pbw-placeholder-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ========================================
   Auto-Height Specific Styles
   ======================================== */
[data-image-height-type="auto"] .pbw-blog-card {
    display: flex !important;
    align-items: stretch !important;
}

[data-image-height-type="auto"] .pbw-blog-image-container {
    height: 100% !important;
    min-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

[data-image-height-type="auto"] .pbw-blog-image-link {
    flex: 1 !important;
    position: relative !important;
    overflow: hidden !important;
}

[data-image-height-type="auto"] .pbw-blog-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

[data-image-height-type="auto"] .pbw-placeholder-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* ========================================
   Title Badge Styles
   ======================================== */
.pbw-title-badge {
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    text-align: center;
    z-index: 3;
    transition: all 0.3s ease;
    background-color: #facf39;
    padding: 15px 25px;
    border-radius: 25px;
    min-width: 200px;
    max-width: 280px;
}

.pbw-badge-heading {
    margin-bottom: 5px;
    line-height: 1.2;
    text-transform: lowercase;
    font-weight: bold;
    color: #000;
}

.pbw-badge-subtitle {
    line-height: 1.3;
    text-transform: capitalize;
    opacity: 0.8;
    color: #000;
}

.pbw-badge-full-title {
    line-height: 1.3;
    font-weight: 600;
    color: #000;
}

.pbw-blog-card:hover .pbw-title-badge {
    transform: translateX(-50%) translateY(-3px);
}

/* ========================================
   Blog Content Section
   ======================================== */
.pbw-blog-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
    padding: 20px 30px;
}

/* Post Title */
.pbw-post-title {
    line-height: 1.3;
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 600;
    text-transform: uppercase;
}

.pbw-post-title a {
    text-decoration: none;
    transition: color 0.3s ease;
    color: #1a1a1a;
}

.pbw-post-title a:hover {
    color: #facf39;
}

/* Blog Meta/Date */
.pbw-blog-meta {
    font-weight: 400;
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
}

/* Blog Excerpt */
.pbw-blog-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 20px 0;
    flex-grow: 1;
    color: #333;
    line-height: 1.6;
}

/* Read More Link */
.pbw-read-more {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    margin-top: auto;
    color: #facf39;
    font-weight: 600;
}

.pbw-read-more-arrow {
    margin-left: 5px;
    transition: transform 0.3s ease;
    display: inline-block;
}

.pbw-read-more:hover {
    color: #000;
}

.pbw-read-more:hover .pbw-read-more-arrow {
    transform: translateX(5px);
}

/* ========================================
   Pagination Styles
   ======================================== */
.pbw-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
}

.pbw-pagination .page-numbers {
    display: inline-flex;
    list-style: none;
    gap: 10px;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.pbw-pagination a,
.pbw-pagination span {
    display: inline-block;
    padding: 10px 15px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid #ddd;
    color: #333;
}

.pbw-pagination a:hover {
    background: #facf39;
    border-color: #facf39;
    color: #000;
}

.pbw-pagination .current {
    background: #facf39;
    border-color: #facf39;
    color: #000;
}

/* ========================================
   No Posts Message
   ======================================== */
.pbw-no-posts {
    text-align: center;
    padding: 60px 20px;
}

.pbw-no-posts p {
    font-size: 18px;
    color: #6b7280;
    margin: 0;
}

/* ========================================
   Blog Posts Container
   ======================================== */
.pbw-blog-posts {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    .pbw-blog-container {
        padding: 0 20px;
    }
    
    .pbw-blog-content {
        padding: 15px 20px;
    }
}

@media (max-width: 768px) {
    .pbw-blog-card {
        flex-direction: column !important;
    }
    
    .pbw-blog-image-container {
        width: 100% !important;
        max-width: 100% !important;
        height: 250px !important;
        min-height: 250px !important;
    }
    
    /* Override auto-height on mobile */
    [data-image-height-type="auto"] .pbw-blog-image-container {
        height: 250px !important;
        min-height: 250px !important;
    }
    
    .pbw-blog-content {
        width: 100%;
        padding: 20px 0 0 0;
    }
    
    .pbw-blog-excerpt {
        -webkit-line-clamp: 2;
    }
    
    .pbw-post-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .pbw-blog-list-wrapper {
        padding: 0 15px;
    }
    
    .pbw-pagination a,
    .pbw-pagination span {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .pbw-blog-image-container {
        height: 200px !important;
        min-height: 200px !important;
    }
    
    [data-image-height-type="auto"] .pbw-blog-image-container {
        height: 200px !important;
        min-height: 200px !important;
    }
    
    .pbw-title-badge {
        min-width: 150px;
        max-width: 220px;
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* ========================================
   Accessibility
   ======================================== */
.pbw-blog-card:focus-within {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

.pbw-read-more:focus,
.pbw-post-title a:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Screen Reader Only Text */
.screen-reader-text {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ========================================
   Loading States
   ======================================== */
.pbw-loading {
    position: relative;
    min-height: 200px;
}

.pbw-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #facf39;
    border-radius: 50%;
    animation: pbw-spin 1s linear infinite;
}

@keyframes pbw-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}