/* Import font Roboto nếu chưa có trong theme */
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,400;1,500&display=swap');
:root {
    --sbm-primary-color: #ef4444;
    --sbm-light-gray: #f3f4f6;
    --sbm-text-color: #374151;
    --sbm-border-color: #e5e7eb;
}
/* Ép toàn bộ container SBM dùng Roboto */
.sbmalpha-container, 
.sbmalpha-container * {
    font-family: 'Roboto', sans-serif;
}

.sbmalpha-container-loading {
    opacity: 0;
}

.sbmalpha-container-loaded {
    opacity: 1;
    transition: opacity 0.4s ease-in;
}

.sbmalpha-container {
    font-family: 'Roboto', sans-serif;
    background-color: #f9fafb;
    color: #1f2937;
    transition: background-image 0.5s ease-in-out;
}

.sbmalpha-container.sbmalpha-bg-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.sbmalpha-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    padding: 5rem 1.5rem;
    box-sizing: border-box;
    position: relative;
}

.sbm-loading-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #4285F4;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: sbm-spin 1s linear infinite;
    margin: 3rem auto;
}

@keyframes sbm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === [SỬA LỖI DỨT ĐIỂM] Hiệu ứng trái tim bay lên === */

/* 1. Điểm neo cho hiệu ứng */
.sbmalpha-like-wrapper {
    position: relative;
}

/* 2. Style và gọi animation cho trái tim */
.sbmalpha-floating-heart {
    position: absolute;
    left: 50%;
    bottom: 100%;
    font-size: 1.5rem;
    opacity: 1;
    animation: sbm-float-up 1s ease-out forwards;
    pointer-events: none;
}

/* 3. Animation cho icon trái tim trên nút bấm */
#sbmalphaLikeBtn.liked-animation svg {
    animation: sbm-heart-beat 0.3s ease-in-out;
}

/* 4. Định nghĩa mã nguồn của animation (quan trọng) */
@keyframes sbm-heart-beat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes sbm-float-up {
    0% { transform: translate(-50%, 0) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -80px) scale(0.5); opacity: 0; }
}

html.sbm-popup-open,
body.sbm-popup-open {
    overflow: hidden !important;
}

/* === [MỚI] CSS CHO HỆ THỐNG BÌNH LUẬN TIN TỨC === */
.sbm-news-card .sbm-news-footer {
    /* Thêm khoảng cách cho icon bình luận mới */
    justify-content: space-between;
}
.sbm-news-comment-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

#sbm-comments-wrapper {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}
#sbm-comments-wrapper h4 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #111827;
}

/* Form bình luận */
#sbm-comment-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}
#sbm-comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
}
#sbm-comment-form textarea:focus {
    border-color: var(--sbm-primary-color);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
    outline: none;
}
#sbm-comment-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#sbm-comment-submit-btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    background-color: var(--sbm-primary-color);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}
#sbm-comment-submit-btn:hover {
    opacity: 0.9;
}
#sbm-comment-submit-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}
#sbm-comment-login-prompt a {
    color: var(--sbm-primary-color);
    font-weight: 600;
    text-decoration: none;
}
#sbm-comment-reply-to-box {
    font-size: 0.9rem;
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.5rem 1rem;
    border-radius: 6px;
}
#sbm-comment-reply-to-box button {
    background: none; border: none; color: var(--sbm-primary-color); cursor: pointer; margin-left: 8px; font-weight: 600;
}

/* Danh sách bình luận */
#sbm-comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.sbm-comment-item {
    display: flex;
    gap: 1rem;
}
.sbm-comment-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.sbm-comment-main {
    flex: 1;
}
.sbm-comment-bubble {
    background: #f3f4f6;
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    position: relative;
}
.sbm-comment-bubble.is-pending {
    background: #fefce8; /* Nền vàng cho bình luận chờ duyệt */
    border: 1px solid #fde68a;
}
.sbm-comment-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}
.sbm-comment-header .author {
    font-weight: 700;
    color: #111827;
}
.sbm-comment-header .date {
    font-size: 0.85rem;
    color: #6b7280;
}
.sbm-comment-content {
    font-size: 1rem;
    line-height: 1.6;
    color: #374151;
}
.sbm-comment-content p:last-child {
    margin-bottom: 0;
}

/* Vùng edit textarea */
.sbm-comment-content textarea {
    width: 100%; min-height: 80px;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
}
.sbm-comment-edit-actions {
    margin-top: 0.5rem; display: flex; gap: 0.5rem; justify-content: flex-end;
}
.sbm-comment-edit-actions button {
    padding: 0.25rem 0.75rem; font-size: 0.8rem; border-radius: 6px; cursor: pointer;
}
.sbm-comment-edit-actions .save { background: var(--sbm-primary-color); color: #fff; border: none; }
.sbm-comment-edit-actions .cancel { background: #e5e7eb; color: #374151; border: none; }


.sbm-comment-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-top: 0.5rem;
    padding-left: 1.25rem;
}
.sbm-comment-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: #6b7280;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sbm-comment-actions button:hover {
    color: var(--sbm-primary-color);
}
.sbm-comment-actions .sbm-react-btn.is-active {
    color: var(--sbm-primary-color);
}
/* Reaction Picker (Giống Chat) */
.sbm-reactions-picker {
    display: none; /* Hiện bằng JS */
    position: absolute;
    bottom: 100%;
    left: 0;
    background: #fff;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 4px 8px;
    z-index: 10;
}
.sbm-react-btn:hover .sbm-reactions-picker {
    display: flex;
}
.sbm-reaction-btn {
    font-size: 1.5rem; padding: 4px; transition: transform 0.1s ease;
}
.sbm-reaction-btn:hover {
    transform: scale(1.3);
}

