/* =========================================
   LED SUN COMMENT SYSTEM STYLES (v12.0)
   Enhanced Reply Hierarchy - CellphoneS Style
   Base: 1rem = 10px
   ========================================= */

/* WRAPPER CHÍNH */
#ledsun-discuss-system {
    background: #fff;
    border-radius: 1.2rem;
    box-shadow: 0 0.4rem 2rem rgba(0,0,0,0.08);
    padding: 3rem;
    margin-top: 3rem;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    position: relative;
    z-index: 10;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

#ledsun-discuss-system * {
    box-sizing: border-box;
}

/* HEADER */
.ledsun-head {
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #000;
    border-bottom: 0.3rem solid #C13437;
    padding-bottom: 1.2rem;
    margin-bottom: 2.5rem;
    letter-spacing: 0.05rem;
}

/* FIX LỖI LIST CỦA ELEMENTOR */
#ledsun-discuss-system ul.ledsun-list,
#ledsun-discuss-system ul.children {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* COMMENT CHÍNH (Level 0) - Câu hỏi */
li.ls-comment {
    padding: 2rem 0;
    list-style-type: none !important;
    position: relative;
    width: 100%;
    border-bottom: 0.1rem solid #f0f0f0;
}

li.ls-comment:before { 
    display: none !important; 
}

/* REPLY (Children Comments) - Câu trả lời */
ul.children {
    margin-top: 1.5rem !important;
    margin-bottom: 0 !important;
    padding-left: 0 !important;
    list-style: none !important;
    width: 100%;
}

/* Câu trả lời - Padding vào trong + Background khác biệt */
ul.children li.ls-comment {
    background: #f8f9fa;
    padding: 1.8rem 2rem;
    margin-left: 5rem;
    margin-right: 0;
    margin-top: 1.5rem;
    border-radius: 0.8rem;
    border-left: 0.3rem solid #C13437;
    border-bottom: none;
    max-width: calc(100% - 5rem);
}

/* Nested reply (level 2+) */
ul.children ul.children li.ls-comment {
    margin-left: 3rem;
    max-width: calc(100% - 3rem);
    background: #f0f1f3;
    border-left-color: #999;
}

