/* Custom Review Styles - Force Single Column Layout */

/* FORCE 1 COLUMN - Override WooCommerce + Foundation Grid */
#reviews {  
    padding: 10px;
    margin-top: 30px;
    max-width: 100%;
    display: block !important;
}

/* Override Foundation row */
#reviews .woocommerce-Reviews.row {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

/* Override Foundation columns - Force full width */
#reviews .woocommerce-Reviews [class*="large-"],
#reviews .woocommerce-Reviews [class*="medium-"],
#reviews .woocommerce-Reviews [class*="small-"],
#reviews .woocommerce-Reviews [class*="columns"],
#reviews .woocommerce-Reviews [class*="column"] {
    width: 100% !important;
    float: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
}

/* Remove any grid or flex layout on reviews */
#reviews .woocommerce-Reviews {
    display: block !important;
    width: 100% !important;
}

/* Force review list (comment col) to full width */
#reviews #comments,
#reviews .comment-col,
#reviews [class*="comment"] {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    margin-right: 0 !important;
    padding-right: 0 !important;
}

/* Force review form to full width and below reviews */
#reviews #review_form_wrapper,
#reviews .review-form-col,
#reviews [class*="review-form"] {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    clear: both !important;
}

/* Clear any floats */
#reviews::after,
#reviews .woocommerce-Reviews::after {
    content: "";
    display: table;
    clear: both;
}

#reviews .woocommerce-Reviews-title {
    font-size: 24px;
    margin-bottom: 20px;
    color: #0db04b;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    text-align: center;
}

/* Ẩn thông báo mặc định của WooCommerce */
.woocommerce-noreviews {
    display: none !important;
}

/* Thông báo chưa có đánh giá */
.sghn-no-reviews {
    text-align: center;
    padding: 30px 20px;
    background: #fff;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    color: #666;
    margin-bottom: 20px;
}

.sghn-no-reviews p {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #333;
}

/* Review List - Full Width */
.woocommerce-Reviews .commentlist {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    width: 100%;
}

.woocommerce-Reviews .comment {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    width: 100%;
    display: block;
}

.woocommerce-Reviews .comment .comment-text {
    padding: 0;
    border: none;
    margin: 0;
}

.woocommerce-Reviews .star-rating {
    margin-bottom: 10px;
}

.woocommerce-Reviews .meta {
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.woocommerce-Reviews .description p {
    margin: 10px 0 0 0;
    line-height: 1.6;
    color: #555;
}

/* Wrapper cho nút viết đánh giá - CĂN GIỮA */
.sghn-write-review-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;   
    width: 100%;
    clear: both;
}

/* Nút viết đánh giá */
.sghn-write-review-btn {
    background: linear-gradient(135deg, #0db04b 0%, #61CE70 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(13, 176, 75, 0.3);
    white-space: nowrap;
}

.sghn-write-review-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(13, 176, 75, 0.4);
}

.sghn-write-review-btn.active {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    box-shadow: 0 4px 10px rgba(220, 53, 69, 0.3);
}

.sghn-write-review-btn.active:hover {
    box-shadow: 0 6px 15px rgba(220, 53, 69, 0.4);
}

/* Review Form */
#review_form_wrapper {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0 !important; /* Bỏ padding ở wrapper */
    margin: 30px auto 0 auto !important; /* Căn giữa */
    animation: slideDown 0.3s ease;
    width: 100% !important;
    max-width: calc(41.66667% - 30px) !important; /* large-5 = 41.66667%, trừ margin */
    box-sizing: border-box;
    float: none !important;
    clear: both !important;
    display: block;
    position: relative;
    left: 0 !important;
    right: 0 !important;
}

/* các class con  */
#review_form_wrapper *,
#review_form_wrapper .review-form,
#review_form_wrapper .review-form-inner,
#review_form_wrapper .respond,
#review_form_wrapper .has-border,
#review_form_wrapper .col-inner {
    margin-left: 0 !important;
    margin-right: 0 !important;
    float: none !important;
}