/* Hiển thị Reaction */
.sbm-comment-reactions-list {
    display: flex;
    gap: 4px;
    position: absolute;
    bottom: -12px;
    right: 12px;
}
.sbm-reaction-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 50px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.sbm-reaction-item.is-active {
    background: #fff1f2; /* Nền đỏ nhạt */
    border-color: #ef4444;
    color: #ef4444;
}

/* Lồng nhau */
.sbm-comment-replies {
    margin-top: 1.5rem;
    padding-left: 3.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Nút Quản trị */
.sbm-comment-moderation-tools {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-left: 1.25rem;
}
.sbm-comment-moderation-tools button {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}
.sbm-comment-moderation-tools .approve { background: #22c55e; color: #fff; }
.sbm-comment-moderation-tools .trash { background: #ef4444; color: #fff; }
/* === KẾT THÚC CSS BÌNH LUẬN === */

/* * Ghi đè lại style 'justify-content: flex-start' 
 * của trang Dashboard đang ảnh hưởng lây sang.
 */
.sbm-cart-page #sbm-address-form .sbm-terms-label {
    justify-content: center !important; /* Canh giữa checkbox */
    margin-top: 1rem; /* Thêm một chút khoảng cách */
}

/* =================================================================
   SBM PAGE TRANSITION (Glass Rise Effect v2.0)
   ================================================================= */

.sbm-page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    
    /* Trạng thái ban đầu: Trong suốt và nằm thấp hơn một chút */
    background: rgba(255, 255, 255, 0); 
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px); /* Chuyển động trượt lên */
    
    /* Hiệu ứng chuyển cảnh mượt (Ease Out Cubic) */
    transition: 
        opacity 0.4s ease,
        transform 0.4s cubic-bezier(0.215, 0.610, 0.355, 1.000),
        background 0.4s ease,
        backdrop-filter 0.4s ease;
        
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.sbm-page-transition-overlay.is-active {
    visibility: visible;
    pointer-events: all;
    
    /* Trạng thái kích hoạt: Mờ 50% (Rất trong) và về vị trí chuẩn */
    opacity: 1;
    transform: translateY(0);
    
    /* Kính mờ nhẹ nhàng */
    background: rgba(255, 255, 255, 0.5); 
    backdrop-filter: blur(10px); /* Độ nhòe vừa phải */
    -webkit-backdrop-filter: blur(10px);
}

/* Spinner: Nảy ra (Pop in) */
.sbm-page-loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(239, 68, 68, 0.1); /* Màu đỏ nhạt */
    border-top-color: var(--sbm-primary-color); /* Màu đỏ chính */
    border-radius: 50%;
    animation: sbm-spin 0.8s linear infinite;
    
    /* Hiệu ứng xuất hiện */
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.1s; /* Nảy đàn hồi */
}

.sbm-page-transition-overlay.is-active .sbm-page-loader-spinner {
    opacity: 1;
    transform: scale(1);
}

/* =================================================================
   SBM CORE MODULE: DRAG & SCROLL SLIDER (Dùng chung toàn site)
   ================================================================= */

/* 1. Container chính (Khung bao ngoài) */
.sbm-drag-scroll-container {
    display: flex !important;
    flex-wrap: nowrap !important; /* Không bao giờ xuống dòng */
    overflow-x: auto !important;  /* Cuộn ngang */
    overflow-y: hidden !important;
    gap: 12px !important;         /* Khoảng cách chuẩn giữa các item */
    padding: 5px 5px 15px 5px !important; /* Padding đáy để không cắt bóng đổ */
    
    /* Căn trái để item đầu tiên không bị mất */
    justify-content: flex-start !important;
    
    /* Trải nghiệm người dùng */
    cursor: grab;
    user-select: none; /* Không bôi đen text khi kéo */
    -webkit-overflow-scrolling: touch; /* Lướt mượt trên iOS */
    
    /* Tắt thanh cuộn */
    scrollbar-width: none; 
    -ms-overflow-style: none;
    
    /* Tắt bắt dính (snap) để kéo mượt tự nhiên */
    scroll-snap-type: none !important;
    scroll-behavior: auto !important;
}

.sbm-drag-scroll-container::-webkit-scrollbar { display: none; }

/* Trạng thái đang kéo */
.sbm-drag-scroll-container.is-dragging { cursor: grabbing; }
.sbm-drag-scroll-container.is-dragging > * { pointer-events: none; /* Chặn click nhầm */ }

/* 2. Các Item con (Nút, Card, Avatar...) */
.sbm-scroll-item {
    /* Mặc định trên Desktop: Tự động co giãn theo nội dung */
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
}

/* --- MOBILE RESPONSIVE (Dưới 768px) --- */
@media (max-width: 768px) {
    .sbm-scroll-item {
        /* [CÔNG THỨC 3.5 ITEM] 100% / 3.5 = ~28% */
        /* Giúp user thấy mép của item thứ 4 để biết là có thể trượt */
        flex: 0 0 28% !important;
        width: 28% !important;
        max-width: 28% !important;
        
        /* Căn chỉnh nội dung bên trong item */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }

    /* Xử lý tràn text (Text Overflow) cho item con */
    .sbm-scroll-item span, 
    .sbm-scroll-item a,
    .sbm-scroll-item div {
        /* Tùy chọn 1: Cho phép xuống dòng (Dùng cho nút lọc tên dài) */
        white-space: normal !important; 
        line-height: 1.2 !important;
        font-size: 0.85rem !important;
        
        /* Tùy chọn 2: Nếu muốn cắt bớt (...) thì dùng đoạn dưới này: */
        /*
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100%;
        */
    }
}