/*--------------------------------------------------------------
# AuthorPro Threaded Comments & Form Stylesheet
# Description: Comment list, nesting tree, author badges, form
# Package: AuthorPro
--------------------------------------------------------------*/

/* =============================================================
   1. Comments Area Wrapper & Header
   ============================================================= */
#comments,
.authorpro-comments-area {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid var(--authorpro-color-slate-200);
}

.authorpro-comments-title,
#comments > h3 {
    font-family: var(--authorpro-font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--authorpro-color-slate-900);
    margin-top: 0;
    margin-bottom: 2rem;
}

/* =============================================================
   2. Threaded Comment List & Hierarchy
   ============================================================= */
.authorpro-comment-list,
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

/* Individual Comment Wrapper */
.authorpro-comment-item,
.comment {
    display: flex;
    gap: 1rem;
    position: relative;
    list-style: none;
}

/* Nested Reply Indentation (Depth > 1) */
.authorpro-comment-item.depth-2,
.authorpro-comment-item.depth-3,
.authorpro-comment-item.depth-4,
.authorpro-comment-item.depth-5,
.comment .children {
    margin-top: 1.5rem;
    margin-left: 1rem;
    border-left: 2px solid var(--authorpro-color-slate-100);
    padding-left: 1rem;
}

@media (min-width: 768px) {
    .authorpro-comment-item.depth-2,
    .authorpro-comment-item.depth-3,
    .authorpro-comment-item.depth-4,
    .authorpro-comment-item.depth-5,
    .comment .children {
        margin-left: 2rem;
        padding-left: 1.5rem;
    }
}

/* Comment Avatar */
.authorpro-comment-avatar-wrap {
    flex-shrink: 0;
}