/* Thêm padding vào col-inner để tạo khoảng cách */
#review_form_wrapper .col-inner {
    padding: 30px !important;
    width: 100%;
    box-sizing: border-box;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#review_form_wrapper #reply-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

#review_form_wrapper .comment-form {
    display: block;
    width: 100%;
}

#review_form_wrapper .comment-form-rating {
    margin-bottom: 20px;
}

#review_form_wrapper .comment-form-rating label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

#review_form_wrapper .comment-form-comment {
    margin-bottom: 20px;
}

#review_form_wrapper .comment-form-comment label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

#review_form_wrapper textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    font-size: 14px;
    min-height: 120px;
    box-sizing: border-box;
}

#review_form_wrapper textarea:focus {
    border-color: #0db04b;
    outline: none;
    box-shadow: 0 0 0 2px rgba(13, 176, 75, 0.1);
}

#review_form_wrapper .comment-form-author,
#review_form_wrapper .comment-form-email {
    margin-bottom: 15px;
    padding-left: 0;
}

#review_form_wrapper .comment-form-author label,
#review_form_wrapper .comment-form-email label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    padding-left: 0;
}

#review_form_wrapper input[type="text"],
#review_form_wrapper input[type="email"] {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 14px;
    box-sizing: border-box;
}

#review_form_wrapper input[type="text"]:focus,
#review_form_wrapper input[type="email"]:focus {
    border-color: #0db04b;
    outline: none;
    box-shadow: 0 0 0 2px rgba(13, 176, 75, 0.1);
}

/* Form submit button */
#review_form_wrapper .form-submit {
    text-align: center;
    margin-top: 20px;
}

#review_form_wrapper input[type="submit"] {
    position: relative;
    background: linear-gradient(135deg, #0db04b 0%, #61CE70 100%);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    z-index: 1;
}

#review_form_wrapper input[type="submit"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a8f3d 0%, #4db35f 100%);
    transition: left 0.5s ease;
    z-index: -1;
}

#review_form_wrapper input[type="submit"]:hover::before {
    left: 0;
}

#review_form_wrapper input[type="submit"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(13, 176, 75, 0.5);
}

#review_form_wrapper input[type="submit"]:active {
    transform: translateY(-1px);
}

/* Thông báo bảo mật */
.sghn-privacy-notice {
    font-size: 12px;
    color: #666;
    margin: 15px 20px 0 20px; /* Thêm margin trái phải */
    font-style: italic;
    text-align: center;
    background: #fff3cd;
    padding: 10px 15px; /* Tăng padding bên trong */
    border-radius: 4px;
    border-left: 3px solid #ffc107;
}


/* Pagination */
.woocommerce-pagination {
    text-align: center;
    margin: 30px 0 0;
}

.woocommerce-pagination ul.page-numbers {
    display: inline-flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.woocommerce-pagination li {
    margin: 0;
}

.woocommerce-pagination li a,
.woocommerce-pagination li span {
    display: block;
    padding: 10px 16px;
    font-size: 15px;
    color: #333;
    text-decoration: none;
    border-right: 1px solid #e0e0e0;
}

.woocommerce-pagination li:last-child a,
.woocommerce-pagination li:last-child span {
    border-right: none;
}

.woocommerce-pagination li span.current {
    background: linear-gradient(135deg, #0db04b 0%, #61CE70 100%);
    color: #fff;
    font-weight: 600;
}

/* khi không có review */
.woocommerce-Reviews .commentlist:empty {
    min-height: 0;
    padding: 0;
    margin: 0;
}

/* Đảm bảo commentlist hiển thị khi có nội dung (thông báo hoặc review) */
.woocommerce-Reviews .commentlist:not(:empty) {
    display: block;
    margin-bottom: 20px;
}

/* ============================================================
   Bố cục
   ============================================================ */

/* Khối mỗi review  */
#reviews .commentlist li {
  display: block !important;
  width: 100% !important;
  margin: 0 auto 20px;
  padding: 0;
  box-sizing: border-box;
}

/* Container avatar + text */
#reviews .comment_container {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* Avatar người dùng */
#reviews .comment_container img.avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

/* Text bên phải avatar */
#reviews .comment-text {
  flex: 1;
  margin: 0;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Căn lề & giới hạn độ rộng phần mô tả */
#reviews .description p {
  margin: 8px 0 0;
  padding: 0;
  text-align: justify;
  max-width: 100%;
  box-sizing: border-box;
  line-height: 1.6;
  word-break: break-word;
}

