/**
 * Comments Section - Menara Theme
 * Clean, typographically refined design with unique character
 * 
 * @package Menara
 */

/* ==========================================================================
   COMMENTS CONTAINER
   ========================================================================== */

.comments-area {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

/* Header */
.comments-title {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-teks);
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-primary);
    display: inline-block;
}

.comments-title span {
    font-weight: 400;
    color: var(--color-secondary);
}

/* ==========================================================================
   COMMENT LIST
   ========================================================================== */

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Individual Comment Item */
.comment-list > .comment {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.comment-list > .comment:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* ==========================================================================
   COMMENT BODY STRUCTURE
   ========================================================================== */

.comment-body {
    position: relative;
}

/* Comment Meta (Header) */
.comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Author Section */
.comment-author.vcard {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

/* Avatar */
.comment-author .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--color-bg-alt, #f3f4f6);
}

/* Author Name */
.comment-author .fn {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-teks);
    line-height: 1.3;
}

.comment-author .fn a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.comment-author .fn a:hover {
    color: var(--color-primary);
}

/* Hide "says" text */
.comment-author .says {
    display: none;
}

/* Date/Time */
.comment-metadata {
    font-size: 0.8125rem;
    color: var(--color-secondary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.comment-metadata::before {
    content: "•";
    font-size: 0.625rem;
}

.comment-metadata a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.comment-metadata a:hover {
    color: var(--color-primary);
}

.comment-metadata time {
    white-space: nowrap;
}

/* Edit Link */
.comment-metadata .edit-link {
    margin-left: 0.5rem;
}

.comment-metadata .edit-link::before {
    content: "•";
    margin-right: 0.5rem;
    font-size: 0.625rem;
}

.comment-metadata .edit-link a {
    color: var(--color-primary);
    font-weight: 500;
}

/* Awaiting Moderation */
.comment-awaiting-moderation {
    display: inline-block;
    font-size: 0.75rem;
    color: #92400e;
    background: #fef3c7;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    border: 1px solid #fcd34d;
}

/* ==========================================================================
   COMMENT CONTENT
   ========================================================================== */

.comment-content {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--color-teks);
    padding-left: 52px; /* Align with text after avatar */
}

.comment-content p {
    margin: 0 0 0.625rem 0;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

.comment-content a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.comment-content a:hover {
    text-decoration-thickness: 2px;
}

.comment-content blockquote {
    margin: 0.75rem 0;
    padding: 0.5rem 0 0.5rem 1rem;
    border-left: 3px solid var(--color-primary);
    color: var(--color-secondary);
    font-style: italic;
    background: var(--color-bg-alt, #f9fafb);
}

.comment-content code {
    background: var(--color-bg-alt, #f3f4f6);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.8125em;
    font-family: ui-monospace, 'SF Mono', Consolas, monospace;
}

/* ==========================================================================
   REPLY BUTTON
   ========================================================================== */

.reply {
    padding-left: 52px; /* Align with content */
    margin-top: 0.5rem;
}

.comment-reply-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-secondary);
    text-decoration: none;
    padding: 0.25rem 0;
    transition: color 0.15s ease;
}

.comment-reply-link::before {
    content: "\21A9"; /* Unicode for ↩ */
    font-size: 0.875rem;
    transition: transform 0.15s ease;
}

.comment-reply-link:hover {
    color: var(--color-primary);
}

.comment-reply-link:hover::before {
    transform: translateX(-2px);
}

/* ==========================================================================
   THREADED REPLIES (Children)
   ========================================================================== */

.comment-list .children {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 52px;
    border-left: 2px solid var(--color-border);
    padding-left: 1rem;
}

.comment-list .children .comment {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--color-border);
}

.comment-list .children .comment:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* Smaller avatars for replies */
.comment-list .children .comment-author .avatar {
    width: 32px;
    height: 32px;
}

.comment-list .children .comment-content,
.comment-list .children .reply {
    padding-left: 44px; /* Adjust for smaller avatar */
}

/* Deeper nesting */
.comment-list .children .children {
    margin-left: 44px;
}

/* No Comments */
.no-comments {
    font-size: 0.9375rem;
    color: var(--color-secondary);
    padding: 1.5rem;
    text-align: center;
    background: var(--color-bg-alt, #f9fafb);
    border-radius: 8px;
}

/* ==========================================================================
   COMMENT NAVIGATION
   ========================================================================== */

.comment-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin: 1rem 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
}

.comment-navigation .nav-links {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.comment-navigation a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.15s ease;
}

.comment-navigation a:hover {
    opacity: 0.8;
}

/* ==========================================================================
   COMMENT FORM
   ========================================================================== */

.comment-respond {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--color-bg-alt, #f9fafb);
    border-radius: 8px;
}

/* Form Title */
.comment-reply-title {
    font-family: var(--font-heading);
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--color-teks);
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Cancel Reply Link */
.comment-reply-title small {
    font-size: 0.8125rem;
    font-weight: 400;
}

.comment-reply-title small a {
    color: var(--color-secondary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.comment-reply-title small a:hover {
    background: #fff;
    color: var(--color-teks);
}

/* Form Notes */
.comment-notes {
    font-size: 0.8125rem;
    color: var(--color-secondary);
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.required-field-message {
    font-size: 0.8125rem;
    color: var(--color-secondary);
    margin-bottom: 0.75rem;
}

/* Labels */
.comment-form label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-teks);
    margin-bottom: 0.25rem;
}

.comment-form .required {
    color: #dc2626;
}

/* Input Fields */
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--color-teks);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    margin-bottom: 0.875rem;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.comment-form input::placeholder,
.comment-form textarea::placeholder {
    color: var(--color-secondary);
    opacity: 0.6;
}

.comment-form textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* Form Fields */
.comment-form-author,
.comment-form-email,
.comment-form-url {
    margin-bottom: 0;
}

/* Desktop: 3 columns for name/email/url */
@media (min-width: 640px) {
    .comment-form-author,
    .comment-form-email,
    .comment-form-url {
        display: inline-block;
        width: calc(33.333% - 0.5rem);
        vertical-align: top;
    }
    
    .comment-form-author,
    .comment-form-email {
        margin-right: 0.5rem;
    }
}

/* Submit Button */
.comment-form .form-submit {
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.comment-form .submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    background: var(--color-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.comment-form .submit:hover {
    background: var(--color-primary-dark, #1e40af);
}

.comment-form .submit:active {
    transform: scale(0.98);
}

/* Logged In As */
.logged-in-as {
    font-size: 0.875rem;
    color: var(--color-teks);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.logged-in-as a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.logged-in-as a:hover {
    text-decoration: underline;
}

/* Cookies Consent */
.comment-form-cookies-consent {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.comment-form-cookies-consent input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.comment-form-cookies-consent label {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--color-secondary);
    margin-bottom: 0;
    cursor: pointer;
    line-height: 1.5;
}

/* ==========================================================================
   DARK MODE
   ========================================================================== */

html[theme="darkmode"] .comments-area {
    border-top-color: var(--color-border-dark, #374151);
}

html[theme="darkmode"] .comments-title {
    color: var(--text-color-dark, #fff);
}

html[theme="darkmode"] .comments-title span {
    color: #9ca3af;
}

html[theme="darkmode"] .comment-list > .comment {
    border-bottom-color: var(--color-border-dark, #374151);
}

html[theme="darkmode"] .comment-author .avatar {
    border-color: var(--color-border-dark, #374151);
}

html[theme="darkmode"] .comment-author .fn {
    color: var(--text-color-dark, #fff);
}

html[theme="darkmode"] .comment-metadata {
    color: #9ca3af;
}

html[theme="darkmode"] .comment-content {
    color: #e5e7eb;
}

html[theme="darkmode"] .comment-content blockquote {
    background: rgba(255, 255, 255, 0.03);
    border-left-color: var(--color-primary);
    color: #9ca3af;
}

html[theme="darkmode"] .comment-content code {
    background: rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
}

html[theme="darkmode"] .comment-reply-link {
    color: #9ca3af;
}

html[theme="darkmode"] .comment-list .children {
    border-left-color: var(--color-border-dark, #374151);
}

html[theme="darkmode"] .comment-list .children .comment {
    border-bottom-color: var(--color-border-dark, #374151);
}

html[theme="darkmode"] .no-comments {
    background: rgba(255, 255, 255, 0.03);
    color: #9ca3af;
}

html[theme="darkmode"] .comment-navigation {
    border-color: var(--color-border-dark, #374151);
}

html[theme="darkmode"] .comment-respond {
    background: rgba(255, 255, 255, 0.03);
}

html[theme="darkmode"] .comment-reply-title {
    color: var(--text-color-dark, #fff);
}

html[theme="darkmode"] .comment-reply-title small a {
    color: #9ca3af;
}

html[theme="darkmode"] .comment-reply-title small a:hover {
    background: var(--color-border-dark, #374151);
    color: var(--text-color-dark, #fff);
}

html[theme="darkmode"] .comment-notes,
html[theme="darkmode"] .required-field-message {
    color: #9ca3af;
}

html[theme="darkmode"] .comment-form label {
    color: #e5e7eb;
}

html[theme="darkmode"] .comment-form input[type="text"],
html[theme="darkmode"] .comment-form input[type="email"],
html[theme="darkmode"] .comment-form input[type="url"],
html[theme="darkmode"] .comment-form textarea {
    background: var(--color-dark-bg, #18181b);
    border-color: var(--color-border-dark, #374151);
    color: var(--text-color-dark, #fff);
}

html[theme="darkmode"] .comment-form input:focus,
html[theme="darkmode"] .comment-form textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(8, 113, 215, 0.2);
}

html[theme="darkmode"] .comment-form input::placeholder,
html[theme="darkmode"] .comment-form textarea::placeholder {
    color: #6b7280;
}

html[theme="darkmode"] .comment-awaiting-moderation {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

html[theme="darkmode"] .logged-in-as {
    color: #e5e7eb;
}

html[theme="darkmode"] .comment-form-cookies-consent label {
    color: #9ca3af;
}


/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 640px) {
    .comments-area {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }
    
    .comments-title {
        font-size: 1rem;
    }
    
    .comment-author .avatar {
        width: 36px;
        height: 36px;
    }
    
    .comment-author .fn {
        font-size: 0.875rem;
    }
    
    .comment-metadata {
        font-size: 0.75rem;
    }
    
    .comment-content {
        font-size: 0.875rem;
        padding-left: 0;
        margin-top: 0.625rem;
    }
    
    .reply {
        padding-left: 0;
    }
    
    .comment-list .children {
        margin-left: 1rem;
        padding-left: 0.75rem;
    }
    
    .comment-list .children .comment-content,
    .comment-list .children .reply {
        padding-left: 0;
    }
    
    .comment-list .children .children {
        margin-left: 0.75rem;
    }
    
    .comment-respond {
        padding: 1rem;
        margin-top: 1.5rem;
    }
    
    .comment-reply-title {
        font-size: 1rem;
    }
    
    .comment-form textarea {
        min-height: 100px;
    }
    
    .comment-form .submit {
        width: 100%;
    }
}

/* ==========================================================================
   SUBTLE ANIMATIONS
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
    .comment-list > .comment {
        animation: fadeUp 0.3s ease-out;
    }
    
    @keyframes fadeUp {
        from {
            opacity: 0;
            transform: translateY(8px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}
