/**
 * comments.css
 *
 * Custom comment section styles matching the site's design language.
 *
 * @since 1.4.0
 */

/* ========================================
   Comments Section Container
======================================== */
.cb-comments-section {
    margin: 50px 0 60px;
    font-family: var(--cb-font-main, 'Outfit', sans-serif);
}

.cb-comments-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 24px 0;
    padding-bottom: 14px;
    border-bottom: 2px solid #f1f5f9;
}

.cb-comments-header svg {
    width: 20px;
    height: 20px;
    fill: #6366f1;
}

.cb-comments-count {
    font-weight: 600;
    color: #94a3b8;
    font-size: 0.9em;
}

/* ========================================
   Comment List
======================================== */
.cb-comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cb-comment-item {
    margin-bottom: 20px;
}

.cb-comment-item .children {
    list-style: none;
    margin: 12px 0 0 0;
    padding-left: 24px;
    border-left: 2px solid #e2e8f0;
}

.cb-comment-item .children .cb-comment-body {
    background: #f8fafc;
}

/* ========================================
   Comment Body
======================================== */
.cb-comment-body {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px 24px;
    transition: border-color 0.2s;
}

.cb-comment-body:hover {
    border-color: #c7d2fe;
}

/* Comment Meta (avatar + name + date) */
.cb-comment-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.cb-comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
}

.cb-comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.cb-comment-author {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
}

.cb-comment-author-badge {
    display: inline-block;
    padding: 1px 8px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-left: 6px;
    vertical-align: middle;
}

.cb-comment-date {
    font-size: 0.78rem;
    color: #94a3b8;
}

/* Comment Content */
.cb-comment-content {
    font-size: 0.93rem;
    line-height: 1.7;
    color: #334155;
    margin-bottom: 10px;
}

.cb-comment-content p {
    margin: 0 0 8px 0;
}

.cb-comment-content p:last-child {
    margin-bottom: 0;
}

/* Comment Actions (like, dislike, reply) */
.cb-comment-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cb-comment-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1;
}

.cb-comment-action-btn svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}

.cb-comment-action-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.cb-comment-action-btn.is-active {
    pointer-events: none;
}

.cb-comment-like-btn.is-active {
    background: #dcfce7;
    color: #16a34a;
}

.cb-comment-dislike-btn.is-active {
    background: #fee2e2;
    color: #dc2626;
}

.cb-comment-actions .has-voted .cb-comment-action-btn:not(.is-active) {
    opacity: 0.4;
    pointer-events: none;
}

.cb-comment-reply-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #6366f1;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 50px;
    transition: background 0.2s;
}

.cb-comment-reply-link:hover {
    background: #eef2ff;
    color: #4f46e5;
}

/* ========================================
   Comment Form
======================================== */
.cb-comment-form-wrapper {
    margin-top: 32px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 28px 28px;
}

.cb-comment-form-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 20px 0;
}

.cb-comment-form .comment-form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.cb-comment-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cb-comment-field label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
}

.cb-comment-field input,
.cb-comment-field textarea {
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #1e293b;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    resize: vertical;
}

.cb-comment-field input:focus,
.cb-comment-field textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.cb-comment-field textarea {
    min-height: 100px;
}

.cb-comment-submit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.cb-comment-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 28px;
    background: var(--cb-gradient-primary-btn, linear-gradient(135deg, #6366f1, #818cf8));
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.cb-comment-submit-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.cb-comment-privacy-note {
    font-size: 0.75rem;
    color: #94a3b8;
    flex: 1;
}

/* Honeypot */
.cb-hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

/* Reply form inline */
#respond {
    margin-top: 16px;
}

#cancel-comment-reply-link {
    font-size: 0.82rem;
    color: #dc2626;
    margin-left: 12px;
}

/* Awaiting moderation */
.cb-comment-moderation {
    display: inline-block;
    padding: 2px 10px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 6px;
}

/* ========================================
   No Comments Yet
======================================== */
.cb-no-comments {
    text-align: center;
    padding: 32px 20px;
    color: #94a3b8;
    font-size: 0.92rem;
}

