/* --- 1. THEME VARIABLES --- */
:root {
    /* BRAND COLOR (Your Green) */
    --zen-primary: #374f2f;
    --zen-primary-hover: #2a3d24;
    --zen-primary-faint: rgba(55, 79, 47, 0.1); /* Light green for selections */
    
    /* DEFAULTS */
    --zen-bg: #ffffff;
    --zen-bg-sec: #f8f9fa; /* Secondary background */
    --zen-border: #dfe1e5;
    --zen-text: #2c2c2c;
    --zen-text-muted: #666666;
    --zen-shadow: rgba(0,0,0,0.05);
}

/* --- 2. LAYOUT --- */
.zen-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--zen-bg);
    color: var(--zen-text);
    padding: 30px;
    margin-top: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--zen-shadow);
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--zen-border);
}

/* --- 3. REACTIONS --- */
.zen-reactions-area {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--zen-border);
    text-align: center;
}
.zen-reactions-area h4 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--zen-text-muted);
    font-weight: 600;
}
.zen-emojis { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

.zen-emoji-btn {
    all: unset;
    background: var(--zen-bg-sec);
    border: 1px solid var(--zen-border);
    border-radius: 50px;
    padding: 6px 16px;
    cursor: pointer;
    display: inline-flex; /* Use inline-flex for tight wrapping */
    align-items: center;  /* Vertical center */
    justify-content: center;
    gap: 8px;
    transition: 0.2s;
    line-height: 1; /* Crucial: kills parent line-height interference */
}

.zen-emoji-btn:hover {
    background: var(--zen-bg);
    transform: translateY(-2px);
    border-color: var(--zen-primary);
}
.zen-emoji-btn.selected {
    background: var(--zen-primary-faint);
    border-color: var(--zen-primary);
}

/* 
 * EMOJI CENTERING FIX 
 * This ensures native text emojis (when WP emoji support is disabled)
 * align perfectly with images and text.
 */
.zen-emoji-btn .emoji { 
    font-size: 18px; 
    line-height: 1; 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1em;
    width: 1em;
    /* Force standard emoji fonts to prevent random baseline jumps */
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
    margin-bottom: 2px; /* Optical adjustment for some fonts */
}

/* If WP Emoji support IS enabled, it uses an <img> tag. This ensures that stays centered too */
.zen-emoji-btn .emoji img {
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle !important;
}

.zen-emoji-btn .count { font-weight: bold; font-size: 13px; color: var(--zen-text-muted); }
.zen-emoji-btn.selected .count { color: var(--zen-primary); }
.zen-emoji-btn .label { font-size: 12px; color: var(--zen-text-muted); text-transform: uppercase; font-weight: 600; }

/* --- 4. HEADER & SORT --- */
.zen-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.zen-header h3 { margin: 0; font-size: 20px; color: var(--zen-text); }

.zen-sort button {
    all: unset; 
    cursor: pointer; 
    font-weight: 600;
    color: var(--zen-text-muted);
    font-size: 14px; 
    margin-left: 15px;
    opacity: 0.7;
    transition: opacity 0.2s;
    
    /* FIX FOR THE SQUARE HIGHLIGHT */
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
}

.zen-sort button:hover { 
    opacity: 1; 
    color: var(--zen-text); 
}

.zen-sort button.active {
    opacity: 1;
    color: var(--zen-text);
    /* No underline, no background */
}

/* --- 5. EDITOR --- */
.zen-form { display: flex; gap: 15px; margin-bottom: 40px; }
.zen-avatar img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }

.zen-editor-box {
    border: 1px solid var(--zen-border);
    border-radius: 8px;
    background: var(--zen-bg);
    overflow: hidden;
    transition: border-color 0.2s;
}
.zen-editor-box:focus-within {
    border-color: var(--zen-primary);
    box-shadow: 0 0 0 1px var(--zen-primary);
}

.zen-toolbar {
    display: flex; gap: 4px;
    background: var(--zen-bg-sec);
    padding: 6px;
    border-bottom: 1px solid var(--zen-border);
}
.zen-tool {
    all: unset; cursor: pointer; padding: 6px; border-radius: 4px;
    color: var(--zen-text-muted);
    display: flex; align-items: center; justify-content: center;
}
.zen-tool:hover { background: var(--zen-bg); color: var(--zen-text); }
.zen-tool.active { background: var(--zen-border); color: var(--zen-text); }

.zen-editor {
    min-height: 80px; padding: 12px; outline: none;
    font-size: 15px; line-height: 1.6;
    max-height: 400px; overflow-y: auto;
    color: var(--zen-text);
    background: var(--zen-bg);
}
.zen-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--zen-text-muted);
    pointer-events: none;
    display: block;
}
.zen-editor img { max-width: 100%; border-radius: 4px; display: block; margin: 10px 0; }

.zen-form-footer {
    padding: 8px 12px;
    background: var(--zen-bg-sec);
    border-top: 1px solid var(--zen-border);
    text-align: right;
}

.zen-form button[type="submit"] {
    all: unset;
    background: var(--zen-primary);
    color: white;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
.zen-form button[type="submit"]:hover { background: var(--zen-primary-hover); }

/* --- 6. COMMENTS --- */
.zen-comment { display: flex; margin-bottom: 25px; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.zen-body { margin-left: 15px; flex: 1; }
.zen-meta { margin-bottom: 6px; font-size: 14px; color: var(--zen-text-muted); }
.zen-meta strong { color: var(--zen-text); margin-right: 8px; }
.zen-meta span { color: var(--zen-text-muted); font-size: 12px; }

.zen-content { color: var(--zen-text); line-height: 1.6; font-size: 15px; margin-bottom: 8px; }
.zen-content img { max-width: 100%; border-radius: 6px; margin-top: 8px; }

/* ACTIONS */
.zen-actions { display: flex; align-items: center; gap: 15px; }
.zen-btn-vote {
    all: unset; cursor: pointer; display: flex; align-items: center;
    color: var(--zen-text-muted); transition: 0.2s;
}
.zen-btn-vote:hover { color: var(--zen-primary); }
.zen-karma { font-weight: bold; font-size: 13px; color: var(--zen-text); margin: 0 4px; }
.zen-icon { width: 14px; height: 14px; fill: currentColor; }

.zen-reply-btn { font-size: 13px; font-weight: 600; color: var(--zen-text-muted); cursor: pointer; }
.zen-reply-btn:hover { color: var(--zen-primary); text-decoration: underline; }

.zen-children { border-left: 2px solid var(--zen-border); margin-left: 20px; padding-left: 20px; margin-top: 20px; }
.zen-login-prompt {
    text-align: center; padding: 20px;
    background: var(--zen-bg-sec);
    border-radius: 8px;
    color: var(--zen-text-muted);
    border: 1px solid var(--zen-border);
}
.zen-login-prompt a { color: var(--zen-primary); font-weight: bold; }