/* BODY COMMENT */
.ls-body {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

/* AVATAR - Đơn giản, sạch sẽ */
.ls-avatar {
    flex-shrink: 0;
}

.ls-avatar img {
    width: 4.5rem !important;
    height: 4.5rem !important;
    border-radius: 50% !important;
    object-fit: cover;
    border: 0.2rem solid #fff !important;
    box-shadow: 0 0.2rem 0.6rem rgba(0,0,0,0.1) !important;
    min-width: 4.5rem;
}

/* Avatar nhỏ hơn cho reply */
ul.children .ls-avatar img {
    width: 4rem !important;
    height: 4rem !important;
    min-width: 4rem;
}

/* CONTENT */
.ls-content {
    flex: 1;
    min-width: 0;
}

/* META DATA */
.ls-meta {
    margin-bottom: 1rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    line-height: 1.4;
}

.ls-author-name {
    font-weight: 700;
    color: #333;
    font-size: 1.5rem;
}

ul.children .ls-author-name {
    font-size: 1.4rem;
    color: #C13437;
}

.ls-date {
    font-weight: 400;
    font-size: 1.2rem;
    color: #999;
}

/* TEXT CONTENT */
.ls-text {
    font-size: 1.5rem;
    line-height: 1.7;
    color: #444;
    word-wrap: break-word;
}

.ls-text p {
    margin-bottom: 1rem;
}

.ls-text p:last-child {
    margin-bottom: 0;
}

/* BADGE QTV */
.ls-badge-qtv {
    background: #C13437;
    color: #fff;
    font-size: 1rem;
    padding: 0.3rem 0.7rem;
    border-radius: 0.4rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    text-transform: uppercase;
    line-height: 1;
    vertical-align: middle;
    font-weight: 600;
}

.ls-badge-qtv svg {
    width: 1.1rem !important;
    height: 1.1rem !important;
    fill: #fff !important;
    display: block;
    min-width: 1.1rem;
}

/* REPLY BUTTON */
.ls-reply-btn {
    font-size: 1.3rem;
    color: #C13437;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    background: #fff;
    border: 0.1rem solid #ddd;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.ls-reply-btn:hover {
    background: #C13437;
    color: #fff;
    border-color: #C13437;
    text-decoration: none;
}

.ls-reply-btn:active {
    transform: scale(0.98);
}

/* FORM STYLING */
.ls-form-box {
    background: #f9f9f9;
    padding: 2rem;
    border-radius: 0.8rem;
    position: relative;
    margin-top: 2rem;
    border: 0.1rem solid #e8e8e8;
}

.ls-replying-notice {
    background: #fff3cd;
    color: #856404;
    padding: 1rem 1.2rem;
    border-radius: 0.6rem;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    display: none;
    align-items: center;
    justify-content: space-between;
    border: 0.1rem solid #ffeeba;
}

/* GRID INPUT */
.ls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* INPUT STYLES */
.ls-input {
    width: 100% !important;
    padding: 1.2rem 1.5rem !important;
    border: 0.1rem solid #ddd !important;
    border-radius: 0.6rem !important;
    font-size: 1.4rem !important;
    outline: none;
    transition: all 0.2s ease;
    background: #fff !important;
    box-shadow: none !important;
    color: #333 !important;
    height: auto !important;
    font-family: inherit;
}

.ls-input:focus {
    border-color: #C13437 !important;
    box-shadow: 0 0 0 0.3rem rgba(193, 52, 55, 0.1) !important;
}

textarea.ls-input {
    min-height: 12rem;
    resize: vertical;
}

/* BUTTON */
.ls-btn {
    background: #C13437 !important;
    color: #fff !important;
    border: none !important;
    padding: 1.2rem 3rem !important;
    border-radius: 0.6rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 1.4rem;
}

.ls-btn:hover { 
    background: #a02528 !important;
}

.ls-btn:active {
    transform: scale(0.98);
}

.ls-btn:disabled { 
    opacity: 0.6; 
    cursor: not-allowed;
}

/* SPINNER */
.ls-spinner {
    width: 1.6rem;
    height: 1.6rem;
    border: 0.2rem solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin { 
    to { transform: rotate(360deg); } 
}

/* ALERT */
.ls-alert {
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0.6rem;
    font-size: 1.4rem;
    display: none;
}

.ls-success { 
    background: #d4edda;
    color: #155724;
    border: 0.1rem solid #c3e6cb;
}

.ls-error { 
    background: #f8d7da;
    color: #721c24;
    border: 0.1rem solid #f5c6cb;
}

/* USER INFO */
.ls-user-identified {
    margin-bottom: 1.5rem;
    padding: 1.2rem 1.5rem;
    background: #e8f0fe;
    border-left: 0.3rem solid #C13437;
    font-size: 1.4rem;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0.6rem;
}

.ls-user-identified strong { 
    color: #C13437;
    font-size: 1.5rem;
}

.ls-not-me { 
    font-size: 1.2rem;
    color: #666;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.ls-not-me:hover {
    color: #C13437;
}

/* PENDING STATUS */
.ls-pending { 
    opacity: 0.8;
    background: #fffcf5;
}

.ls-status-label {
    background: #ffeeba;
    color: #856404;
    padding: 0.3rem 0.7rem;
    border-radius: 0.4rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* =========================================================
   RESPONSIVE TABLET (Max-Width 768px)
   ========================================================= */
@media (max-width: 768px) {
    #ledsun-discuss-system {
        padding: 2rem;
    }

    .ledsun-head {
        font-size: 1.8rem;
    }

    /* Reply thụt ít hơn trên tablet */
    ul.children li.ls-comment {
        margin-left: 3.5rem;
        max-width: calc(100% - 3.5rem);
    }

    ul.children ul.children li.ls-comment {
        margin-left: 2.5rem;
        max-width: calc(100% - 2.5rem);
    }

    .ls-avatar img {
        width: 4rem !important;
        height: 4rem !important;
        min-width: 4rem;
    }

    ul.children .ls-avatar img {
        width: 3.8rem !important;
        height: 3.8rem !important;
        min-width: 3.8rem;
    }
}

/* =========================================================
   RESPONSIVE MOBILE (Max-Width 600px)
   ========================================================= */
@media (max-width: 600px) {
    #ledsun-discuss-system {
        padding: 1.5rem;
        margin-top: 2rem;
        border-radius: 0.8rem;
    }

    .ledsun-head {
        font-size: 1.6rem;
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }

    /* Comment item */
    li.ls-comment {
        padding: 1.8rem 0;
    }

    /* Reply thụt ít để không bị chật */
    ul.children li.ls-comment {
        margin-left: 2rem;
        max-width: calc(100% - 2rem);
        padding: 1.5rem 1.5rem;
    }

    /* Nested reply (level 2) */
    ul.children ul.children li.ls-comment {
        margin-left: 1.5rem;
        max-width: calc(100% - 1.5rem);
    }

    /* Avatar nhỏ lại */
    .ls-avatar img {
        width: 4rem !important;
        height: 4rem !important;
        min-width: 4rem;
    }

    ul.children .ls-avatar img {
        width: 3.5rem !important;
        height: 3.5rem !important;
        min-width: 3.5rem;
    }

    /* Body */
    .ls-body {
        gap: 1.2rem;
    }

    /* Meta */
    .ls-meta {
        font-size: 1.3rem;
        gap: 0.6rem;
    }

    .ls-author-name {
        font-size: 1.4rem;
    }

    ul.children .ls-author-name {
        font-size: 1.3rem;
    }

    .ls-date {
        font-size: 1.1rem;
    }

    /* Text */
    .ls-text {
        font-size: 1.4rem;
        line-height: 1.6;
    }

    /* Badge */
    .ls-badge-qtv {
        font-size: 0.9rem;
        padding: 0.2rem 0.6rem;
    }

    /* Reply button */
    .ls-reply-btn {
        font-size: 1.2rem;
        padding: 0.5rem 1rem;
        margin-top: 1rem;
    }

    /* Form */
    .ls-form-box {
        padding: 1.5rem;
        border-radius: 0.8rem;
    }

    .ls-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .ls-input {
        padding: 1.2rem !important;
        font-size: 1.4rem !important;
    }

    textarea.ls-input {
        min-height: 10rem;
    }

    /* Button full width */
    .ls-btn {
        width: 100%;
        padding: 1.2rem 2rem !important;
        font-size: 1.3rem;
    }

    .ls-user-identified {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .ls-status-label {
        font-size: 1rem;
    }
}

/* =========================================================
   RESPONSIVE EXTRA SMALL (Max-Width 400px)
   ========================================================= */
@media (max-width: 400px) {
    #ledsun-discuss-system {
        padding: 1.2rem;
    }

    ul.children li.ls-comment {
        margin-left: 1.5rem;
        max-width: calc(100% - 1.5rem);
        padding: 1.2rem 1rem;
    }

    ul.children ul.children li.ls-comment {
        margin-left: 1rem;
        max-width: calc(100% - 1rem);
    }

    .ls-avatar img {
        width: 3.5rem !important;
        height: 3.5rem !important;
        min-width: 3.5rem;
    }

    ul.children .ls-avatar img {
        width: 3rem !important;
        height: 3rem !important;
        min-width: 3rem;
    }

    .ls-text {
        font-size: 1.3rem;
    }
}

/* Ẩn các phần tử rác */
body > text { display: none; }