/* Nếu ẩn avatar, chuyển sang hiển thị block để không chừa khoảng trống */
#reviews .comment_container.no-avatar {
  display: block !important;
}


/* Responsive */
@media (max-width: 768px) {
    #reviews {
        padding: 20px 15px;
    }
    
    #reviews .woocommerce-Reviews-title {
        font-size: 20px;
    }
    
    .woocommerce-Reviews .comment {
        padding: 15px;
    }
    
    .sghn-write-review-btn {
        padding: 12px 24px;
        font-size: 15px;
    }
    
    /* Form full width trên mobile */
    #review_form_wrapper {
        max-width: 100% !important;
        margin: 20px 0 0 0;
    }
    
    #review_form_wrapper .col-inner {
        padding: 20px 15px;
    }
    
    #review_form_wrapper #reply-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    #reviews {
        padding: 15px 10px;
    }
    
    #review_form_wrapper {
        max-width: 100% !important;
    }
    
    #review_form_wrapper .col-inner {
        padding: 15px 10px;
    }
    
    .sghn-no-reviews {
        padding: 30px 15px;
    }
    
    .sghn-no-reviews p {
        font-size: 16px;
    }
    
    .sghn-write-review-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Medium screens - form chiếm 60% width */
@media (min-width: 769px) and (max-width: 1024px) {
    #review_form_wrapper {
        max-width: calc(60% - 30px) !important;
    }
}

/* CRITICAL: Override any theme CSS that might force 2 columns */
@media (min-width: 768px) {
    /* Override Foundation grid columns */
    #reviews .woocommerce-Reviews [class*="large-"],
    #reviews .woocommerce-Reviews [class*="medium-"],
    #reviews #comments,
    #reviews #review_form_wrapper {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 0 !important;
    }
    
    /* Ensure row doesn't restrict width */
    #reviews .woocommerce-Reviews.row {
        width: 100% !important;
        max-width: 100% !important;
    }
}


/* Mô tả sản phẩm */

.custom-short-description, 
.custom-long-description {
    border: 2px solid #ddd;
    padding: 15px;
    border-radius: 8px;
    background-color: #fff;
    margin-bottom: 20px;
}

.same-brand-products,
.products-suggest,
.related.products,
.upsells,
.widget_recently_viewed_products {
    padding: 20px;   /* đều nhau */
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
}


/* 1. Các section shortcode sản phẩm gợi ý / cùng thương hiệu / cùng phân khúc */
  /* Heading */
        .same-brand-products-section .section-title {
            display: block !important;
            margin-bottom: 20px;
            font-size: 24px;
            font-weight: 600;
            color: #222;
        }

        /* Responsive products wrapper */
        .same-brand-products-section .products-wrapper .products {
            display: flex;
            flex-wrap: wrap;
            gap: 16px;
        }

        .same-brand-products-section .products-wrapper .product-small {
            flex: 1 1 calc(25% - 16px); /* 4 columns default */
            max-width: calc(25% - 16px);
        }

        @media (max-width: 1200px) {
            .same-brand-products-section .products-wrapper .product-small {
                flex: 1 1 calc(33.333% - 16px); /* 3 columns */
                max-width: calc(33.333% - 16px);
            }
        }

        @media (max-width: 768px) {
            .same-brand-products-section .products-wrapper .product-small {
                flex: 1 1 calc(50% - 16px); /* 2 columns */
                max-width: calc(50% - 16px);
            }
        }

        @media (max-width: 480px) {
            .same-brand-products-section .products-wrapper .product-small {
                flex: 1 1 100%; /* 1 column */
                max-width: 100%;
            }
        }