/* =========================================
   WRAPPER & CONTAINER
   ========================================= */
.mpd-wrapper {
    position: relative;
    margin: 30px 0;
    max-width: 100%;
    opacity: 1;
    transition: opacity 0.3s;
    
    /* Giá trị mặc định phòng hờ (Fallback) */
    --mpd-card-bg: #ffffff;
    --mpd-badge-bg: #d90429;
    --mpd-btn-color: #d90429;
}

.mpd-container {
    overflow: hidden; /* Cần thiết cho Swiper */
    padding: 10px 5px 40px 5px; /* Padding dưới để chừa chỗ cho bóng đổ và pagination */
}

/* =========================================
   POST CARD DESIGN
   ========================================= */
.mpd-post-card {
    box-sizing: border-box;
    height: auto;
    /* Hiệu ứng xuất hiện mượt mà */
    animation: mpd-fade-in 0.6s ease-out backwards;
}

.mpd-card-inner {
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
    
    /* [QUAN TRỌNG] Sử dụng biến màu nền thẻ */
    background: var(--mpd-card-bg); 
    
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Hiệu ứng Hover vào Card */
.mpd-card-inner:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.08);
    border-color: transparent;
}

/* --- Thumbnail Area --- */
.mpd-thumb-link {
    display: block;
    overflow: hidden;
    position: relative;
}

.mpd-thumb-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* Tỉ lệ 16:9 */
    background: #f0f0f0;
}

.mpd-thumb-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.mpd-card-inner:hover .mpd-thumb-wrapper img {
    transform: scale(1.08);
}

.mpd-no-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Badge (Danh mục) --- */
.mpd-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    
    /* [QUAN TRỌNG] Sử dụng biến màu Badge */
    background-color: var(--mpd-badge-bg);
    
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    letter-spacing: 0.5px;
}

/* --- Content Area --- */
.mpd-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.mpd-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 10px;
    color: #222;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mpd-title a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.mpd-title a:hover {
    /* [QUAN TRỌNG] Hover tiêu đề theo màu nút chủ đạo */
    color: var(--mpd-btn-color);
}

.mpd-excerpt {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Meta Footer --- */
.mpd-meta-footer {
    margin-top: auto;
    margin-bottom: 12px;
}

.mpd-hashtags {
    font-size: 12px;
    /* [QUAN TRỌNG] Hashtag dùng màu chủ đạo */
    color: var(--mpd-btn-color);
    font-weight: 600;
}

.mpd-info-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #888;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
}

/* =========================================
   LAYOUT SPECIFICS
   ========================================= */

/* Grid Mode */
.mpd-layout-grid .mpd-inner-wrapper {
    display: grid;
    gap: 25px;
    /* Số cột sẽ được JS xử lý inline style */
}

/* Carousel Mode (Swiper Overrides) */
.mpd-layout-carousel .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #ccc;
    opacity: 1;
    transition: all 0.3s;
}
.mpd-layout-carousel .swiper-pagination-bullet-active {
    /* [QUAN TRỌNG] Màu active của chấm tròn carousel */
    background: var(--mpd-btn-color) !important;
    width: 24px;
    border-radius: 4px;
}
.mpd-pagination-carousel {
    position: absolute;
    bottom: 0 !important;
    width: 100%;
    text-align: center;
}

/* =========================================
   LOAD MORE BUTTON & SPINNER
   ========================================= */
.mpd-load-more-container {
    text-align: center;
    margin-top: 30px;
    clear: both;
}

.mpd-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    
    /* [QUAN TRỌNG] Màu viền và chữ theo màu chủ đạo */
    border: 2px solid var(--mpd-btn-color);
    color: var(--mpd-btn-color);
    
    padding: 10px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 140px;
    outline: none;
}

.mpd-load-more-btn:hover {
    /* [QUAN TRỌNG] Hover đổi nền thành màu chủ đạo */
    background: var(--mpd-btn-color);
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.mpd-load-more-btn.loading {
    background-color: #f9f9f9;
    color: #888;
    border-color: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

.mpd-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-left-color: currentColor; /* Lấy theo màu text hiện tại */
    border-radius: 50%;
    animation: mpd-spin 0.8s linear infinite;
}

.mpd-load-more-btn:not(.loading) .mpd-spinner {
    display: none;
}

/* Loading Overlay (Optional for full list reload) */
.mpd-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.7);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}
.mpd-loading-overlay .mpd-spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
    /* [QUAN TRỌNG] Spinner overlay cũng theo màu chủ đạo */
    border-left-color: var(--mpd-btn-color);
}

@keyframes mpd-spin {
    to { transform: rotate(360deg); }
}

@keyframes mpd-fade-in {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}