.authorpro-comment-avatar {
    width: 2.5rem; /* 40px */
    height: 2.5rem;
    border-radius: var(--authorpro-radius-full);
    border: 1px solid var(--authorpro-color-white);
    box-shadow: var(--authorpro-shadow-sm);
    object-fit: cover;
    background-color: var(--authorpro-color-slate-200);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.depth-2 .authorpro-comment-avatar,
.depth-3 .authorpro-comment-avatar,
.depth-4 .authorpro-comment-avatar,
.depth-5 .authorpro-comment-avatar {
    width: 2rem; /* 32px */
    height: 2rem;
}

.authorpro-comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Comment Body Card */
.authorpro-comment-body {
    flex: 1 1 0%;
    width: 100%;
    min-width: 0;
}

.authorpro-comment-bubble {
    padding: 1rem;
    border-radius: var(--authorpro-radius-xl);
    border-top-left-radius: 0;
    border: 1px solid var(--authorpro-color-slate-100);
    box-shadow: var(--authorpro-shadow-sm);
    background-color: var(--authorpro-color-slate-50);
    position: relative;
    transition: box-shadow var(--authorpro-transition-fast), border-color var(--authorpro-transition-fast);
}

@media (min-width: 768px) {
    .authorpro-comment-bubble {
        padding: 1.25rem;
    }
}

.authorpro-comment-bubble:hover {
    box-shadow: var(--authorpro-shadow-md);
}

/* Alternating Depth Tinting */
.depth-even .authorpro-comment-bubble {
    background-color: var(--authorpro-color-white);
}

/* Post Author Highlight */
.authorpro-comment-author-post .authorpro-comment-bubble,
.bypostauthor > .authorpro-comment-body > .authorpro-comment-bubble {
    border-color: var(--authorpro-color-brand-100);
}

/* Comment Header */
.authorpro-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.authorpro-comment-author-meta {
    display: flex;
    flex-direction: column;
}

.authorpro-comment-author-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--authorpro-color-slate-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.authorpro-comment-author-name a {
    color: inherit;
    text-decoration: none;
    transition: color var(--authorpro-transition-fast);
}

.authorpro-comment-author-name a:hover {
    color: var(--authorpro-color-brand-600);
}

.authorpro-comment-badge {
    background-color: var(--authorpro-color-brand-100);
    color: var(--authorpro-color-brand-700);
    font-size: 10px;
    padding: 0.125rem 0.375rem;
    border-radius: var(--authorpro-radius-sm);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1.2;
}

.authorpro-comment-date {
    font-size: 0.75rem;
    color: var(--authorpro-color-slate-400);
    margin-top: 0.125rem;
}

.authorpro-comment-date a {
    color: inherit;
    text-decoration: none;
}

.authorpro-comment-date a:hover {
    color: var(--authorpro-color-slate-600);
}

/* Reply Link */
.comment-reply-link,
.authorpro-comment-reply-link {
    font-size: 0.75rem;
    color: var(--authorpro-color-brand-600);
    font-weight: 600;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity var(--authorpro-transition-fast), color var(--authorpro-transition-fast);
}

@media (min-width: 768px) {
    .comment-reply-link,
    .authorpro-comment-reply-link {
        opacity: 0;
    }
    .authorpro-comment-bubble:hover .comment-reply-link,
    .authorpro-comment-bubble:hover .authorpro-comment-reply-link,
    .comment-reply-link:focus,
    .authorpro-comment-reply-link:focus {
        opacity: 1;
    }
}

.comment-reply-link:hover,
.authorpro-comment-reply-link:hover {
    color: var(--authorpro-color-brand-700);
    text-decoration: underline;
}

/* =============================================================
   Comment Content & Typography (Dynamic comment_text() markup)
   ============================================================= */
.authorpro-comment-content,
.authorpro-comment-text,
.comment-content,
.comment-body {
    font-family: var(--authorpro-font-body);
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--authorpro-color-slate-700, #334155);
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Paragraphs & Spacing */
.authorpro-comment-content :where(p),
.authorpro-comment-text :where(p),
.comment-content :where(p),
.comment-body :where(p) {
    margin-top: 0;
    margin-bottom: 1rem;
}

.authorpro-comment-content :where(p:last-child),
.authorpro-comment-text :where(p:last-child),
.comment-content :where(p:last-child),
.comment-body :where(p:last-child) {
    margin-bottom: 0;
}

/* Inline Links */
.authorpro-comment-content :where(a),
.authorpro-comment-text :where(a),
.comment-content :where(a),
.comment-body :where(a) {
    color: var(--authorpro-color-brand-600);
    text-decoration: underline;
    transition: color var(--authorpro-transition-fast);
}

.authorpro-comment-content :where(a):hover,
.authorpro-comment-content :where(a):focus,
.authorpro-comment-text :where(a):hover,
.authorpro-comment-text :where(a):focus,
.comment-content :where(a):hover,
.comment-content :where(a):focus,
.comment-body :where(a):hover,
.comment-body :where(a):focus {
    color: var(--authorpro-color-brand-700);
}

/* Blockquotes & Citations */
.authorpro-comment-content :where(blockquote),
.authorpro-comment-text :where(blockquote),
.comment-content :where(blockquote),
.comment-body :where(blockquote) {
    border-left: 3px solid var(--authorpro-color-brand-600);
    padding: 0.75rem 1rem;
    margin: 1.25rem 0;
    background-color: var(--authorpro-color-slate-50, #f8fafc);
    border-radius: 0 var(--authorpro-radius-sm, 0.25rem) var(--authorpro-radius-sm, 0.25rem) 0;
    font-style: italic;
    color: var(--authorpro-color-slate-800, #1e293b);
}

.authorpro-comment-content :where(cite),
.authorpro-comment-text :where(cite),
.comment-content :where(cite),
.comment-body :where(cite) {
    display: inline-block;
    font-style: normal;
    font-size: 0.8125rem;
    color: var(--authorpro-color-slate-500, #64748b);
    margin-top: 0.35rem;
}

/* Code & Preformatted Blocks */
.authorpro-comment-content :where(code),
.authorpro-comment-text :where(code),
.comment-content :where(code),
.comment-body :where(code) {
    font-family: var(--authorpro-font-mono);
    font-size: 0.8125rem;
    padding: 0.15rem 0.35rem;
    background-color: var(--authorpro-color-slate-100);
    border-radius: var(--authorpro-radius-sm);
    color: var(--authorpro-color-slate-900);
}

.authorpro-comment-content :where(pre),
.authorpro-comment-text :where(pre),
.comment-content :where(pre),
.comment-body :where(pre) {
    padding: 0.75rem 1rem;
    background-color: var(--authorpro-color-slate-900);
    color: #f8fafc;
    border-radius: var(--authorpro-radius-md);
    overflow-x: auto;
    margin: 1rem 0;
}

.authorpro-comment-content :where(pre code),
.authorpro-comment-text :where(pre code),
.comment-content :where(pre code),
.comment-body :where(pre code) {
    padding: 0;
    background: transparent;
    color: inherit;
}

/* Lists */
.authorpro-comment-content :where(ul, ol),
.authorpro-comment-text :where(ul, ol),
.comment-content :where(ul, ol),
.comment-body :where(ul, ol) {
    padding-left: 1.25rem;
    margin: 0.75rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.authorpro-comment-content :where(ul),
.authorpro-comment-text :where(ul),
.comment-content :where(ul),
.comment-body :where(ul) {
    list-style-type: disc;
}

.authorpro-comment-content :where(ol),
.authorpro-comment-text :where(ol),
.comment-content :where(ol),
.comment-body :where(ol) {
    list-style-type: decimal;
}

/* Definition Lists (dl, dt, dd) */
.authorpro-comment-content :where(dl),
.authorpro-comment-text :where(dl),
.comment-content :where(dl),
.comment-body :where(dl) {
    margin: 1.25rem 0;
}

.authorpro-comment-content :where(dt),
.authorpro-comment-text :where(dt),
.comment-content :where(dt),
.comment-body :where(dt) {
    font-weight: 600;
    color: var(--authorpro-color-slate-900, #0f172a);
    margin-top: 0.75rem;
    font-size: 0.9375rem;
}

.authorpro-comment-content :where(dd),
.authorpro-comment-text :where(dd),
.comment-content :where(dd),
.comment-body :where(dd) {
    margin-left: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--authorpro-color-slate-600, #475569);
}

/* Tables (table, thead, th, td) */
.authorpro-comment-content :where(table),
.authorpro-comment-text :where(table),
.comment-content :where(table),
.comment-body :where(table) {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.875rem;
}

.authorpro-comment-content :where(th),
.authorpro-comment-text :where(th),
.comment-content :where(th),
.comment-body :where(th) {
    background-color: var(--authorpro-color-slate-50, #f8fafc);
    color: var(--authorpro-color-slate-900, #0f172a);
    font-weight: 600;
    text-align: left;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--authorpro-color-slate-200, #e2e8f0);
}

.authorpro-comment-content :where(td),
.authorpro-comment-text :where(td),
.comment-content :where(td),
.comment-body :where(td) {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--authorpro-color-slate-200, #e2e8f0);
    color: var(--authorpro-color-slate-700, #334155);
}

.authorpro-comment-content :where(tr:nth-child(even) td),
.authorpro-comment-text :where(tr:nth-child(even) td),
.comment-content :where(tr:nth-child(even) td),
.comment-body :where(tr:nth-child(even) td) {
    background-color: rgba(248, 250, 252, 0.5);
}

/* Horizontal Rules */
.authorpro-comment-content :where(hr),
.authorpro-comment-text :where(hr),
.comment-content :where(hr),
.comment-body :where(hr) {
    border: 0;
    border-top: 1px solid var(--authorpro-color-slate-200, #e2e8f0);
    margin: 1.5rem 0;
}

/* Inline Formatting */
.authorpro-comment-content :where(strong),
.authorpro-comment-text :where(strong),
.comment-content :where(strong),
.comment-body :where(strong) {
    font-weight: 600;
    color: var(--authorpro-color-slate-900);
}

.authorpro-comment-content :where(del),
.authorpro-comment-text :where(del),
.comment-content :where(del),
.comment-body :where(del) {
    color: var(--authorpro-color-slate-400);
}

.authorpro-comment-content :where(ins, mark),
.authorpro-comment-text :where(ins, mark),
.comment-content :where(ins, mark),
.comment-body :where(ins, mark) {
    background-color: #fef08a;
    text-decoration: none;
    padding: 0 0.2rem;
}

.authorpro-comment-moderation {
    color: var(--authorpro-color-brand-600);
    font-style: italic;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.no-comments {
    color: var(--authorpro-color-slate-500);
    font-size: 0.875rem;
    font-style: italic;
    text-align: center;
    margin: 2rem 0;
}

/* =============================================================
   3. Comment Form Component
   ============================================================= */
.authorpro-comment-form-wrap,
.comment-respond {
    margin-top: 4rem;
    background-color: var(--authorpro-color-white);
    border-radius: var(--authorpro-radius-2xl);
    border: 1px solid var(--authorpro-color-slate-200);
    padding: 2rem;
    box-shadow: var(--authorpro-shadow-sm);
}

.authorpro-reply-title,
#reply-title {
    font-family: var(--authorpro-font-heading);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--authorpro-color-slate-900);
    margin-top: 0;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#cancel-comment-reply-link {
    font-size: 0.75rem;
    color: var(--authorpro-color-brand-600);
    font-weight: 500;
    margin-left: 1rem;
    text-decoration: none;
}

#cancel-comment-reply-link:hover {
    text-decoration: underline;
}

.comment-form {
    display: flex;
    flex-direction: column;
}

.authorpro-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .authorpro-form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.comment-form-author,
.comment-form-email,
.comment-form-url,
.comment-form-comment {
    margin-bottom: 1.5rem;
}

.comment-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--authorpro-color-slate-700);
    margin-bottom: 0.5rem;
}

.comment-form label .required,
.comment-form .required {
    color: var(--authorpro-color-brand-600);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--authorpro-color-slate-50);
    border: 1px solid var(--authorpro-color-slate-200);
    border-radius: var(--authorpro-radius-lg);
    font-size: 0.875rem;
    color: var(--authorpro-color-slate-900);
    outline: none;
    transition: border-color var(--authorpro-transition-fast), box-shadow var(--authorpro-transition-fast), background-color var(--authorpro-transition-fast);
}

.comment-form input[type="text"]:focus,
.comment-form input[type="email"]:focus,
.comment-form input[type="url"]:focus,
.comment-form textarea:focus {
    border-color: var(--authorpro-color-brand-600);
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.2);
    background-color: var(--authorpro-color-white);
}

.comment-form textarea {
    resize: vertical;
    min-height: 8rem;
}

/* Cookie Consent Checkbox */
.comment-form-cookies-consent {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.comment-form-cookies-consent input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin-top: 0.25rem;
    border-radius: var(--authorpro-radius-xs);
    border: 1px solid var(--authorpro-color-slate-300);
    accent-color: var(--authorpro-color-brand-600);
    cursor: pointer;
}

.comment-form-cookies-consent label {
    font-size: 0.875rem;
    color: var(--authorpro-color-slate-600);
    line-height: 1.4;
    cursor: pointer;
    margin-bottom: 0;
}

/* Submit Button */
.authorpro-submit-btn,
.form-submit #submit,
.comment-form .submit {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 2rem;
    background-color: var(--authorpro-color-slate-900);
    color: var(--authorpro-color-white);
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: var(--authorpro-radius-lg);
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.2);
    transition: background-color var(--authorpro-transition-fast), transform var(--authorpro-transition-fast), box-shadow var(--authorpro-transition-fast);
}

.authorpro-submit-btn:hover,
.form-submit #submit:hover,
.comment-form .submit:hover {
    background-color: var(--authorpro-color-slate-800);
    transform: translateY(-2px);
    box-shadow: 0 15px 20px -3px rgba(15, 23, 42, 0.25);
}

.authorpro-submit-btn:focus-visible,
.form-submit #submit:focus-visible,
.comment-form .submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--authorpro-color-brand-600), 0 0 0 4px var(--authorpro-color-white);
}