/* ========================================
   Responsive — Tablet
======================================== */
@media (max-width: 768px) {
    .cb-comments-section {
        margin: 40px 0 50px;
    }

    .cb-comments-header {
        font-size: 1.1rem;
        gap: 8px;
        margin-bottom: 20px;
        padding-bottom: 12px;
    }

    .cb-comments-header svg {
        width: 18px;
        height: 18px;
    }

    .cb-comment-item {
        margin-bottom: 16px;
    }

    .cb-comment-body {
        padding: 16px 18px;
        border-radius: 12px;
    }

    .cb-comment-content {
        font-size: 0.9rem;
        line-height: 1.65;
    }

    .cb-comment-actions {
        gap: 10px;
    }

    .cb-comment-action-btn {
        padding: 6px 12px;
        font-size: 0.76rem;
    }

    .cb-comment-reply-link {
        padding: 6px 12px;
        font-size: 0.76rem;
    }

    .cb-comment-form-wrapper {
        padding: 22px 20px;
        border-radius: 12px;
        margin-top: 24px;
    }

    .cb-comment-form-title {
        font-size: 1rem;
        margin-bottom: 16px;
    }

    .cb-comment-form .comment-form-fields {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .cb-comment-field input,
    .cb-comment-field textarea {
        padding: 12px 14px;
        font-size: 1rem;
        border-radius: 10px;
        /* Prevent iOS zoom on focus */
        -webkit-appearance: none;
        appearance: none;
    }

    .cb-comment-field textarea {
        min-height: 110px;
    }

    .cb-comment-submit-row {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 10px;
    }

    .cb-comment-submit-btn {
        width: 100%;
        justify-content: center;
        padding: 13px 24px;
        font-size: 0.92rem;
    }

    .cb-comment-privacy-note {
        text-align: center;
        font-size: 0.72rem;
    }

    .cb-comment-item .children {
        padding-left: 16px;
        margin-top: 10px;
    }
}

/* ========================================
   Responsive — Mobile
======================================== */
@media (max-width: 480px) {
    .cb-comments-section {
        margin: 32px 0 40px;
    }

    .cb-comments-header {
        font-size: 1rem;
        gap: 6px;
        margin-bottom: 16px;
        padding-bottom: 10px;
    }

    .cb-comments-header svg {
        width: 16px;
        height: 16px;
    }

    .cb-comments-count {
        font-size: 0.82em;
    }

    .cb-comment-item {
        margin-bottom: 12px;
    }

    .cb-comment-body {
        padding: 14px 14px;
        border-radius: 10px;
    }

    .cb-comment-meta {
        gap: 8px;
        margin-bottom: 8px;
    }

    .cb-comment-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.72rem;
    }

    .cb-comment-author {
        font-size: 0.84rem;
    }

    .cb-comment-author-badge {
        font-size: 0.58rem;
        padding: 1px 6px;
        margin-left: 4px;
    }

    .cb-comment-date {
        font-size: 0.72rem;
    }

    .cb-comment-content {
        font-size: 0.86rem;
        line-height: 1.6;
        margin-bottom: 8px;
    }

    .cb-comment-actions {
        gap: 6px;
        flex-wrap: wrap;
    }

    .cb-comment-action-btn {
        padding: 5px 10px;
        font-size: 0.72rem;
        gap: 3px;
    }

    .cb-comment-action-btn svg {
        width: 12px;
        height: 12px;
    }

    .cb-comment-reply-link {
        padding: 5px 10px;
        font-size: 0.72rem;
    }

    .cb-comment-form-wrapper {
        padding: 16px 14px;
        border-radius: 10px;
        margin-top: 20px;
    }

    .cb-comment-form-title {
        font-size: 0.95rem;
        margin-bottom: 14px;
    }

    .cb-comment-field label {
        font-size: 0.78rem;
    }

    .cb-comment-field input,
    .cb-comment-field textarea {
        padding: 11px 12px;
        font-size: 1rem;
        border-radius: 8px;
    }

    .cb-comment-field textarea {
        min-height: 100px;
    }

    .cb-comment-submit-btn {
        padding: 12px 20px;
        font-size: 0.88rem;
    }

    .cb-comment-privacy-note {
        font-size: 0.7rem;
    }

    .cb-comment-item .children {
        padding-left: 12px;
        border-left-width: 1.5px;
    }

    .cb-no-comments {
        padding: 24px 16px;
        font-size: 0.86rem;
    }

    .cb-comment-moderation {
        font-size: 0.68rem;
        padding: 2px 8px;
    }

    #cancel-comment-reply-link {
        font-size: 0.76rem;
    }
}